--[[
%% autostart
%% properties
%% events
%% globals
Present_Tophe
3 Temperature
3 Humidity
3 WeatherConditionConverted
--]]
local maintenant = os.date("%H:%M", os.time())
local heuremini, heuremaxi = "10:46", "11:55"
-------
local Humidity = tonumber(fibaro:getValue(3, "Humidity"))
local OutsideTemperature = tonumber(fibaro:getValue(3, "Temperature"))
local WeatherCondition = fibaro:getValue(3, "WeatherConditionConverted")
-----------
local presencetophe = tonumber(fibaro:getGlobalValue("Present_Tophe")) > 0
fibaro:debug("OutsideTemperature : " .. OutsideTemperature);
fibaro:debug("Humidity : " .. Humidity);
fibaro:debug("WeatherCondition : " .. WeatherCondition);
fibaro:debug("Maintenant : " ..maintenant.. " - Heure mini : " .. heuremini .. " - Heure maxi : " ..heuremaxi)
fibaro:debug( "Présence Tophe : " ..(fibaro:getGlobalValue("Present_Tophe")))
if maintenant > heuremini and maintenant < heuremaxi and presencetophe then
if (OutsideTemperature <= 20) then
fibaro:call(236, "setColor", "0", "255", "0", "0") -- vert
else
fibaro:debug("jaune");
fibaro:call(236, "setColor", "255", "255", "0", "0") -- jaune
fibaro:sleep(5*1000)
end
if(Humidity >= 50) then
fibaro:debug("rouge");
fibaro:call(236, "setColor", "255", "0", "0", "0") -- rouge
fibaro:sleep(5*1000)
end
if(Humidity >= 50 and OutsideTemperature < 20) then
fibaro:debug("blanc");
fibaro:call(236, "setColor", "255", "255", "255", "0") -- blanc
fibaro:sleep(5*1000)
end
if (WeatherCondition == "rain") then
fibaro:debug("bleu");
fibaro:call(236, "setColor", "0", "0", "255", "0") -- bleu
fibaro:sleep(5*1000)
end
else
fibaro:debug("Scène non lancée, en dehors des heures 10:46 - 11:55")
end