oui justement, je lorgne sur GEA en ce moment. J'essaye de comprendre comment il fonctionne.
Pour le code que j'utilise, voici ce qui se trouve dans la mainloop d'un module qui sert de thermostat pour une zone donnée avec la gestion d'un programme1 et d'un programme2 (en gros prog1 = semaine et prog2= weekend)
--[[
%% properties
%% globals
--]]
-- LUA - heat Engine V2.0.0
--
--
--variables globales à déclarer: zbas_heat_engine = Auto, Prog1, Prog2, Confort, Eco, Hors-gel, Arret.
--variables globales à déclarer: zbas_heat_mode = Confort, Eco, Hors-gel, Arret.
-------------------------------------------------------------------------------------------------------------
-- USER SETTINGS : --
-------------------------------------------------------------------------------------------------------------
---------------------
-- Paramètres généraux:
---------------------
local debug = true; --activer le mode debug
local ID_virtual_module = "38";
-----------------------------------
-- Definir les différents programmes:
-----------------------------------
local zbas_time_1 = "06:00";
local zbas_heat_mode_1_2_prog1 = "Confort";
local zbas_heat_mode_1_2_prog2 = "Eco";
local zbas_time_2 = "07:30";
local zbas_heat_mode_2_3_prog1 = "Eco";
local zbas_heat_mode_2_3_prog2 = "Confort";
local zbas_time_3 = "14:00";
local zbas_heat_mode_3_4_prog1 = "Eco";
local zbas_heat_mode_3_4_prog2 = "Confort";
local zbas_time_4 = "18:00";
local zbas_heat_mode_4_5_prog1 = "Confort";
local zbas_heat_mode_4_5_prog2 = "Confort";
local zbas_time_5 = "22:00";
local zbas_heat_mode_5_6_prog1 = "Eco";
local zbas_heat_mode_5_6_prog2 = "Confort";
local zbas_time_6 = "23:59";
local zbas_heat_mode_6_1_prog1 = "Eco";
local zbas_heat_mode_6_1_prog2 = "Eco";
-----------------------------------------------------------------------------------------
--Définition du programme automatique de la semaine: un mode au choix pour chaque jour (Prog1, Prog2, Confort, Eco, Hors-gel, Arret):
-----------------------------------------------------------------------------------------
local zbas_Monday_auto = "Prog1";
local zbas_Tuesday_auto = "Prog1";
local zbas_Wednesday_auto = "Prog1";
local zbas_Thursday_auto = "Prog1";
local zbas_Friday_auto = "Prog1";
local zbas_Saturday_auto = "Prog2";
local zbas_Sunday_auto = "Prog2";
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- -- DO NOT EDIT THE CODE BELOW (except to suit your needs) -- --
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
heatEngine = {
version = "1.0.0"
};
local zbas_heat_engine = fibaro:getGlobal("zbas_heat_engine");
local minute = 60000 --in milliseconds
local currentDate = os.date("*t");
local currentTime = string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min);
local zbas_heat_mode = fibaro:getGlobal("zbas_heat_mode");
--wday=1 is Sunday
--wday=2 is Monday
--wday=3 is Tuesday
--wday=4 is Wednesday
--wday=5 is Thursday
--wday=6 is Friday
--wday=7 is Saturday
if (zbas_heat_engine == "Confort") then
zbas_heat_mode= "Confort";
end
if (zbas_heat_engine == "Eco") then
zbas_heat_mode= "Eco";
end
if (zbas_heat_engine == "Hors-gel") then
zbas_heat_mode= "Hors-gel";
end
if (zbas_heat_engine == "Arret") then
zbas_heat_mode= "Arret";
end
if (zbas_heat_engine == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_heat_engine == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
if (zbas_heat_engine == "Auto") then
if (currentDate.wday == 1 ) then
if zbas_Sunday_auto == "Confort" or zbas_Sunday_auto == "Eco" or zbas_Sunday_auto == "Hors-gel" or zbas_Sunday_auto == "Arret" then
zbas_heat_mode = zbas_Sunday_auto;
end
if (zbas_Sunday_auto == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_Sunday_auto == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
end
if (currentDate.wday == 2 ) then
if zbas_Monday_auto == "Confort" or zbas_Monday_auto == "Eco" or zbas_Monday_auto == "Hors-gel" or zbas_Monday_auto == "Arret" then
zbas_heat_mode = zbas_Monday_auto;
end
if (zbas_Monday_auto == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_Monday_auto == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
end
if (currentDate.wday == 3 ) then
if zbas_Tuesday_auto == "Confort" or zbas_Tuesday_auto == "Eco" or zbas_Tuesday_auto == "Hors-gel" or zbas_Tuesday_auto == "Arret" then
zbas_heat_mode = zbas_Tuesday_auto;
end
if (zbas_Tuesday_auto == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_Tuesday_auto == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
end
if (currentDate.wday == 4 ) then
if zbas_Wednesday_auto == "Confort" or zbas_Wednesday_auto == "Eco" or zbas_Wednesday_auto == "Hors-gel" or zbas_Wednesday_auto == "Arret" then
zbas_heat_mode = zbas_Wednesday_auto;
end
if (zbas_Wednesday_auto == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_Wednesday_auto == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
end
if (currentDate.wday == 5 ) then
if zbas_Thursday_auto == "Confort" or zbas_Thursday_auto == "Eco" or zbas_Thursday_auto == "Hors-gel" or zbas_Thursday_auto == "Arret" then
zbas_heat_mode = zbas_Thursday_auto;
end
if (zbas_Thursday_auto == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_Thursday_auto == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
end
if (currentDate.wday == 6 ) then
if zbas_Friday_auto == "Confort" or zbas_Friday_auto == "Eco" or zbas_Friday_auto == "Hors-gel" or zbas_Friday_auto == "Arret" then
zbas_heat_mode = zbas_Friday_auto;
end
if (zbas_Friday_auto == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_Friday_auto == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
end
if (currentDate.wday == 7 ) then
if zbas_Saturday_auto == "Confort" or zbas_Saturday_auto == "Eco" or zbas_Saturday_auto == "Hors-gel" or zbas_Saturday_auto == "Arret" then
zbas_heat_mode = zbas_Saturday_auto;
end
if (zbas_Saturday_auto == "Prog1") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog1;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog1;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog1;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog1;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog1;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog1;
end
end
end
if (zbas_Saturday_auto == "Prog2") then
if zbas_time_1 <= zbas_time_2 then
if zbas_time_1 <= currentTime and currentTime <= zbas_time_2 then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
else
if not (zbas_time_2 < currentTime and currentTime < zbas_time_1) then
zbas_heat_mode= zbas_heat_mode_1_2_prog2;
end
end
if zbas_time_2 <= zbas_time_3 then
if zbas_time_2 <= currentTime and currentTime <= zbas_time_3 then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
else
if not (zbas_time_3 < currentTime and currentTime < zbas_time_2) then
zbas_heat_mode= zbas_heat_mode_2_3_prog2;
end
end
if zbas_time_3 <= zbas_time_4 then
if zbas_time_3 <= currentTime and currentTime <= zbas_time_4 then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
else
if not (zbas_time_4 < currentTime and currentTime < zbas_time_3) then
zbas_heat_mode= zbas_heat_mode_3_4_prog2;
end
end
if zbas_time_4 <= zbas_time_5 then
if zbas_time_4 <= currentTime and currentTime <= zbas_time_5 then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
else
if not (zbas_time_5 < currentTime and currentTime < zbas_time_4) then
zbas_heat_mode= zbas_heat_mode_4_5_prog2;
end
end
if zbas_time_5 <= zbas_time_6 then
if zbas_time_5 <= currentTime and currentTime <= zbas_time_6 then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
else
if not (zbas_time_6 < currentTime and currentTime < zbas_time_5) then
zbas_heat_mode= zbas_heat_mode_5_6_prog2;
end
end
if zbas_time_6 <= zbas_time_1 then
if zbas_time_6 <= currentTime and currentTime <= zbas_time_1 then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
else
if not (zbas_time_1 < currentTime and currentTime < zbas_time_6) then
zbas_heat_mode= zbas_heat_mode_6_1_prog2;
end
end
end
end
end
fibaro:sleep(1000);
fibaro:setGlobal("zbas_heat_mode", zbas_heat_mode);
if (debug) then
local mode = "init";
if (currentDate.wday == 1 ) then
mode = zbas_Sunday_auto;
end
if (currentDate.wday == 2 ) then
mode = zbas_Monday_auto;
end
if (currentDate.wday == 3 ) then
mode = zbas_Tuesday_auto;
end
if (currentDate.wday == 4 ) then
mode = zbas_Wednesday_auto;
end
if (currentDate.wday == 5 ) then
mode = zbas_Thursday_auto;
end
if (currentDate.wday == 6 ) then
mode = zbas_Friday_auto;
end
if (currentDate.wday == 7 ) then
mode = zbas_Saturday_auto;
end
if (zbas_heat_engine == "Auto") then
fibaro:debug("Le mode du thermostat est réglé sur: " ..zbas_heat_engine.." . Le mode auto est réglé sur "..mode);
end
if (zbas_heat_engine ~= "Auto") then
fibaro:debug("Le mode du thermostat est réglé sur:" ..zbas_heat_engine);
end
fibaro:debug("Le mode de chauffage est: " ..zbas_heat_mode);
fibaro:call(ID_virtual_module, "setProperty", "ui.Label3.value", zbas_heat_mode)
fibaro:sleep(15000)
end