Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

[SCENE] - HC2 post-reboot system checker


AutoFrank

Question

Hi,

 

Whenever I restart my HC2 I run a series of checks manually to see that the various parts are all operational

I finally got around to automating this :-) 

 

It waits 10 seconds and then runs a series of checks on a reboot

All checks are separate functions. I don't expect that it'll work out of the box for users but some of the approaches I use may be helpful in parts

 

Output in debug window, email or via smsgh

 

 

These systems are important to my setup and this is the output I get to give me a sense that all has started up okay

Please login or register to see this code.

output in debug window / via message hub (pushover)

 

Please login or register to see this attachment.

                     

Please login or register to see this attachment.

 

 

and this is how I check the various sections...

 

  1.  API - check that I  -get a 200 or 201 return code and non nil json response
  2. HC2 diags - read through the api
  3. HomeTable - check that I can read a table entry
  4. StateTable - check that I can read a table entry
  5. Main Scene (scene)  - check that running instances is > 0
  6. Message Hub (scene) - trigger a message and check that running instances is > 0
  7. WWWAPI Monitor (vd) - I added a specific debug message each loop and check for a match to that 
  8. LAN Monitor (vd) - I added a specific debug message each loop and check for a match  to that 
  9. Internet/SonosAPI/HABridge/USG/Alarm Gateway - from the StateTable (4) updated by the monitor (7)

 

Some config ID's at the to of the scene

 

lua file attached

 

_f

 

 

 

Please login or register to see this attachment.

