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'm new to Lua and I have read what I could find within the forum discussions. I'm trying to master the basics before I move on and wanted to check from one of the experts that my simple scene is structured as it should be.
I have a HC2 and am running the latest FW 4.070
My scene below sets a global variable 'TOD_LightMode' to night, dusk or day depending on the light level from an outside sensor. It runs the scene and then sleeps for 15 mins and repeats. It seems to work okay and I have checked the global variable is available to other scenes and I have used it to trigger other activity.
The few questions I have and hopefully somebody can provide advice...
1) do I have all the variables declared correctly ? (I have seen some included in the header in some examples but am not sure what to include there)
2) Is my autostart code correct ?
3) I have a lot of scenes in mind that would be "waiting" scenes. Many people use the while true do or while (someglobalvariable == "somevalue") method. Is there a limitation as to how many of these types of scenes can be running at the same time before it starts to use all the CPU/mem resources ?
4) Is there a simple error checking or logging method that I could/should be using with my scripts.
5) Any other suggestions that would be better practice or make my code more efficient
Any help or suggestions very welcome ?
Thanks
-F
Code as follows...
Please login or register to see this code.
9 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.