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

Short question: Required number of instances


jodohl

Question

Could someone expand my horizon on the following?

 

I have simple HC2 Block Scene:

TRIGGER: The time of day is 10:00 am AND a global variable has the value "Away".

THEN: A second scene called "Leave" is run.

 

(I use this to turn off lights that are automatically switched on in the morning also when the whole family is absent for several days.)

 

Why does this scene apparently require 2 socalled "running instances"? I thought this was a piece of code simply running a loop checking the time of day and the variable value?

 

Edited by jodohl
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Logical deduction. I did initially set the max number of instances to 1 and spent quite some time trying to figure out why the scene did not trigger as expected at the set point in time. I then noticed an error Message in the HC2 log saying the max number of instances was exceeded.

     

    Changed the max number of instances to 2, which solved the problem. But it would be nice to understand why :-)

    Link to comment
    Share on other sites

    • 0

    Ah ok :) well, personally never noticed that.. no clue as well what the reason would be.. but I trust someone else in this forum will have!

     

    NB I trust your scene does not include waiting cycles etc? (I.e. one instance does run unnoticed)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Well, the "Run scene" setting is set to "Automatic". Hence the blue status line always states "Running instances: 1". So I guess my confusion is down to my limited understanding of what a "running instance" really is. The code will obsiously check the two conditions with some regular frequency (loops through "check A, check B"). When both A and B are True, then my thinking was that code just progresses to execute the THEN statement. But the explanation must then be that the loop continues as Instance 1 while the THEN execution continues simultaneouly as the second instance.  Would appreciate to be corrected :-) if this is totally wrong.

     

    Link to comment
    Share on other sites

    • 0

    We indeed might have figured it out :) I am not sure about LUA, but in most other programming languages I know, the command code only continues when it receives a return from an iniated function (that would be a scene in this case). 

     

    It would be great indeed if someone can confirm.

    Link to comment
    Share on other sites

    • 0

    Hello Jodol,

     

    i had the same issue, and notice quite similar explanations as you did. On the scene set as automatic the 1st instance keeps looping to check when it should start; therefore, we need to set the minimum instances to 2 if you want to run it from the system of app.

     

    On the manual scenes, no loop to look for a certain time, you can leave them as 1.

     

    I also found that you can kill all the Instances in the LUA code: %% killOtherInstances .

     

    I am still trying to figure it out for the motion sensor to activate lights with restricted time frame (only during nights) as 2 instances works but not inmediatelly every time the sensor is breached.

     

    regards,

     

    Andres

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