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
Dman568 2
Hi All
I have the following code that that turns on my front door light when it is open and turns it off 5 minutes after it closes, this meets my needs most of the time but if some one leaves the house and wants the light on for their return it has turned off. What I want to do is abort the turn off if my global variable for occupy count changes. I was thinking i could take a count from the global variable run the scene then check 5 minutes later and if it has changed keep the light on or turn it back on. Anyone have any thoughts or sample code?
if (fibaro:countScenes()>1) then fibaro:abort(); end
if ( fibaro:getGlobalValue("TimeOfDay") == "Evening" )
and
( tonumber(fibaro:getValue(280, "value")) > 0 )
then
fibaro:call(291, "turnOn");
end
if ( fibaro:getGlobalValue("TimeOfDay") == "Evening" )
and
( tonumber(fibaro:getValue(280, "value")) == 0 )
then
setTimeout(function()
fibaro:call(291, "turnOff");
end, 5*60*1000)
end
6 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.