Bonjour,
Je partage un petit script qui permet de fixer la valeur d'un dimmer à 60%, toutes les 4 heures, sauf si en utilisation.
Le script fonctionne très bien depuis des mois.
Je suis loin d'être un développeur, donc s'il y a des suggestions d'amélioration, n'hésitez pas
Créer une scène et y mettre ce code:
--[[
%% autostart
%% properties
%% globals
--]]
-- si lampe SAM eteinte, set dimmer a 60% toutes les 4 heures entre 0h01 et 23h59
local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "00", "01")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "23", "59"))) and (math.floor(os.time()/60)-math.floor(1391295660/60))%240 == 0 )
and
( tonumber(fibaro:getValue(54, "value")) == 0 )
)
then
fibaro:call(54, 'setValue', 60);
fibaro:call(54, 'turnOff');
end
fibaro:sleep(60*1000);
end
else
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "00", "01")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "23", "59"))) )
and
( tonumber(fibaro:getValue(54, "value")) == 0 )
or
startSource["type"] == "other"
)
then
fibaro:call(54, 'setValue', 60);
fibaro:call(54, 'turnOff');
end
end