en construction

hansolo.lua
--[[
%% autostart
%% properties
14 value
19 value
20 value
41 value
86 value
104 value
%% globals
--]]
 
	local id = {
		WallPlugCuisine		= 29, 
		PorteCellier		= 14,
		PlacardChb1			= 19,
		PlacardChb2			= 20,
		MvtEscalier			= 41,
		MvtEscalier2		= 104,
		MvtChb				= 86,
		ScnVMC				= 17,
		ScnVoletsSalon		= 15,
		LampeCellier		= 15,
		LampeEsca1			= 35,
		LampeEsca2			= 38,
		LampePlacardChb		= 18,
		RGBChb				= 65,
		CapteurLumino		= 89,
		VoletSDJ			= 52,
		VoletChbLucas		= 53,
		VoletBasPFSud		= 23,
		VoletBasPFNord		= 25,
		VoletBasFenSud		= 24,
		VoletBasBaieVitree	= 13,
		VoletChbParent		= 51,
		VD_GRAPHEccoDevice 	= 91,
		VD_JourChome		= 90,
		WP_Chauf_Douche		= 108
	}
 
	--Mes commandes
	--Ouverture bouche cuisine si hotte allumée
	local BoucheCO2 = GEA.add({"Sensor+", id["WallPlugCuisine"], 80}, 30, "",{{"Scenario",id["ScnVMC"]},{"MaxTime", 1}}) --On exécute 1 fois
	GEA.add(true, 25*60, "", {{"RestartTask", BoucheCO2 }})	--OIn relance au bout de 25mn, la bouche s'ouvre 30mn
 
	--Ouverture bouche cuisine si CO2 > 800
	GEA.add({"Global+","NetCO2Int", 800}, 10*60, "", {{"Scenario",id["ScnVMC"]},{"Repeat"}})
 
	--Gestion lumière cellier
	--Allumer lumière cellier si porte ouverte
	GEA.add(id["PorteCellier"], -1, "", {{"turnOn",id["LampeCellier"]}})
	--Eteindre lumière cellier si porte fermée
	GEA.add(id["PorteCellier"], -1, "", {{"Inverse"},{"turnOff",id["LampeCellier"]}})
 
	--Gestion lumière placard chb bas
	--Si un des capteurs d'ouverture est on j'allume 18
	GEA.add(id["PlacardChb1"], -1, "" ,{{"turnOn", id["LampePlacardChb"]}})
	GEA.add(id["PlacardChb2"], -1, "" ,{{"turnOn", id["LampePlacardChb"]}})
	--Condition pour éteindre la lumière du placard, les deux détecteurs à Off
	GEA.add(id["PlacardChb1"], -1, "", {{"Inverse"},{"If",{{"Value-",id["PlacardChb2"],1}}},{"turnOff",id["LampePlacardChb"]}})
	GEA.add(id["PlacardChb2"], -1, "", {{"Inverse"},{"If",{{"Value-",id["PlacardChb1"],1}}},{"turnOff",id["LampePlacardChb"]}})
 
	--Gestion lumière escalier
	--Lumière escalier, ON si détecteur ON, éteindre après 2mn
	GEA.add(id["MvtEscalier2"], -1, "", {{"turnOn",id["LampeEsca1"]},{"turnOn",id["LampeEsca2"]}})	
	GEA.add(id["MvtEscalier"], -1, "", {{"turnOn",id["LampeEsca1"]},{"turnOn",id["LampeEsca2"]}})
	--GEA.add(id["MvtEscalier2"], -1, "", {{"turnOn",id["LampeEsca1"]},{"turnOn",id["LampeEsca2"]}})
 
	--Extinction 2 mn aprés
	local LampeEsc = GEA.add(id["LampeEsca1"], 120, "", {{"turnOff",id["LampeEsca1"]},{"turnOff",id["LampeEsca2"]},{"Repeat"}})
	GEA.add(id["MvtEscalier"], -1, "", {{"RestartTask", LampeEsc}})
	GEA.add(id["MvtEscalier2"], -1, "", {{"RestartTask", LampeEsc}})
 
	--Gestion ruban led sous le lit
	--Ruban LED sous le lit
	GEA.add(id["MvtChb"], -1, "", {{"Time", "06:00", "00:00"}, {"RGB", id["RGBChb"], 255, 0, 195, 100}})
	GEA.add(id["MvtChb"], -1, "", {{"Time", "00:00", "06:00"}, {"RGB", id["RGBChb"], 0, 78, 255, 80}})
	local LedLit = GEA.add(id["RGBChb"], 120, "", {{"turnOff",id["RGBChb"]},{"Repeat"}})
	GEA.add(id["MvtChb"], -1, "", {{"RestartTask", LedLit}})
 
	--Ouverture des volets du salon
	local estChome = {"If", {{"Global", "JourChome", "OUI"}}}
	local estTravail = {"If", {{"Global", "JourChome", "NON"}}}
	GEA.add(true, 1*60, "Ouverture volets salon",{{"Open",id["VoletBasPFSud"],100},{"Open",id["VoletBasPFNord"],100},{"Open",id["VoletBasFenSud"],100},{"Open",id["VoletBasBaieVitree"],100},{"Time","Sunrise-20","Sunrise-15"}})
	--Ouverture des volets des chambres semaine
