I have a simple Lua script that after no motion (between 2 motion sensors) has been detected for 20 minutes then lights turn off. my script is not working properly the lights keep turning off after a few seconds of the last motion sensor becoming safe. Can someone see what I have done wrong in the script. Thanks!
--[[
%% autostart
%% properties
51 value
86 value
%% weather
%% events
%% globals
Day_night
--]]
local startSource = fibaro:getSourceTrigger();
if (
( fibaro:getGlobalValue("Day_night") == "Day")
and ( tonumber(fibaro:getValue(51, "value")) == 0 and tonumber(fibaro:getValue(86, "value")) == 0 )
or
startSource["type"] == "other"
)
then
Question
amatt 5
I have a simple Lua script that after no motion (between 2 motion sensors) has been detected for 20 minutes then lights turn off. my script is not working properly the lights keep turning off after a few seconds of the last motion sensor becoming safe. Can someone see what I have done wrong in the script. Thanks!
--[[
%% autostart
%% properties
51 value
86 value
%% weather
%% events
%% globals
Day_night
--]]
local startSource = fibaro:getSourceTrigger();
if (
( fibaro:getGlobalValue("Day_night") == "Day")
and ( tonumber(fibaro:getValue(51, "value")) == 0 and tonumber(fibaro:getValue(86, "value")) == 0 )
or
startSource["type"] == "other"
)
then
setTimeout(function()
fibaro:call(76, "turnOff");
fibaro:call(78, "turnOff");
end, 1200)
end
Link to post
Share on other sites
23 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.