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
k2aab 1
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
3 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.