Si tu veux complètement abandonner tes 2 autres scénarios, il faut que celui-ci tourne en boucle toutes les 5 minutes et pour ceci, il faut l'inclure dans une boucle sans fin.
Attention a rajouter le %% autostart au début. Pour que la HC2 démarre ton scénario automatiquement au démarrage.
--[[
%% autostart
%% properties
%% globals
--]]
while (true) do
local sunriseHour = fibaro:getValue(1,'sunriseHour')
local sunsetHour = fibaro:getValue(1,'sunsetHour')
local currentHour = os.date("*t")
local sunrise = tonumber(string.sub (sunriseHour, 1 , 2) ) * 60 + tonumber(string.sub(sunriseHour, 4) )
local sunset = tonumber(string.sub (sunsetHour, 1 , 2) ) * 60 + tonumber(string.sub(sunsetHour, 4) )
local now = currentHour.hour * 60 + currentHour.min;
fibaro:debug("Sunrise : " .. sunrise)
fibaro:debug("Sunset : "..sunset)
fibaro:debug("Maintenant : " ..now)
if ( (now >= sunrise) and (now <= sunset)) then
fibaro:debug("Il fait jour");
fibaro:setGlobal("JOUR", "1");
fibaro:call(81, "setProperty", "ui.label10.value", "JOUR");
else
fibaro:debug("Il fait nuit");
fibaro:setGlobal("JOUR", "0");
fibaro:call(81, "setProperty", "ui.label10.value", "NUIT");
end
--temporisation de 5 minutes
fibaro:sleep(300000);
end