I have a scene to turn on the lights when my alarm (Vista 20p) is disarmed and it works like a charm. But I don’t want the lights to turn on anytime before 7pm.
How can I achieve this?
I have a scene to turn on the lights when my alarm (Vista 20p) is disarmed and it works like a charm. But I don’t want the lights to turn on anytime before 7pm.
How can I achieve this?
Add this code in that scene:
local t = os.date ("*t")
if (t.hour <= 19) then
return false
end
return true
The scene won’t run if the code returns false, which in this case it happens only if the hour is less than 19. But I think that this code would be more appropriate for what you want:
return luup.is_night()
In this case the scene would run only at night.
Awesome. Where can I find useful code snippets like this?
Also, what time does luup.is_night() define as “night?”
Best Home Automation shopping experience. Shop at Ezlo!
© 2022 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules