Aller au contenu

Xylo

Membres confirmés
  • Compteur de contenus

    9
  • Inscription

  • Dernière visite

Réputation sur la communauté

0 Neutral

À propos de Xylo

  • Rang
    Nouveau

Profile Information

  • Box
    Home Center 2
  • Version
    4
  1. Xylo

    Editeur Lua

    Sur le papier, ca se veut prometteur! :-)
  2. Xylo

    Editeur Lua

    Merci pour ta réponse. Personnellement, j'ai découvert avec plaisir que Notepad++ gérait aussi le LUA( pas d'auto complétion en revanche) et surtout pas de test non plus :-( Juste au moins pouvoir avoir une idée des variables utilisées et surtout a quel moment elles varient, cela serait un grand plus! :-)
  3. Xylo

    Editeur Lua

    Bonjour a tous, J'ai une petite question: En dehors du HC2 Toolkit, existe t'il un éditeur LUA qui permettrait de tester un script pas a pas? (peut être que hc2toolkit le fait d'ailleurs mas je n'ai pas trouver comment! :-) ) Merci pour vos réponses
  4. Xylo

    Petite Question D'assistance Lua

    @Lazer, je suis plus que d'accord avec toi! :-) il résulte de ce code une latence certaine. Comme je le disais, ce n'est qu'une adaptation d'un code repris. Je l'ai "posé" ainsi pour dans un premier temps comprendre le mode de fonctionnement de la box. Sachant que je souhaite par la suite gérer des variables comme la période de l'année (les saisons), mes capteurs de température intérieur, un capteur de température extérieure, tout cela indexé sur google calendar.... autant dire que je n'en suis qu'au début de la tache! :-) Par chance, j'ai un développeur a mon taf qui songe a s'équiper d'une box, je vais lui soumettre l'idée! :-P GEA peut être un bon commencement a mon projet.
  5. Xylo

    Petite Question D'assistance Lua

    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
  6. Xylo

    Petite Question D'assistance Lua

    en effet, j'ai mis le code dans le mainloop de chaque module virtuel. ca correspond donc a un fonctionnement "normal" en correspondance avec la manière dont le code est implanté. je débute sur HC2 et LUA et je pense que mon code (enfin celui que j'ai adapté) est trop simpliste et surtout pas optimisé il existe donc une mainloop générale a la HC2 et pas seulement a chaque module virtuelle/scène? J'avoue que j'ai du mal a piger la logique de fonctionnement de la box. les modules virtuels (enfin leur mainloop) sont comme des programmes qui fonctionnent en permanence?
  7. Bonjour, Je me suis inspiré d'un code LUA permettant de gérer des radiateurs comprenant un mode AUto/ manuel et gérant les 4 ordres du fil pilote. Il n'y a pas de scenes mais que des modules virtuels Cela semble fonctionner correctement car mes radiateurs se declenche bien en fonction de la programmation mais une chose m'interpelle et je me demande si c'est bien normal. Il semble qu'un ordre est envoyé toutes 2/3 secondes a mes FGS221 car je vois dans la console de la HC2 :"transfert ok" sur tout mes FGS! Est ce normal? Merci pour vos avis
  8. Bonsoir, je suis un nouveau possesseur de la petite HC2 et j'avoue me poser pas mal de question quand a sa programmation (quelle soit par bloc ou par LUA). le genre de question comme: les scripts tournent ils en permanence en fond de tache ou sont ils a déclencher " a la main"? il y a t'il des conflits possible entre les scripts? j'ai lu qu'un même scripts pouvait être lancer plusieurs fois et avoir plusieurs occurrences simultanément et dans ce cas, existe t'il un "gestionnaire de taches"? Et si oui, ou le trouver? et si non, comment lister et arrêter ces occurrences!? Voila, tout un tas de petites notions qui me manquent pour piger la logique de cette boiboite! :-)
  9. Je me présente, Xylo pour les intimes, nouveau venu dans le monde de la domotique et complétement débutant! :-) Mais je compte bien exploiter ma petite HC2 au maximum! Edit pour correction de fautes qui me piquait les yeux! :-P
×