--[[
%% autostart
%% properties
%% globals
--]]
local pocet_zarizeni = 300
function wakeupDeadNodes()
fibaro:debug('Probuzení nečinných uzlů.')
-- Check all devices
for i = 1, pocet_zarizeni do
local status = fibaro:getValue(i, 'dead');
if status >= "1" then
fibaro:debug(i..': nečinný');
fibaro:wakeUpDeadDevice(i)
fibaro:sleep(5000) --za 5 sekund nová kontrola uzlu i
status = fibaro:getValue(i, 'dead');
if status >= "1" then
fibaro:debug(i..': Mrtvý uzel, nutná kontrola')
else
fibaro:debug(i..': Uzel probuzený')
end
end
end
end
local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do
fibaro:debug('Scene automatically called.')
local currentDate = os.date("*t");
-- Probouzen uzlů od Pondělí do Soboty od 10 hod do 11 hod
if ((currentDate.wday >= 2 and currentDate.wday <= 7) and (currentDate.hour >= 10 and currentDate.hour <= 11 ))
then
fibaro:debug('Uzly automaticky probuzeny.')
wakeupDeadNodes()
end
fibaro:sleep(30*60000); -- Znovu za 30 minut
end
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (startSource["type"] == "other")
then
wakeupDeadNodes()
end
end