I have a variable called "AnyOneAtHome" and it has two possible values of YES or NO.
I have a scene called "TurnOnBathroomRad" and the code for this is displayed below.
Basically at 06:30 everyday it turns on the Rad if the "AnyOneAtHome" variable == YES.
It's been working perfectly until I added a scene (now locations services are working on iOS) to change the state of the "AnyOneAtHome" variable to YES when I come within 100m of home.
Now the "TurnOnBathroomRad" see this as a trigger and turns on the Rad whatever the time of day.
I thought with the AND both would have to be true and I want the time to be a trigger not the "AnyOneAtHome" variable changing/being set to YES.
Confused, any help much appreciated
Andrew
--[[ %% autostart %% properties %% globals AnyOneAtHome --]]
local sourceTrigger = fibaro:getSourceTrigger(); function tempFunc() local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if ( ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "06:30") ) and ( fibaro:getGlobalValue("AnyOneAtHome") == "Yes" ) ) then fibaro:call(27, "turnOn"); end
end