GEA.add(true, 1*60, "",{estTravail, {"Time", "07:24", "07:29"}, {"Open",id["VoletSDJ"],50},{"Open",id["VoletChbLucas"],50},{"Open",id["VoletChbParent"],50}})
GEA.add(true, 1*60, "",{estTravail, {"Time", "07:29", "07:35"}, {"Open",id["VoletSDJ"],50},{"Open",id["VoletChbLucas"],100},{"Open",id["VoletChbParent"],100}})
	--Ouverture des volets des chambres WE et jours fériés
	GEA.add(true, 1*60, "",{estChome, {"Time", "08:54", "08:59"}, {"Open",id["VoletSDJ"],50},{"Open",id["VoletChbLucas"],50},{"Open",id["VoletChbParent"],50}})
	GEA.add(true, 1*60, "",{estChome, {"Time", "08:00", "08:05"}, {"Open",id["VoletSDJ"],100},{"Open",id["VoletChbLucas"],100},{"Open",id["VoletChbParent"],100}})
 
	--Fermeture des volets des chambres
	GEA.add(true, 1*60, "", {{"Time", "Sunset", "Sunset+5"}, {"Close",id["VoletSDJ"],100},{"Close",id["VoletChbLucas"],100},{"Close",id["VoletChbParent"],100}})
	--Fermeture des volets du salon
	GEA.add(true, 1*60, "Fermeture volets salon", {{"Time", "Sunset+120", "Sunset+125"}, {"Scenario",id["ScnVoletsSalon"]}})
 
	--Gestion volets pour la chaleur
	--Volets haut si soleil en été
	GEA.add({"Value+",id["CapteurLumino"], 1800}, 10*60, "",{{"Time","11:50","19:00"},{"Dates","01/05","01/10"},{"Close",id["VoletSDJ"],50},{"Close",id["VoletChbLucas"],50},{"Close",id["VoletBasPFSud"],50},{"Close",id["VoletChbParent"],50}})
	GEA.add({"Value-",id["CapteurLumino"], 1550}, 20*60, "",{{"Time","11:50","19:00"},{"Dates","01/05","01/10"},{"Open",id["VoletSDJ"],100},{"Open",id["VoletChbLucas"],100},{"Open",id["VoletBasPFSud"],100},{"Open",id["VoletChbParent"],100}})
	GEA.add(id["VoletSDJ"], 60, "", {{"If",{{"Value+",id["VoletSDJ"],49},{"Value-",id["VoletSDJ"],51}}},{"Time","19:00","19:10"},{"Dates","01/05","01/10"},{"Open",id["VoletSDJ"],100}})  
	GEA.add(id["VoletChbLucas"], 60, "", {{"If",{{"Value+",id["VoletChbLucas"],49},{"Value-",id["VoletChbLucas"],51}}},{"Time","19:00","19:10"},{"Dates","01/05","01/10"},{"Open",id["VoletChbLucas"],100}})
	GEA.add(id["VoletBasPFSud"], 60, "", {{"If",{{"Value+",id["VoletBasPFSud"],49},{"Value-",id["VoletBasPFSud"],51}}},{"Time","19:00","19:10"},{"Dates","01/05","01/10"},{"Open",id["VoletBasPFSud"],100}})
	GEA.add(id["VoletChbParent"], 60, "", {{"If",{{"Value+",id["VoletChbParent"],49},{"Value-",id["VoletChbParent"],51}}},{"Time","19:00","19:10"},{"Dates","01/05","01/10"},{"Open",id["VoletChbParent"],100}})
 
	--Arrêt chauffage d'appoint salle de douche
	GEA.add(id["WP_Chauf_Douche"], 30*60, "", {{"turnOff",id[WP_Chauf_Douche]},{"Repeat"}})
 
	--Maj des datas EccoDevice 
	GEA.add(true, 2*60, "",{{"VirtualDevice", id["VD_GRAPHEccoDevice"], "2"},{"Repeat"}})
 
	--MAJ JourChome
	GEA.add(true, 1*60, "", {{"VirtualDevice", id["VD_JourChome"], "3"},{"Time", "00:05", "00:10"}})
 
	--Section dead node
	GEA.add({"Dead",35},5*60,"",{{"WakeUp",35}}) --lum escalier
	GEA.add({"Dead",38},5*60,"",{{"WakeUp",38}}) --lum palier
	GEA.add({"Dead",26},5*60,"",{{"WakeUp",26}}) --Cmd bouche
	GEA.add({"Dead",27},5*60,"",{{"WakeUp",27}}) --cmd bouche
	GEA.add({"Dead",65},5*60,"",{{"WakeUp",65}}) --RGBW chanmbre
	GEA.add({"Dead",15},5*60,"",{{"WakeUp",15}}) --Lum cellier
	GEA.add({"Dead",89},5*60,"",{{"WakeUp",89}}) --Capteur luminosité
	GEA.add({"Dead",46},5*60,"",{{"WakeUp",46}}) --Lumières chb Lucas
	GEA.add({"Dead",53},5*60,"",{{"WakeUp",53}}) --Volet chb Lucas
	GEA.add({"Dead",25},5*60,"",{{"WakeUp",25}}) --Volet PF nord
	GEA.add({"Dead",23},5*60,"",{{"WakeUp",23}}) --Volet PF sud
	--Fin de mes commandes