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

Try to understand how scene are triggered


pixys

Question

Hello

 

I've wrote a little scene in LUA, and I still do not figure out how scene are triggered

 

Please login or register to see this code.

 

For the result in the debug windows with this code should loop.

and should look like

 

 

Please login or register to see this code.

 

But the result of the execution is that one

 

Please login or register to see this code.

 

only 1 occurence of the execution.

 

Can someone explains what's triggering the execution of the scene

 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

I found the explaination.

 

How this is working

 

Scene got activated once. If you want to have a reoccurence of the activation you need to create a function and write inside what the part of the code you want to reexecute.

 

and at the end of the function use the fibaro function

 

    setTimeout(nameofmyfunction, 60*1000)   -> 60 is 60 secondes.

 

The code should looks like

 

Please login or register to see this code.

 

 

 

 

 

 

 

 

Edited by pixys
I found the reason
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

yes that is correct :) this will make the scene loop continuously.   Try not to have too many of these in the system thou.  My advice would be to have one scene running in a loop - the main scene , and all the others triggered by variables, devices and so on.

 

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • I've got 7 in total 1 per heating control.

     

    I understand the main loop

     

    Please login or register to see this code.

     

     

    Do you have any sample of a scene trigger by device or variable ?

     

     

    Thanks

    Pixys

    Link to comment
    Share on other sites

    • 0

    Here an example of scene triggered by devices

    Please login or register to see this code.

    Please note:

    I'm using json table for device IDs, but it's actually the ID numbers of the devices. 

    I have changed first two cases to actually ID numbers for your convenience.

     

     

    Here an example for global variables

    Please login or register to see this code.

    I don't use 

    %% autostart 

    It means the HC2 will not execute the scene on startup (e.g. after reboot),but it will be executed only if triggered.

    Although the scene mode  must be set to Automatic

    Please login or register to see this attachment.

     

     

    Edited by cag014
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks , I will have to read it twice to understand all the concept ;)

     

    Link to comment
    Share on other sites

    • 0

    Here is a very simple example for device property trigger

    Please login or register to see this code.

    Hope it more understandable 

    Edited by cag014
    Link to comment
    Share on other sites

    • 0

    The topic has been moved from "

    Please login or register to see this link.

    " to "

    Please login or register to see this link.

    ".

     

    Temat został przeniesiony z "

    Please login or register to see this link.

    " do "

    Please login or register to see this link.

    ".

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