Edited by AutoFrank
  • Like 1
Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • 24 minutes ago, jimicr said:

    An other nice one! will check it out when I get the time!

     

    Thanks @jimicr

    Hopefully you can adjust for your system when the time comes

     

     

    Modified post one with final solution 

     

     

     

    Link to comment
    Share on other sites

    • 0
    Guest pablo77

     

    Hi,

     

    I get this error:

     

     

    [DEBUG] 15:08:14: Running startup checks ...
    [DEBUG] 15:08:14:
    [DEBUG] 15:08:14: Automation Mode ....DISABLED
    [DEBUG] 15:08:17: HC2 API ....OK
    [DEBUG] 15:08:17: HC2 CPU ....OK - CPU0: 0.98% / CPU1: 2.83%
    [DEBUG] 15:08:17: HC2 Free Memory ....OK - 55%
    [DEBUG] 15:08:17: HC2 Sys Free Storage ....OK - 58%
    [DEBUG] 15:08:17: HC2 Rec FRee Storage ....OK - 71%
    [DEBUG] 15:08:19: line 142: attempt to index global 'jT' (a number value)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 12 minutes ago, pablo77 said:

     

    Hi,

     

    I get this error:

     

     

    [DEBUG] 15:08:14: Running startup checks ...
    [DEBUG] 15:08:14:
    [DEBUG] 15:08:14: Automation Mode ....DISABLED
    [DEBUG] 15:08:17: HC2 API ....OK
    [DEBUG] 15:08:17: HC2 CPU ....OK - CPU0: 0.98% / CPU1: 2.83%
    [DEBUG] 15:08:17: HC2 Free Memory ....OK - 55%
    [DEBUG] 15:08:17: HC2 Sys Free Storage ....OK - 58%
    [DEBUG] 15:08:17: HC2 Rec FRee Storage ....OK - 71%
    [DEBUG] 15:08:19: line 142: attempt to index global 'jT' (a number value)

    Hi @pablo77

    It looks like you don't use a home table so you can comment out that check

    Further down you may need to change some of the references or comment lines out ...

    Link to comment
    Share on other sites

    • 0

    Hi AutoFrank

     

    First thank you for all your scripts.

    they are very helpful

     

    when im try to running this scene i receive always the same error

     

    [DEBUG] 06:44:55: line 142: attempt to index field 'status' (a nil value)

    i tryed to remove the tables check and then it works fine.

    what can i do to work with the tables?

    because they are present and both are working with example (netatmo, SMsgH)

     

    Link to comment
    Share on other sites

    • 0

    Hi @AutoFrank

     

    in the message are both scripts attached.

     

    the NotWorking.txt are only in the last part modified, i deleted the 3 last checks in the checkWWWAPIDevices

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 35 minutes ago, kaycut said:

    Hi @AutoFrank

     

    in the message are both scripts attached.

     

    the NotWorking.txt are only in the last part modified, i deleted the 3 last checks in the checkWWWAPIDevices

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Hi @kaycut

    Both scripts seem the same to me

    Did you accidently post the wrong one ?

    Link to comment
    Share on other sites

    • 0
    Just now, AutoFrank said:

    Hi @kaycut

    Both scripts seem the same to me

    Did you accidently post the wrong one ?

     

    The "wrong" one that are not working is the file NotWorking.

    getting following error

     

     

    [DEBUG] 14:18:27: Running startup checks ...
    [DEBUG] 14:18:27:
    [DEBUG] 14:18:27: Automation Mode ....DISABLED
    [DEBUG] 14:18:30: HC2 API ....OK
    [DEBUG] 14:18:30: HC2 CPU ....OK - CPU0: 4.9% / CPU1: 23.53%
    [DEBUG] 14:18:30: HC2 Free Memory ....OK - 54%
    [DEBUG] 14:18:30: HC2 Sys Free Storage ....OK - 58%
    [DEBUG] 14:18:30: HC2 Rec FRee Storage ....OK - 67%
    [DEBUG] 14:18:32: line 132: attempt to index field 'status' (a nil value)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 minutes ago, kaycut said:

     

    The "wrong" one that are not working is the file NotWorking.

    getting following error

     

     

    [DEBUG] 14:18:27: Running startup checks ...
    [DEBUG] 14:18:27:
    [DEBUG] 14:18:27: Automation Mode ....DISABLED
    [DEBUG] 14:18:30: HC2 API ....OK
    [DEBUG] 14:18:30: HC2 CPU ....OK - CPU0: 4.9% / CPU1: 23.53%
    [DEBUG] 14:18:30: HC2 Free Memory ....OK - 54%
    [DEBUG] 14:18:30: HC2 Sys Free Storage ....OK - 58%
    [DEBUG] 14:18:30: HC2 Rec FRee Storage ....OK - 67%
    [DEBUG] 14:18:32: line 132: attempt to index field 'status' (a nil value)

     

    @kaycut

     

    do you have this entry at the start of your hometable

     

    Please login or register to see this image.

    /monthly_2017_10/image.png.362d860eb1134f35c0093108860f51f5.png" alt="image.png.362d860eb1134f35c0093108860f51f5.png" />

    This is what line 132 is checking for ...

     

     

    Link to comment
    Share on other sites

    • 0

    now this part works thank you. you are the man.

    but now next fail. is statetable also a scene in your system or is this only an global variable?

     

     

    [DEBUG] 14:56:11: Home Table ....OK
    [DEBUG] 14:56:11: line 35: unexpected character @ character: 1 0:1 [T] line:
    [DEBUG] 14:56:11: T
     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 hour ago, kaycut said:

    now this part works thank you. you are the man.

    but now next fail. is statetable also a scene in your system or is this only an global variable?

     

     

    [DEBUG] 14:56:11: Home Table ....OK
    [DEBUG] 14:56:11: line 35: unexpected character @ character: 1 0:1 [T] line:
    [DEBUG] 14:56:11: T
     

     

    @kaycut

     

    yes, its also a global like hometable

    same entry is checked for 

     

    and the rest of the checks are....

     

    Please login or register to see this attachment.

    Edited by AutoFrank
    Link to comment
    Share on other sites

    • 0

    hello,

    I think after latest update the following part of the code is invalid as it is missing

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
    Guest andyhud

    Hi @AutoFrank

     

    Thanks for this but for me I'm struggling

     

    I've created a global variable called "automationMode" with 2 values of "ENABLED" and "DISABLED"

     

    I have not got a hometable yet, but not sure where to comment this out?

     

    And im getting this error. Havent got very far yet... 

     

    any assistance appreciated

     

    Thanks

     

    Andy

     

    Here is my code. My Main Scene for Time Based Events from @Sankotronic is ID 102

    Please login or register to see this code.


     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • no worries @andyhud

     

    Comment out specific function call in the function main at the end

     

    For instance if you don't have a hometable then comment out the line indicated below

     

    Please login or register to see this code.

    make sense ?

    Link to comment
    Share on other sites

    • 0
    Guest andyhud
    6 minutes ago, AutoFrank said:

    no worries @andyhud

     

    Comment out specific function call in the function main at the end

     

    For instance if you don't have a hometable then comment out the line indicated below

     

    Please login or register to see this code.

    make sense ?

     

    Hey @AutoFrank

    Many thanks, yep, perfect sense and below is what I've done... but still getting that error in the debug window. Am I still missing something?

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...