LUA best practice advice

Just wondering about best practice when LUA coding. Is it better to ping a device and get it’s status before sending a switching instruction. For example if a switch is ON and some code regular switches it, is it better to check the status and if ON don’t bother to send the turn on switch instruction.

What’s more efficient/better use of the Vera units resources?

That would be unnecessary unless you need the status as part of a condition. If you plan to turn on/off a switch, you do not need to check its state first.

However, if you have 2 switches (s1 and s2) and you want to turn on (s1) if (s2) is turned on, then you would check the state of s2 before turning on s1.

Tom

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules