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

Performing scene to end


sega66

Question

Hi!
I have a scene on LUA that is triggered when a global variable is changed. In the scene, several devices are turned on sequentially at certain intervals. But when the global variable is changed during the execution of the scene, it stops and restarts. I need the price to reach the end even if the global variable has changed during the execution of the scene. Please help me.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

You could add a second global variable called "pause trigger". Set this variable to 1 at the start of your scene, and set it back to 0 as the last item in the scene.  Then, at the very start of the scene, check to see if "pause trigger" is 1, and if so, exit the scene without doing anything. 

 

I can't see which controller you have, but on HC2 changing a global variable should launch a new scene instance rather than stopping the current scene (I think??).  If the above doesn't work, then you might need to think about how you trigger the scene. You might need another scene that contains the logic to set your triggering global variable.

 

 

Link to comment
Share on other sites

  • 0

Hi @sega66 ,

 

Actually, to run scene on global variable change and disable that first instance is reset and another instance started if global variable value change when scene already runs add this line at the beginning of scene:

Please login or register to see this code.

 

If you added, then remove this scene header option:

Please login or register to see this code.

 

To be sure that proper action will be executed by the scene depending on value of the triggering global variable you need to add checking as in this example:

Please login or register to see this code.

 

You can also use more than one global variable as trigger, but then you need additional code to check which global variable triggered scene like this:

Please login or register to see this code.

 

Hope this helps! Enjoy coding :-)

 

  • Like 1
Link to comment
Share on other sites

  • 0

You can also just change this setting:

Please login or register to see this image.

/monthly_2024_02/image.png.ee98abd4f41d1952493822064b792827.png" />

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