Results 1 to 9 of 9

Thread: Cortex 'uptime'

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Automated Home Sr Member mcockerell's Avatar
    Join Date
    Jan 2009
    Posts
    71

    Default Cortex 'uptime'

    The batch files that run when our Cortex server starts up write entries in a log file recording the date and time of each event; over the years this has proven useful when investigating problems, such as when the server reboots unexpectedly.
    Recently I decided that it would be helpful to have the latest boot date/time available on a Notice Board rather than having to login to the server and view the logfile. So I started to look at ways of presenting the information so that I could get it via the app on my Android device. I realised that the ideal would be to present a built-in object that held the Cortex start date/time, but that doesn't seem to exist, so I had to construct something similar myself.
    I modified a batch file to write the boot date and time to a file 'index.html' in JSON format, set-up a copy of the TinyWeb web server on port 8000 and added a Cortex Web Client API object to read the website at 127.0.0.1 - I now had the information I wanted in a Cortex object that I could present on the Notice Board.

    The index.html file looks like this:
    {
    "At":"17:40:47 on 10-03-2019"
    }

    When decoded this gives me a Cortex object called "Server Boot At Response 0" under "Web API Client".
    I have added the entry 'Server booted at <Web API Client.Server Boot At Response 0=$0>' to "All Display" and connected this to "Martin Notice Board - New Message in" to display a formatted message - it is triggered by the 'Server Boot Finished' signal from the 'Web API Client'.

    In order to force the message to be sticky on the Notice Board I send an event to the Web Client API Server Boot Send trigger every 15 minutes.

    Although this seems to be working as desired I do have a couple of questions:

    1) Is there an easier way of doing this?
    2) Is there an existing Cortex object that I could have used instead?

  2. #2
    Automated Home Legend chris_j_hunter's Avatar
    Join Date
    Dec 2007
    Location
    North Lancashire
    Posts
    1,670

    Default

    short answer is yes ...

    have a look at the connections available for World ...

    we use its On Initialise Complete connection to provoke announcement of Cortex relaunches via Sound & via AllDisplay ...

    our messages including <Time> & other inserts to say when it happened etc ...


    Chris

    PS: many thanks for posting detail on your approach - could help with some other things we're looking to include ...

  3. #3
    Automated Home Sr Member mcockerell's Avatar
    Join Date
    Jan 2009
    Posts
    71

    Default

    Thanks, I hadn't seen those connection possibilities.
    However, On Initialise Complete only seems to offer 'Annunciate' options, and I'm looking for message output - am I missing something?

  4. #4
    Automated Home Legend chris_j_hunter's Avatar
    Join Date
    Dec 2007
    Location
    North Lancashire
    Posts
    1,670

    Default

    ours is connected like this :

    World ... On Initialise Complete ... AllDisplay - CortexRunning Update Text Line

    AllDisplay ... Behaviour ... Name CortexRunning / DisplayText as you choose

    AllDisplay ... Connections ... CortexRunning Update Text Line - World / On Initialise Complete

    AllDisplay ... Connections ... CortexRunning Text Line Output - as follows :

    . Sound - Speak Text in Broadcast
    . NoticeBoard - New Message in
    . SystemMessages - Event Message in tray

    HTH

    Chris

  5. #5
    Automated Home Sr Member mcockerell's Avatar
    Join Date
    Jan 2009
    Posts
    71

    Default

    I am happy with the way that I can see the last server reboot time on my noticeboard and decided to try a few other things; the TinyWeb server supports CGI, so I have written a Perl script to pull the last line from the current solar logging file so that I can display the temperatures in the thermal store - but I now realise that I don't quite understand how to substitute values into text message strings.
    This is the data that I use to create the message about the server reboot time: 2019-04-02 17_53_03-Web API Client Server Boot Send edit.jpg
    And this is the data that I have generated to provide information about the thermal store: 2019-04-02 17_53_31-Web API Client Thermal Store Send edit.jpg
    Here are the message strings that I use to output the text messages to the noticeboard: 2019-04-02 17_49_54-Idratek _ CortexW10 _ Green Cottage 2019.jpg
    This is what is sent to the noticeboard, first for the server reboot: 2019-04-02 17_51_35-Martin Notice Board Behaviour Menu.jpg
    And now for the thermal store: 2019-04-02 17_52_08-Martin Notice Board Behaviour Menu.jpg

    Clearly I am doing something wrong, but I can't see what the problem is - I have to admit that I struggled to get the server reboot message to display correctly at first.

    Please can someone explain how to correct this?

    Many thanks, Martin

  6. #6
    Automated Home Legend chris_j_hunter's Avatar
    Join Date
    Dec 2007
    Location
    North Lancashire
    Posts
    1,670

    Default

    without more info' on names you've used in your database, it's difficult to be sure ...

    could be a problem with / absence of eg: spaces in your names ...

    but, my guess is you're simply missing a $ sign in your AllDisplay display text ...

    we also load direct from AllDisplay to Noticeboard, as per my previous postings ...

    in case all that was too cryptic, then see attachment herewith ...

    HTH

    Chris
    Attached Images Attached Images
    Last edited by chris_j_hunter; 6th April 2019 at 04:21 PM.

  7. #7
    Automated Home Legend Karam's Avatar
    Join Date
    Mar 2005
    Posts
    816

    Default

    Try: $ Response 0=$0> at the end

    Or in general - When you create the user defined text, right click to bring up the Tag insertion tool then choose Insert objects property and from next list select the Text insertion Tag and in the ensuing connections menu enable the Value filter. Now you can search for the Web API Client and will see the response connections in the event ports list which you can then select Response 0 for in your case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •