scena_1
--[[
%% autostart
%% properties
%% weather
%% events
%% globals
licznik
--]]
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "13:03") and tonumber(fibaro:getGlobalValue("licznik")) == tonumber("1") )
)
then
fibaro:setGlobal("licznik", "0");
end
setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and tonumber(fibaro:getGlobalValue("licznik")) == tonumber("1") )
or
startSource["type"] == "other"
)
then
fibaro:setGlobal("licznik", "0");
end
end
scena_2
--[[
%% autostart
%% properties
62 value
%% weather
%% events
%% globals
licznik
--]]
local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "13", "05")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "14", "14"))) and (math.floor(os.time()/60)-math.floor(1524654300/60))%0 == 0 and tonumber(fibaro:getValue(62, "value")) > 0 and tonumber(fibaro:getGlobalValue("licznik")) == tonumber("0") )
)
then
fibaro:call(4, "setValue2", "50");
fibaro:setGlobal("licznik", "1");
end
setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "13", "05")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "14", "14"))) and tonumber(fibaro:getValue(62, "value")) > 0 and tonumber(fibaro:getGlobalValue("licznik")) == tonumber("0") )
or
startSource["type"] == "other"
)
then
fibaro:call(4, "setValue2", "50");
fibaro:setGlobal("licznik", "1");
end
end