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

Check Scenes Running Script


Question

Posted (edited)

@admin, maybe this should be moved to 

Please login or register to see this link.



Hi!

I have  a few scenes running all the time on my HC2. Or at least; they SHOULD be running all the time. 

But sometimes; my scenes fail and stop, for example when a certain http call returns an invalid json.

 

I tried a lot so solve all these issues (even removed all polling of data to external scripts instead of keeping them running in VDs) but still sometimes a scene fails and stops.

 

That's why I made a simple Scene to check if all important scenes which SHOULD run actually run. If not, they will be (re)started.

Just make sure this SceneChecker runs all the time. :-)

 

Please login or register to see this code.

 

logging will look like this:

Quote

[DEBUG] 11:04:54: Scene 'Nefit Poller' is running
[DEBUG] 11:04:54: Scene 'Solar Server Poller' isn't running, starting!
[DEBUG] 11:04:54: Scene 'Zon Onder' is running
[DEBUG] 11:04:54: Scene 'Ochtend Avond Trigger Aan' is running
[DEBUG] 11:04:54: Scene 'Gardena Status Checker' is running
[DEBUG] 11:04:54: Scene 'Ochtend Avond Trigger Uit' is running
[DEBUG] 11:04:54: Scene 'Zon Op' is running

 

Edited by doezel
  • Like 1
  • Thanks 3

4 answers to this question

Recommended Posts

  • 0
Posted

I think you can use 

 

local num = fibaro:countScenes()

 

to check if this is only running once ...

  • 0
  • Inquirer
  • Posted

    aNj: I don't get it; I already use that command to check if a scene is running...

    • 0
    Posted

    Hi @doezel ,

     

    I suggest that you add some data parsing to the returned json table and check what you get so can avoid scene to stop on error because returned data is not what code is expecting.

    Here is example of parse function that checks josn table returned from Netatmo servers. Check is done up to third level of table (data.body.devices):

    Please login or register to see this code.

    data in above example is variable that contains response from Netatmo server. Above function originally was recommended by @petergebruers

     

    Here is a simple one that just checks response if it is expected json table:

    Please login or register to see this code.

    In above example response contains received data, ok is true if received data is json string otherwise is false, and msg contains error message if there was error during decoding of response.

     

    Still to be sure that some important scene is running or VD main loop is running you can use Watchdog scene written by Lazer from French Fibaro forum: 

    Please login or register to see this link.

     

     

    • 0
  • Inquirer
  • Posted

    @Sankotronic

     

    Good idea! but I don't use any json tables here!? :-)

    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...