Med lite LUA kan man fixa det enkelt
Nedan sätter jag variabel och tänder 30min före solndnedång
Code: Select all
--[[
%% autostart
%% properties
%% globals
--]]
local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do
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 os.date("%H:%M", os.time()+30*60) == fibaro:getValue(1, "sunsetHour")) )
)
then
fibaro:setGlobal("Solnedgång", "1");
fibaro:setGlobal("Soluppgång", "0");
fibaro:call(26, "turnOn");
fibaro:call(27, "turnOn");
fibaro:call(17, "turnOn");
end
fibaro:sleep(60*1000);
end
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
startSource["type"] == "other"
)
then
fibaro:setGlobal("Solnedgång", "1");
fibaro:setGlobal("Soluppgång", "0");
fibaro:call(26, "turnOn");
fibaro:call(27, "turnOn");
fibaro:call(17, "turnOn");
end
end
Nedan sätter jag variabel och släcker 30min efter soluppgång
Code: Select all
--[[
%% autostart
%% properties
%% globals
--]]
local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do
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 os.date("%H:%M", os.time()-30*60) == fibaro:getValue(1, "sunriseHour")) )
)
then
fibaro:setGlobal("Solnedgång", "0");
fibaro:setGlobal("Soluppgång", "1");
fibaro:call(26, "turnOff");
fibaro:call(27, "turnOff");
fibaro:call(17, "turnOff");
end
fibaro:sleep(60*1000);
end
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
startSource["type"] == "other"
)
then
fibaro:setGlobal("Solnedgång", "0");
fibaro:setGlobal("Soluppgång", "1");
fibaro:call(26, "turnOff");
fibaro:call(27, "turnOff");
fibaro:call(17, "turnOff");
end
end