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

Question
AutoFrank 372
Hi,
I was tidying up my light scenes where I turn on of off batches of lights (at night, going away, etc) and I wanted something simpler and more reliable.
I created a very simple scene that stores the light ID's (or HomeTable references, as I have) in a table and you pass the action (turnOn or tunrOff) in the startScene call so no need to use a global variable
The scene code is not really mean to be a solution like Smart message Hub but more of a case of sharing what I put together.
It a small amount of error handling and warnings should ID's be incorrect and should be easy enough to pick through as a learningexercise
The scene call is simple
Please login or register to see this code.
I included just two options
deBug : set to true to see lights as they are checked
delay : this will set a sleep or delay between each light if you find that switching them off too fast is causing some to be missed
Comment out the reference to HomeTable (line 10) is you don't use this method
Scene Code is below
Please login or register to see this code.
PS - This approach could easily be expanded to store a number of groups (table) of lights in the the scene and pass 2 parameters in the startScene call, one parameter could be used to decide which group of lights and the second could be used to selection the action (turnOn, turnOn)
Enjoy - Happy Coding
-f
15 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.