Peter Posté(e) le 17 septembre 2016 Signaler Posté(e) le 17 septembre 2016 (modifié) hello a tous je vous met ma petite config qui vient en grosse parti de vous tous --[[ %% autostart %% properties 290 value 292 value 113 value 332 value 170 value 92 value 425 value %% globals --]] -- Paramétrage de GEA / GEA configuration function config() GEA.isVersionFour = true -- On est en version 4.017 Beta ou supérieure / GEA.language = "FR" -- Votre langue : FR (default) / Your language : EN GEA.checkEvery = 30 -- On vérifie toutes les X secondes (default : 30) / Check every X seconds GEA.portables = {184, 164} -- Liste des portables devant recevoir une notification {70, 71} / Smartphones you want to be notified GEA.debug = false -- Affichage des traces dans la console (default : false) / Show trace in the debug window -- GEA.getGlobalForActivation = {"SuspendreGEA", "non"} -- active ou désactive l'exécution de GEA via une variable globale / active or deactive GEA execution with a global variable -- GEA.catchError = false GEA.optimize = GEA.typeOptimize["IMMEDIATE_ONLY"] -- option : GEA.typeOptimize["NONE"], GEA.typeOptimize["IMMEDIATE_ONLY"], GEA.typeOptimize["ALL"] -- permet d'optimiser les soucis liés au getName et getRoom de fibaro mais n'affiche plus le nom des modules concernés. end -- Ajouter ici les événements àexécuter / Add here events to schedule -- Une liste d'exemples est disponible dans un fichier annexe samples.lua / A samples list is available in another file called samples.lua function setEvents() local id = { --inconnu MODUL_FENTRE_LILY = 159, WALPLUG_2 = 121, FENETRE_SALON = 425, --Entrêe -- LUMIERE_EXT_ENTREE = 213, CAPTEUR_PORTE_ENTREE = 526, CAPTEUR_MOUVEMENT = 24, --Scéllier LUM_SCELLIER_ = 465, TEMP_SCELLIER = 291, LUX_ = 292, MACHINE_A_LAVER = 30, DETECTEUR_SCELLIER = 290, VMC_DOUBLE_FLUX = 104, --Cuisine APPLIQUE_CUISINE = 463, LAVE_VAISSELLES_ = 141, VAR_CUISINE = 278, VOLET_CUISINE = 209, WALLPLUG = 31, --wc LUMIERE_WC = 294, DETEC_WC = 418, LUX_WC = 420, --Séjour ALARME_INCENDIE = 195, CAPTEUR_BAIE_2 = 179, TEMP_DAF_ = 194, VITESSE_VENTILATION_ = 177, BAIE_2 = 75, REGLAGE_CLIM = 174, ON_OFF_CLIM = 176, TEMP_SEJOUR = 25, BAIE_1 = 73, LUX_SEJOUR = 26, VARIATEUR_SEJOUR = 71, CAPTE_BAIE_1 = 528, TEMP_TH_CLIM = 175, DETECTEUR_FUMEE_ = 193, CAM_SALON = 93, --Salon TEMP_SALON_NET = 144, VOLET_3 = 77, TV_SALON = 130, --Dressing TAUX_LUMIERES_ = 115, TEMP_DRESSING = 114, DETECTEUR_DRESSING = 113, LUMIERE_DRESSING = 472, --Chambre Parents VOLET_CH_PARENTS = 117, FENETRE_CH_PARENTS = 92, --Chambre Lily FENETRE_CH_LILY = 170, TEMP_CH_LILY = 172, VOLET_CH_LILY = 108, --Bureau TV_BUREAU = 100, TUNER_TNT_RESEAU = 97, XBOX_360 = 101, VOLET_BUREAU = 28, ORDI_FIXE = 99, ALARME_DAF_2 = 189, IMPRIMANTE_ = 98, DETECTEUR_FUMEE_2 = 187, TEMP_DAF_2 = 188, HOME_CENTER_2 = 96, Lum_Multi = 223, --Garage HUMIDITE_EXTERIEUR_ = 150, TEMP_EXTERIEUR_ = 149, SERVEUR_DS1513_DS212 = 531, PRISE_EXTERIEURE_ = 532, Porte_de_Garage = 332, --Escalier E_CLAIRAGE_ESCALIER = 233, TEMP_CLIM = 270, TEMP_ESCALIER_ = 242, DETECTEUR_ESCALIER_ = 241, --virtual Device MAJ_ecodevise = 379, Presence_Peter = 449, Annonce_TTS = 159, } -- ID Portable local phone = { phone_peter = 164, phone_adel = 230, ipad = 407, } -- ID User local user = { peter = 137, adel = 229, admin = 2, } --------------------MODULE VIRTUEL-------------------------------- --Maj Virtual devise Presence Peter GEA.add(true, 1*60, "",{{"VirtualDevice", id["Presence_Peter"], "1"},{"Repeat"}}) --Maj des datas EccoDevice sur le server Garage GEA.add(true, 1*60, "",{{"VirtualDevice", id["MAJ_ecodevise"], "1"},{"Repeat"}}) ---FIN MODULE VIRTUEL-------------------------------- ------DEBUT GARAGE--------------------- -- Le scénario enverra un push toutes les 10mn tant que la porte sera ouverte GEA.add( id["Porte_de_Garage"], 10*60, "La porte du garage est ouverte depuis plus de #duration#",{{"Portable", phone["phone_peter"]}, {"Repeat"}}) -- Msg àla fermeture du garage GEA.add( id["Porte_de_Garage"], -1, "La porte du garage a bien été fermée", {{"Inverse"}}) -- Avertissement push si la porte du garage s'ouvre àdes heures non inappropriée --GEA.add( id["Porte_de_Garage"], -1, "Ouverture de la porte du garage à#time#", {{"Time", "08:30", "17:30"}, {"Days", "Monday, Tuesday, , Wednesday, Thursday, Friday, Saturday"}}) ------FIN GARAGE----------------------- ----PORTE ET FENETRE------------------------ --ch Lily GEA.add( id["FENETRE_CH_LILY"], 30*60, "La Fenetre de la chambre de Lily est ouverte depuis plus de #duration#",{{"Portable", phone["phone_adel"]}, {"Portable", phone["phone_peter"]}, {"Repeat"}}) GEA.add( id["FENETRE_CH_LILY"], -1, "La Fenetre de la chambre de Lily a été fermée", {{"Inverse"}}) -- Msg a la fermeture de la fentre Ch Lily --ch Parents GEA.add( id["FENETRE_CH_PARENTS"], 30*60, "La Fenetre de la chambre des Parents est ouverte depuis plus de #duration#",{{"Portable", phone["phone_adel"]}, {"Portable", phone["phone_peter"]}, {"Repeat"}}) GEA.add( id["FENETRE_CH_PARENTS"], -1, "La Fenetre de la chambre des Parents a été fermée", {{"Inverse"}}) -- Msg a la fermeture fenetre Ch Parents -- Feneter Salon GEA.add( id["FENETRE_SALON"], 15*60, "La Fenetre du salon est ouverte depuis plus de #duration#", {{"Portable", phone["phone_adel"]}, {"Portable", phone["phone_peter"]}, {"Repeat"}}) GEA.add( id["FENETRE_SALON"], -1, "La Fenetre du salon a été fermée", {{"Inverse"}}) -- Msg a la fermeture fentre salon RDC ---FIN PORTE ET FENETRE----------------------- --================================================================= -- LUMIERES --================================================================= --LUMIERE SCELLIER fonctionne OK -- Extinction automatique de la lampe après 30s. local autoOffScellier = GEA.add ({id["LUM_SCELLIER_"]}, 80, "", {{"turnOff"}}) -- Appuie sur l'interrupteur de la lampe, on stoppe l'extinction automatique. GEA.add (id["LUM_SCELLIER_"], -1, "", {{"StopTask", autoOffScellier}}) -- Allumage de la lampe sur détection mouvement GEA.add ({id["DETECTEUR_SCELLIER"], {"Value-", id["LUX_"], 15}, {"Value", id["LUM_SCELLIER_"],0}}, -1, "", {{"turnOn", id["LUM_SCELLIER_"]}, {"RestartTask", autoOffScellier}}) -- Extinction de la lampe dans tous les cas après 10 min GEA.add (id["LUM_SCELLIER_"], 4*60, "", {{"Inverse"}, {"turnOff", id["LUM_SCELLIER_"]}}) --===================================================================== --FONCTIONNE OK SCELLIER --GEA.add({id["DETECTEUR_SCELLIER"], {"Global", "Jour_Nuit", "Nuit"}}, -1, "", {{"turnOn", id["LUM_SCELLIER_"]}}) -- eteindre la lampe plus de detection pdt 60 second --GEA.add( id["DETECTEUR_SCELLIER"], 1*60, "", {{"Inverse"}, {"turnOff", id["LUM_SCELLIER_"]}}) --================================================================== --LUMIERES DRESSING ok GEA.add( id["DETECTEUR_DRESSING"], -1, "", {{"turnOn", id["LUMIERE_DRESSING"]}}) -- eteindre la lampe plus de detection pdt 1 mins GEA.add( id["DETECTEUR_DRESSING"], 1*60, "", {{"Inverse"}, {"turnOff", id["LUMIERE_DRESSING"]}}) --================================================================== -- Lampe wc ok fonctionne --[[ -- Extinction automatique de la lampe après 60s. local autoOffWC = GEA.add ({id["LUMIERE_WC"]}, 80, "", {{"turnOff"}}) -- Appuie sur l'interrupteur de la lampe, on stoppe l'extinction automatique. GEA.add (id["LUMIERE_WC"], -1, "", {{"StopTask", autoOffWC}}) -- Allumage de la lampe sur détection mouvement GEA.add ({id["DETEC_WC"], {"Value-", id["LUX_WC"], 5}, {"Value", id["LUMIERE_WC"],0}}, -1, "", {{"turnOn", id["LUMIERE_WC"]}, {"RestartTask", autoOffWC}}) -- Extinction de la lampe dans tous les cas après 10 min GEA.add (id["LUMIERE_WC"], 4*60, "", {{"Inverse"}, {"turnOff", id["LUMIERE_WC"]}}) --]] --================================================================== --LUMIERES ESCALIER --GEA.add({id["DETECTEUR_ESCALIER"], {"Global", "Jour_Nuit", "Nuit"}}, -1, "", {{"turnOn", id["E_CLAIRAGE_ESCALIER"],{"Value", 20}}}) --GEA.add( id["DETECTEUR_ESCALIER"], 30, "", {{"Inverse"}, {"turnOff", id["E_CLAIRAGE_ESCALIER"]}}) --FIN LUMIERE-------- --========================================================================= --PRISE EXTERIEURE GARAGE GEA.add({"Sensor+", id["PRISE_EXTERIEURE_"], 20}, 1*60, "Prise exterieur en cour de fonctionnement depuis #duration#", {{"Portable", phone["phone_peter"]},{"turnOff",id["PRISE_EXTERIEURE_"]}}) --========================================================================= end Je vous remercie tous pour votre aide inestimable peter Modifié le 16 novembre 2016 par Lazer Ne pas copier/coller l'intégralité du code source de GEA
sonnyboy Posté(e) le 9 décembre 2016 Signaler Posté(e) le 9 décembre 2016 i post my little setup here, perhaps others that just started have like me second thoughts, this is BIG but with help from this forum everything works All the comment is in Swedish Earth Hour is from Robert on Swedish zwaveforum.se, slightly modified, i have deleted sonos in mine, Source here http://zwaveforum.se/viewtopic.php?f=38&t=5463&start=320#p18258 --[[ %% autostart %% properties 202 value 228 value %% globals Sun --]] local Alicia = {Window = 36} local Oliver = {Dimmer = 267} local Elliot = {Dimmer = 274, Elliot_Skrivbord = 300} local BedRoom = {Sonny_Laddare = 37, Erika_Laddare = 288} local Farstukvist = {Tak = 276} local Wc = {Tak = 66} local Laundry_Room = {Tak = 51} local Kitchen = {KaffeBryggare = 272, Window = 250} local LivingRoom = {Hemma_Bio = 42, Tv = 43, Wii = 44, Bakom_Tv = 45, Bakom_Soffa = 269} local SENSORS = {Wc = 202, Laundry_Room = 228} local VD = {AllmanBelysning = 240, BarnensBelysning = 193, Garaget_Stolpe = 76} -- v 5.42 function setEvents() --Barnens belysning --Starta lamporna när globala variablen är 1.3 eller mindre och klockan är mellan 13:00-18:50 släck vid 19 tiden. GEA.add({"Global-", "Sun", "1.3"}, 30, "", {{"Time", "13:00", "18:50"}, {"VirtualDevice", VD["BarnensBelysning"], "1"}})--Tryck på knapp 1 på VD 193 GEA.add(true, 30, "", {{"Time", "19:00", "19:02"}, {"VirtualDevice", VD["BarnensBelysning"], "2"}})--Tryck på knapp 2 på VD 193 GEA.add(true, 30, "", {{"Time", "06:45", "06:46"}, {"turnOff", Elliot["Dimmer"]}}) --UteBelysningen GEA.add({"Global-", "Sun", "0.7"}, 30, "", {{"turnOn", Farstukvist["Tak"]}}) GEA.add({"Global-", "Sun", "0.7"}, 30, "", {{"VirtualDevice", VD["Garaget_Stolpe"], "1"}}) GEA.add({"Global+", "Sun", "0.8"}, 30, "", {{"turnOff", Farstukvist["Tak"]}}) GEA.add({"Global+", "Sun", "0.8"}, 30, "", {{"VirtualDevice", VD["Garaget_Stolpe"], "2"}}) -- Tänder Wc vid rörelse och Släcker GEA.add(SENSORS["Wc"], -1, "", {{"Time", "05:01", "22:30"}, {"Value", Wc["Tak"], 99}}) GEA.add(SENSORS["Wc"], -1, "", {{"Time", "22:31", "05:00"}, {"Value", Wc["Tak"], 30}}) GEA.add(SENSORS["Wc"], 3*60, "", {{"Inverse"}, {"turnOff", Wc["Tak"]}}) -- Tänder Tvättstugan vid rörelse och Släcker GEA.add(SENSORS["Laundry_Room"], -1, "", {{"Time", "00:00", "23:59"},{"turnOn", Laundry_Room["Tak"]}}) GEA.add(SENSORS["Laundry_Room"], 5*60, "", {{"Inverse"}, {"turnOff", Laundry_Room["Tak"]}}) --Vardagsrummet --Standby killer Off GEA.add(true, 30, "", {{"Time", "06:30", "06:31"}, {"turnOn", LivingRoom["Hemma_Bio"]}, {"turnOn", LivingRoom["Tv"]}, {"turnOn", LivingRoom["Wii"]}}) --Standby killer On GEA.add(true, 30, "", {{"Time", "01:30", "01:31"}, {"turnOff", LivingRoom["Hemma_Bio"]}, {"turnOff", LivingRoom["Tv"]}, {"turnOff", LivingRoom["Wii"]}}) --Köket GEA.add({"Sensor+", Kitchen["KaffeBryggare"], 50}, 40*60, "Stänger av Kaffebryggaren #time#", {{"turnOff", Kitchen["kaffeBryggare"]},{"Portable"}}) --Sovrummet --Starta laddare GEA.add(true, 30, "", {{"Time", "22:00", "22:01"}, {"turnOn", BedRoom["Sonny_Laddare"]}, {"turnOn", BedRoom["Erika_Laddare"]}}) --Laddare av GEA.add(true, 30, "", {{"Time", "06:00", "06:01"}, {"turnOff", BedRoom["Sonny_Laddare"]}, {"turnOff", BedRoom["Erika_Laddare"]}}) --Morgonbelysning om sol är mindre än 1 GEA.add({"Global-", "Sun", "1.0"}, 30, "", {{"Time", "05:30", "12:50"}, {"Days", "Weekday"}, {"turnOn", LivingRoom["Bakom_Soffa"]}, {"turnOn", LivingRoom["Bakom_Tv"]}, {"turnOn", Kitchen["Window"]}}) GEA.add({"Global-", "Sun", "1.0"}, 30, "", {{"Time", "07:30", "12:50"}, {"Days", "Weekend"}, {"turnOn", LivingRoom["Bakom_Soffa"]}, {"turnOn", LivingRoom["Bakom_Tv"]}, {"turnOn", Kitchen["Window"]}}) GEA.add({"Global+", "Sun", "1.1"}, 30, "", {{"Time", "05:46", "12:52"}, {"turnOff", LivingRoom["Bakom_Soffa"]}, {"turnOff", LivingRoom["Bakom_Tv"]}, {"turnOff", Kitchen["Window"]}}) -- Earth Hour - Datum fram till 2020. -- Notis via push och Sonos om att Earth Hour börjar om 30 min. GEA.add (true, 30, "Earth Hour börjar om 30 minuter. Förbered levande ljus ifall ni vill se något i mörkret :)", {{"If", {{"Global", "Status", "Hemma"}}}, {"Dates", "25/03/2017", "25/03/2017"}, {"Dates", "31/03/2018", "31/03/2018"}, {"Dates", "30/03/2019", "30/03/2019"}, {"Dates", "28/03/2020", "28/03/2020"}, {"Time", "20:00", "20:01"}}) -- Sätter den globala variabeln till aktivt läge, 1. GEA.add (true, 30, "", {{"If", {{"Global", "Status", "Hemma"}}}, {"Dates", "25/03/2017", "25/03/2017"}, {"Dates", "31/03/2018", "31/03/2018"}, {"Dates", "30/03/2019", "30/03/2019"}, {"Dates", "28/03/2020", "28/03/2020"}, {"Time", "20:30", "20:31"}, {"Global", "EarthHour", "1"}}) -- Påbörjar Earth Hour. Släcker alla lampor, pushar ut notis på mobiler och Sonos. GEA.add ({"Global", "EarthHour", "1"}, -1, "Earth Hour påbörjad. Avslutas 21:30.", {{"If", {{"Global", "Status", "Hemma"}}}, {"Dates", "25/03/2017", "25/03/2017"}, {"Dates", "31/03/2018", "31/03/2018"}, {"Dates", "30/03/2019", "30/03/2019"}, {"Dates", "28/03/2020", "28/03/2020"}, {"Time", "20:30", "20:31"}, {"VirtualDevice", VD["AllmanBelysning"], "2"}}) -- Sätter den globala variabeln till inaktivt läge, 0. GEA.add (true, 30, "", {{"If", {{"Global", "Status", "Hemma"}}}, {"Dates", "25/03/2017", "25/03/2017"}, {"Dates", "31/03/2018", "31/03/2018"}, {"Dates", "30/03/2019", "30/03/2019"}, {"Dates", "28/03/2020", "28/03/2020"}, {"Time", "21:30", "21:31"}, {"Global", "EarthHour", "0"}}) -- Avslutar Earth Hour. Tänder lamporna igen, pushar ut notis på mobiler och Sonos. GEA.add ({"Global", "EarthHour", "0"}, -1, "Earth Hour avslutad. Lamporna tänds.", {{"If", {{"Global", "Status", "Hemma"}}}, {"Dates", "25/03/2017", "25/03/2017"}, {"Dates", "31/03/2018", "31/03/2018"}, {"Dates", "30/03/2019", "30/03/2019"}, {"Dates", "28/03/2020", "28/03/2020"}, {"Time", "21:30", "21:31"}, {"VirtualDevice", VD["AllmanBelysning"], "1"}}) end 2
sebcbien Posté(e) le 9 décembre 2016 Auteur Signaler Posté(e) le 9 décembre 2016 Beau tout ça ! :-)Sent from my Note4
Alistair Crompton Posté(e) le 27 octobre 2021 Signaler Posté(e) le 27 octobre 2021 Hello, j'ignorais totalement la présence de ce showroom, voici donc ma config GEA depuis quelques années, si cela peut aider certains ! --[[ %% autostart %% properties 105 value 82 value 90 value 100 value 72 value 264 value 237 value 296 value 300 value 335 value 278 value 361 value 74 value %% globals PlexTV GLOBAL_REQUEST ALPHONSE_BUSY MM_BLACK MM_WHITE --]] function setEvents() math.randomseed(os.time()) local devices = { HUE_SOFA = 136, HUE_BUFFET = 154, HUE_STAIRS = 157, HUE_CAB = 87, HUE_CHEM = 156, HUE_TV = 155, HUE_DESKTOP = 88, HUE_MEZ = 158, HUE_BROOM = 35, HUE_BUANDRIE = 34, HUE_SOFA_CAB = 189, HUE_ALL = 33, VMC = 42, BABY_FOOT = 74, -- WC = 72, SDB = 137, SDB_SHOWER = 139, SDB_T2 = 183, FOOD = 70, DRESSING = 100, DRESS_SEB = 133, DRESS_BIN = 135, PLUG_DOLL = 80, PLUG_KITCHEN = 40, PLUG_COMICS = 76, PLUG_LIVING = 80, -- PLUG_CAB = 78, RGB_CAB = 19, -- KITCHEN = 90, OUTSIDE = 92, OUTSIDE_CAB = 171, } local devicesEx = { SUN_SWITCH = 72, LIGHTS_GARAGE = 142, SONOS_KITCHEN = 194, SONOS_LIVING = 196, EYE_FOOD = 105, EYE_KITCHEN = 82, EYE_OUTSIDE = 335, EYE_LIVING = 5, EYE_T2 = 165, TEMP_CAB = 265, TEMP_KITCHEN = 83, TEMP_DRESS = 297, TEMP_BROOM = 6, -- TEMP_MEZ = 6, TEMP_LIVING = 301, TEMP_OUTSIDE = 58, TEMP_LIVING_T2 = 166, -- TEMP_LIVING_T2 = 238, -- temporary hack because of the dead living sensor TEMP_BEDROOM_T2 = 238, LUX_KITCHEN = 84, LUX_BEDROOM = 7, LUX_T2 = 167, PLUG_TV = 78, BELL = 337, VELUX_OPEN = 56, VELUX_CLOSE = 54, SHUTTERS_OPEN = 149, SHUTTERS_CLOSE = 151, CAB_CLOSE = 193, -- HEATER_SDB = 203, -- HEATER_SDB_T2 = 175, HEATER_LIVING_T2 = 171, HEATER_KITCHEN_T2 = 191, VD_HEATER_SDB = 216, VD_HEATER_KITCHEN_T2 = 354, -- 218, VD_HEATER_LIVING_T2 = 220, VD_HEATER_SDB_T2 = 221, VD_HEATER_BEDROOM_T2 = 219, VD_HEATER_CAB = 253, VD_HEATER_DRESSING = 260, VD_HEATER_BROOM = 329, VD_HEATER_KITCHEN = 273, VD_HEATER_BABY = 316, VD_HEATER_TV = 315, THERMOSTAT_T2 = 237, THERMOSTAT_CAB = 264, THERMOSTAT_DRESS = 296, THERMOSTAT_LIVING = 300, OUTSIDE_T2 = 177, LIVING_T2 = 176, T2_WINDOW = 278, --T2_DOOR = 278, -- temporary hack because of the dead living sensor T2_DOOR = 361, } local vd_heater_values = { CONF = "2", ECO = "5", HG = "6", STOP = "7", CONF_1 = "3", CONF_2 = "4" } local hm = { CONF = 99, ECO = 25, HG = 15, STOP = 0, CONF_1 = 50, CONF_2 = 35 } local shortcuts = { AUTO_LIGHTS = true, OUTSIDE_IS_COLD = {"Value-", devicesEx.TEMP_OUTSIDE, 15.5}, OUTSIDE_IS_HOT = {"Value+", devicesEx.TEMP_OUTSIDE, 16}, OUTSIDE_IS_VERY_HOT = {"Value+", devicesEx.TEMP_OUTSIDE, 40}, LIVING_IS_COLD = {"Value-", devicesEx.TEMP_LIVING, 17}, LIVING_IS_HOT = {"Value+", devicesEx.TEMP_LIVING, 17.5}, -- DRESSING_IS_COLD = {"Value-", devicesEx.TEMP_LIVING, 16}, -- DRESSING_IS_HOT = {"Value+", devicesEx.TEMP_LIVING, 16.5}, -- KITCHEN_IS_COLD = {"Value-", devicesEx.TEMP_KITCHEN, 12}, -- KITCHEN_IS_HOT = {"Value+", devicesEx.TEMP_KITCHEN, 12.5}, PERIOD_OVERNIGHT = {"Time", "Sunset>19:00", "Sunrise<06:00"}, PERIOD_WORKING_TIME = {"Time", "10:00", "18:00"}, PERIOD_MORNING_EVENING = {"Or",{"Time", "06:30", "10:00"}, {"Time", "17:30", "22:00"}}, -- LUX_BEDROOM_IS_WEAK = {"Value-", devicesEx.LUX_BEDROOM, 5}, LUX_KITCHEN_IS_WEAK = {"Value-", devicesEx.LUX_KITCHEN, 19}, -- LUX_BEDROOM_IS_OK = {"Value+", devicesEx.LUX_BEDROOM, 10}, LUX_KITCHEN_IS_OK = {"Value+", devicesEx.LUX_KITCHEN, 20}, LIVING_IS_ON = {"Or",{"Hue", devices.HUE_CHEM, "on", 1}, {"Hue", devices.HUE_BUFFET, "on", 1}}, -- HOLIDAYS_MODE_IS_ON = {"Global", "HOLIDAYS_MODE", "1"}, -- HOLIDAYS_MODE_IS_OFF = {"Global", "HOLIDAYS_MODE", "0"}, OPEN_HOUR_WD_7 = {"Global", "OPEN_HOUR_WD", "7:00"}, OPEN_HOUR_WD_8 = {"Global", "OPEN_HOUR_WD", "8:00"}, OPEN_HOUR_WD_9 = {"Global", "OPEN_HOUR_WD", "9:00"}, OPEN_HOUR_WD_10 = {"Global", "OPEN_HOUR_WD", "10:00"}, OPEN_HOUR_WD_11 = {"Global", "OPEN_HOUR_WD", "11:00"}, OPEN_HOUR_WE_7 = {"Global", "OPEN_HOUR_WE", "7:00"}, OPEN_HOUR_WE_8 = {"Global", "OPEN_HOUR_WE", "8:00"}, OPEN_HOUR_WE_9 = {"Global", "OPEN_HOUR_WE", "9:00"}, OPEN_HOUR_WE_10 = {"Global", "OPEN_HOUR_WE", "10:00"}, OPEN_HOUR_WE_11 = {"Global", "OPEN_HOUR_WE", "11:00"}, T2_IS_FREE = {"Global", "ALPHONSE_BUSY", "0"}, T2_IS_BUSY = {"Global", "ALPHONSE_BUSY", "1"}, CAB_IS_FREE = {"Global", "CAB_BUSY", "0"}, CAB_IS_BUSY = {"Global", "CAB_BUSY", "1"}, -- T2_WINDOW_OPENED = {"Global", "ALPHONSE_BUSY", "1"}, T2_WINDOW_CLOSED = {"Global", "T2_WINDOW", "0"}, T2_DOOR_CLOSED = {"Global", "T2_DOOR", "0"}, T2_DOOR_OPEN = {"Global", "T2_DOOR", "1"}, -- ACTION_PENDING = "ACTION_PENDING", SHUTTERS_ARE_CLOSED = {"Global", "SHUTTERS_CLOSED", "1"}, SHUTTERS_ARE_OPEN = {"Global", "SHUTTERS_CLOSED", "0"}, VELUX_ARE_CLOSED = {"Global", "VELUX_CLOSED", "1"}, VELUX_CAN_BE_OPENED = {"Value+", devicesEx.TEMP_OUTSIDE, 3.5}, -- VELUX_CAN_BE_OPENED = {"Global", "VELUX_CLOSED", "3"}, VELUX_ARE_OPEN = {"Global", "VELUX_CLOSED", "0"}, IAM_THERE = {"Global", "IAM_THERE", "1"}, AUTO_SHUTTERS = "AUTO_SHUTTERS", -- ACTION_CLOSE_SHUTTERS = {"Global", "ACTION_PENDING", "1"}, -- CONFIRM_BEFORE_CLOSING_SHUTTERS = {"Global", "AUTO_SHUTTERS", "0"}, AUTO_CLOSING_SHUTTERS = {"Global", "AUTO_SHUTTERS", "1"}, REQ_IS_AVAILABLE = {"Global", "GLOBAL_REQUEST", "0"}, REQ_ALL_OFF = {"Global", "GLOBAL_REQUEST", "ALLOFF"}, REQ_OPEN_SHUTTERS = {"Global", "GLOBAL_REQUEST", "SUP"}, REQ_CLOSE_SHUTTERS = {"Global", "GLOBAL_REQUEST", "SDOWN"}, REQ_NCLOSE_SHUTTERS = {"Global", "GLOBAL_REQUEST", "NSDOWN"}, REQ_OPEN_VELUX = {"Global", "GLOBAL_REQUEST", "VUP"}, REQ_CLOSE_VELUX = {"Global", "GLOBAL_REQUEST", "VDOWN"}, REQ_UPDATE_HEATING_T2 = {"Global", "GLOBAL_REQUEST", "UHEATINGT2"}, REQ_UPDATE_HEATING_CAB = {"Global", "GLOBAL_REQUEST", "UHEATINGCAB"}, REQ_UPDATE_HEATING_DRESS = {"Global", "GLOBAL_REQUEST", "UHEATINGDRESS"}, REQ_UPDATE_HEATING_KITCHEN = {"Global", "GLOBAL_REQUEST", "UHEATINGKITCHEN"}, REQ_UPDATE_HEATING_LIVING = {"Global", "GLOBAL_REQUEST", "UHEATINGLIVING"}, REQ_UPDATE_HEATING_BROOM = {"Global", "GLOBAL_REQUEST", "UHEATINGBROOM"}, REQ_UPDATE_HEATINGS = {"Global", "GLOBAL_REQUEST", "UHEATINGS"}, -- REQ_SOMEBODY_THERE = {"Global", "SOMEBODY_THERE", "1"}, SOMEBODY_THERE = "SOMEBODY_THERE", REQ_MM_BLACK_1 = {"Global", "MM_BLACK", "1"}, REQ_MM_BLACK_3 = {"Global", "MM_BLACK", "3"}, REQ_MM_BLACK_5 = {"Global", "MM_BLACK", "5"}, REQ_MM_BLACK_7 = {"Global", "MM_BLACK", "7"}, REQ_MM_BLACK_2 = {"Global", "MM_BLACK", "2"}, REQ_MM_BLACK_4 = {"Global", "MM_BLACK", "4"}, REQ_MM_BLACK_6 = {"Global", "MM_BLACK", "6"}, REQ_MM_BLACK_8 = {"Global", "MM_BLACK", "8"}, RESET_MM_BLACK = {"Global", "MM_BLACK", "0"}, REQ_MM_WHITE_1 = {"Global", "MM_WHITE", "1"}, REQ_MM_WHITE_3 = {"Global", "MM_WHITE", "3"}, REQ_MM_WHITE_5 = {"Global", "MM_WHITE", "5"}, REQ_MM_WHITE_7 = {"Global", "MM_WHITE", "7"}, REQ_MM_WHITE_2 = {"Global", "MM_WHITE", "2"}, REQ_MM_WHITE_4 = {"Global", "MM_WHITE", "4"}, REQ_MM_WHITE_6 = {"Global", "MM_WHITE", "6"}, REQ_MM_WHITE_8 = {"Global", "MM_WHITE", "8"}, RESET_MM_WHITE = {"Global", "MM_WHITE", "0"}, CONSIGNE_T2 = "CONSIGNE_T2", TEMP_MAX_T2 = "TEMP_MAX_T2", TEMP_MIN_T2 = "TEMP_MIN_T2", CONSIGNE_CAB = "CONSIGNE_CAB", TEMP_MAX_CAB = "TEMP_MAX_CAB", TEMP_MIN_CAB = "TEMP_MIN_CAB", CONSIGNE_LIVING = "CONSIGNE_LIVING", TEMP_MAX_LIVING = "TEMP_MAX_LIVING", TEMP_MIN_LIVING = "TEMP_MIN_LIVING", CONSIGNE_DRESS = "CONSIGNE_DRESS", TEMP_MAX_DRESS = "TEMP_MAX_DRESS", TEMP_MIN_DRESS = "TEMP_MIN_DRESS", CONSIGNE_BROOM = "CONSIGNE_BROOM", TEMP_MAX_BROOM = "TEMP_MAX_BROOM", TEMP_MIN_BROOM = "TEMP_MIN_BROOM", CONSIGNE_KITCHEN = "CONSIGNE_KITCHEN", TEMP_MAX_KITCHEN = "TEMP_MAX_KITCHEN", TEMP_MIN_KITCHEN = "TEMP_MIN_KITCHEN", T2_WINDOW = "T2_WINDOW", T2_DOOR = "T2_DOOR", ALPHONSE_BUSY = "ALPHONSE_BUSY", } local scenes = { ACTION_CLOSE_SHUTTERS = 36, GEA = 16, ALL_OFF = 25, -- IFTTT_BELL = 39, -- IFTTT_FRANCEINFO = 45, -- IFTTT_MY_FLOW = 42, -- IFTTT_SONOS_PAUSE = 43, } local heatingConf = { T2 = { LABEL = "ALPHONSE", TID = devicesEx.THERMOSTAT_T2, T = devicesEx.TEMP_LIVING_T2, TMAX = shortcuts.TEMP_MAX_T2, TMIN = shortcuts.TEMP_MIN_T2, C = shortcuts.CONSIGNE_T2, VDS = {devicesEx.VD_HEATER_KITCHEN_T2, devicesEx.VD_HEATER_LIVING_T2, devicesEx.VD_HEATER_BEDROOM_T2}, PRECOND = function () return tonumber(fibaro:getGlobalValue(shortcuts.ALPHONSE_BUSY)) == 1 and tonumber(fibaro:getGlobalValue(shortcuts.T2_DOOR)) == 0 and tonumber(fibaro:getGlobalValue(shortcuts.T2_WINDOW)) == 0 end, POSTFUNC = function (consigne) fibaro:setGlobal(shortcuts.TEMP_MIN_T2, consigne-2) end, }, CAB = { LABEL = "CABINET", TID = devicesEx.THERMOSTAT_CAB, T = devicesEx.TEMP_CAB, TMAX = shortcuts.TEMP_MAX_CAB, TMIN = shortcuts.TEMP_MIN_CAB, C = shortcuts.CONSIGNE_CAB, VDS = {devicesEx.VD_HEATER_CAB}, }, KITCHEN = { LABEL = "CUISINE", TID = nil, T = devicesEx.TEMP_KITCHEN, TMAX = shortcuts.TEMP_MAX_KITCHEN, TMIN = shortcuts.TEMP_MIN_KITCHEN, C = shortcuts.CONSIGNE_KITCHEN, VDS = {devicesEx.VD_HEATER_KITCHEN}, }, DRESS = { LABEL = "DRESSING", TID = devicesEx.THERMOSTAT_DRESS, T = devicesEx.TEMP_DRESS, TMAX = shortcuts.TEMP_MAX_DRESS, TMIN = shortcuts.TEMP_MIN_DRESS, C = shortcuts.CONSIGNE_DRESS, VDS = {devicesEx.VD_HEATER_DRESSING,devicesEx.VD_HEATER_SDB}, }, BROOM = { LABEL = "CHAMBRE", TID = nil, T = devicesEx.TEMP_BROOM, TMAX = shortcuts.TEMP_MAX_BROOM, TMIN = shortcuts.TEMP_MIN_BROOM, C = shortcuts.CONSIGNE_BROOM, VDS = {devicesEx.VD_HEATER_BROOM}, }, LIVING = { LABEL = "SALON", TID = devicesEx.THERMOSTAT_LIVING, T = devicesEx.TEMP_LIVING, TMAX = shortcuts.TEMP_MAX_LIVING, TMIN = shortcuts.TEMP_MIN_LIVING, C = shortcuts.CONSIGNE_LIVING, VDS = {devicesEx.VD_HEATER_TV,devicesEx.VD_HEATER_BABY}, } } local metricAlert=function( model ) -- fibaro:debug("metricAlert !!!!!") -- local messages = {"alerte:quelqu'un est dans l'escalier !"} -- local message = messages[math.random(#messages)] -- local alarms = {"alarm10","alarm12","alarm13"} -- local alarm = alarm[math.random(#alarms)] net.HTTPClient():request("http://" .. '192.168.1.23' .. ":8080/api/v2/device/notifications", {options = { method = 'POST', headers = { ['Content-Type'] = 'application/json', ['Authorization'] = 'Basic ' .. 'xxxxxxxxxxxxxxxx=', }, data = json.encode( { --icon_type = "alert", priority = "critical", model = model, cycles = 30 / 4.5 }) }, }) end local fns fns = { updateHeaters = function (conf) local consigne = tonumber(fibaro:getGlobalValue(conf.C)) if conf.PRECOND == nil then conf.PRECOND = function () return true end end if conf.PRECOND() then local T = tonumber(fibaro:getValue(conf.T, "value")) local value = vd_heater_values.CONF local text = " " .. conf.LABEL if T > consigne then value = vd_heater_values.HG end for _,v in ipairs(conf.VDS) do fibaro:call(v, "pressButton",value) end end end, updateConsigne = function (conf) local max = tonumber(fibaro:getGlobalValue(conf.TMAX)) local min = tonumber(fibaro:getGlobalValue(conf.TMIN)) local consigne if conf.TID == nil then consigne = tonumber(fibaro:getGlobalValue(conf.C)) if consigne > max then consigne = max end if consigne < min then consigne = min end else consigne = tonumber(fibaro:getValue(conf.TID, "value")) if consigne > max then consigne = max end if consigne < min then consigne = min end consigne = consigne -0.5 end fibaro:setGlobal(conf.C, consigne) if conf.POSTFUNC then conf.POSTFUNC (consigne) end fns.updateHeaters (conf) local T = tonumber(fibaro:getValue(conf.T, "value")) local text = "··· THERMOSTAT " .. conf.LABEL if T > consigne then text = text .. " : HG ··· consigne : " .. consigne .. " °C ··· temperature : " .. T .. " °C ··· HG" else text = text .. " : ON ··· consigne : " .. consigne .. " °C ··· temperature : " .. T .. " °C ··· ON" end metricAlert({ frames = { -- { icon = 7431, text = text }, { text = text }, }, }) end, resetRequests = function () fibaro:setGlobal ("GLOBAL_REQUEST", "0") -- fibaro:setGlobal ("ACTION_PENDING", "0") end, idFromNumber = function (number) local result = "UNKNOWN" for k,v in pairs(devices) do if v == number then result = k end end return result end, allOff = function () for k,v in pairs(devices) do fibaro:call(v, "turnOff") fibaro:sleep(100) end end, auto = function (operation, params) local seconds = 30 local deviceCond = params.id local deviceAction = {operation, params.id} if params.hue == true then deviceCond = {"Hue", params.id, "on", 1} if operation == "turnOff" then deviceCond = {"Hue", params.id, "on", 0} else deviceCond = {"Hue", params.id, "on", 1} end end if params.minutes then seconds = params.minutes *60 end return GEA.add(params.condition or deviceCond, seconds, "", deviceAction) end, autoOff = function (params) return fns.auto ("turnOff", params) end, autoOn = function (params) return fns.auto ("turnOn", params) end, onMotion = function (params) local c = { params.sensor } if params.condition then for _, v in pairs(params.condition) do table.insert (c, v) end end fns.autoOff({id=params.id,minutes=params.minutes,hue=params.hue}) GEA.add(params.sensor, -1, "", { "RestartTask", fns.autoOff({id=params.id,minutes=params.minutes,hue=params.hue}) } ) fns.autoOn({id=params.id,condition=c,minutes=-1/60,hue=params.hue}) end, } -- Modules qui doivent être réveillés de temps en temps... GEA.add( {"Dead", devices.DRESS_SEB}, 3600, "", {"Dead", devices.DRESS_SEB} ) GEA.add( {"Dead", devices.DRESS_BIN}, 3600, "", {"Dead", devices.DRESS_BIN} ) -- GEA.add( {"Dead", devices.PLUG_CAB}, 3600, "", {"Dead", devices.PLUG_CAB} ) GEA.add( {"Dead", devicesEx.TEMP_OUTSIDE}, 3600, "", {"Dead", devicesEx.TEMP_OUTSIDE} ) -- Update des radiateurs GEA.add( shortcuts.REQ_UPDATE_HEATINGS, -1 , "", {"Function", function() fns.resetRequests() fns.updateHeaters(heatingConf.T2) fns.updateHeaters(heatingConf.CAB) fns.updateHeaters(heatingConf.LIVING) fns.updateHeaters(heatingConf.DRESS) fns.updateHeaters(heatingConf.BROOM) fns.updateHeaters(heatingConf.KITCHEN) end} ) -- Gestion chauffage chez Alphonse -- Update du thermostat T2 GEA.add( devicesEx.THERMOSTAT_T2, -1 , "", {"Function", function() fns.updateConsigne(heatingConf.T2) end} ) -- Update du thermostat CAB GEA.add( devicesEx.THERMOSTAT_CAB, -1 , "", {"Function", function() fns.updateConsigne(heatingConf.CAB) end} ) -- Update du thermostat LIVING GEA.add( devicesEx.THERMOSTAT_LIVING, -1 , "", {"Function", function() fns.updateConsigne(heatingConf.LIVING) end} ) -- Update du thermostat DRESSING GEA.add( devicesEx.THERMOSTAT_DRESS, -1 , "", {"Function", function() fns.updateConsigne(heatingConf.DRESS) end} ) -- Update de la configuration chauffage T2 GEA.add( shortcuts.REQ_UPDATE_HEATING_T2, -1 , "", {"Function", function() fns.resetRequests() fns.updateConsigne(heatingConf.T2) end} ) -- Update de la configuration chauffage CAB GEA.add( shortcuts.REQ_UPDATE_HEATING_CAB, -1 , "", {"Function", function() fns.resetRequests() fns.updateConsigne(heatingConf.CAB) end} ) -- Update de la configuration chauffage CUISINE GEA.add( shortcuts.REQ_UPDATE_HEATING_KITCHEN, -1 , "", {"Function", function() fns.resetRequests() fns.updateConsigne(heatingConf.KITCHEN) end} ) -- Update de la configuration chauffage DRESSING GEA.add( shortcuts.REQ_UPDATE_HEATING_DRESS, -1 , "", {"Function", function() fns.resetRequests() fns.updateConsigne(heatingConf.DRESS) end} ) -- Update de la configuration chauffage CHAMBRE GEA.add( shortcuts.REQ_UPDATE_HEATING_BROOM, -1 , "", {"Function", function() fns.resetRequests() fns.updateConsigne(heatingConf.BROOM) end} ) -- Update de la configuration chauffage LIVING GEA.add( shortcuts.REQ_UPDATE_HEATING_LIVING, -1 , "", {"Function", function() fns.resetRequests() fns.updateConsigne(heatingConf.LIVING) end} ) -- Chauffages local HEATING_ON = true -- Durée cycle local HEATING_CYCLE = fibaro:getGlobalValue("HEATING_CYCLE") *60 -- minutes -- GESTION RADIATEURS ALPHONSE - BEGIN if (HEATING_ON) then -- GEA.add({ -- shortcuts.T2_IS_BUSY, -- {"Time", "06:00"}}, 30, "", {"ThermostatLevel", devicesEx.THERMOSTAT_T2, 20}) -- GEA.add({ -- shortcuts.T2_IS_FREE, -- {"Time", "08:02"}}, 30, "", {"ThermostatLevel", devicesEx.THERMOSTAT_T2, 16}) -- T < consigne pendant la nuit ? ECO (appartement BUSY) -- LIVING + CUISINE GEA.add({ shortcuts.T2_IS_BUSY, shortcuts.T2_WINDOW_CLOSED, shortcuts.T2_DOOR_CLOSED, {"Time", "23:31","6:14"}, {"Value-", devicesEx.TEMP_LIVING_T2, {"Global", shortcuts.TEMP_MIN_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.ECO}, {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.ECO}, {"Repeat"}}) -- CHAMBRE GEA.add({ shortcuts.T2_IS_BUSY, shortcuts.T2_WINDOW_CLOSED, shortcuts.T2_DOOR_CLOSED, {"Time", "23:31","6:14"}, {"Value-", devicesEx.TEMP_BEDROOM_T2, {"Global", shortcuts.TEMP_MIN_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.ECO}, {"Repeat"}}) -- T > consigne pendant la nuit ? HG (appartement BUSY) -- LIVING + CUISINE GEA.add({ shortcuts.T2_IS_BUSY, {"Time", "23:31","6:14"}, {"Value+", devicesEx.TEMP_LIVING_T2, {"Global", shortcuts.TEMP_MIN_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.HG}, {"Repeat"}}) -- CHAMBRE GEA.add({ shortcuts.T2_IS_BUSY, {"Time", "23:31","6:14"}, {"Value+", devicesEx.TEMP_BEDROOM_T2, {"Global", shortcuts.TEMP_MIN_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.HG}, {"Repeat"}}) -- LIVING + CUISINE -- T < consigne en journée ? CONF_1 (appartement BUSY) GEA.add({ shortcuts.T2_IS_BUSY, shortcuts.T2_WINDOW_CLOSED, shortcuts.T2_DOOR_CLOSED, -- shortcuts.OUTSIDE_IS_COLD, {"Time", "6:15","23:30"}, {"Value-", devicesEx.TEMP_LIVING_T2, {"Global", shortcuts.CONSIGNE_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.CONF}, {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.CONF}, {"Repeat"}}) -- CHAMBRE -- T < consigne en journée ? CONF_2 (appartement BUSY) GEA.add({ shortcuts.T2_IS_BUSY, shortcuts.T2_WINDOW_CLOSED, shortcuts.T2_DOOR_CLOSED, -- shortcuts.OUTSIDE_IS_COLD, {"Time", "6:15","23:30"}, {"Value-", devicesEx.TEMP_BEDROOM_T2, {"Global", shortcuts.CONSIGNE_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.CONF}, {"Repeat"}}) -- LIVING + CUISINE -- T > consigne ? appartement BUSY) GEA.add({ shortcuts.T2_IS_BUSY, {"Value+", devicesEx.TEMP_LIVING_T2, {"Global", shortcuts.CONSIGNE_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.HG}, {"Repeat"}}) -- CHAMBRE -- T > consigne ? appartement BUSY) GEA.add({ shortcuts.T2_IS_BUSY, {"Value+", devicesEx.TEMP_BEDROOM_T2, {"Global", shortcuts.CONSIGNE_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.HG}, {"Repeat"}}) -- La fenêtre de l'appartement est ouverte GEA.add( {devicesEx.T2_WINDOW}, -1, "", { {"Global", shortcuts.T2_WINDOW, "1"}, {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.HG}}) -- La porte de l'appartement est ouverte plus de 3 minutes GEA.add( {devicesEx.T2_DOOR}, 60 *3, "", { {"Global", shortcuts.T2_DOOR, "1"}, {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.HG}}) -- La porte de l'appartement est ouverte est ouverte plus de 5 minutes GEA.add( {shortcuts.T2_DOOR_OPEN}, 60 *5, "", {{"Function", function() metricAlert({ frames = { { text = " LA PORTE DU LIVING DE CHEZ ALPHONSE EST OUVERTE !" }, }, sound = { category = "notifications", id = "letter_email", }, }) end}, {"Repeat"} }) -- La fenêtre de l'appartement est fermée GEA.add( {devicesEx.T2_WINDOW}, -1, "", { {"Inverse"}, {"Global", shortcuts.T2_WINDOW, "0"}}) -- La porte de l'appartement est fermée GEA.add( {devicesEx.T2_DOOR}, -1, "", { {"Inverse"}, {"Global", shortcuts.T2_DOOR, "0"}}) -- L'appartement est FREE GEA.add( shortcuts.T2_IS_FREE, -1, "", { -- {"turnOff", devicesEx.LIGHTS_T2}, -- {"ThermostatLevel", devicesEx.THERMOSTAT_T2, {"Global", shortcuts.TEMP_MIN_T2}}, {"Global", shortcuts.TEMP_MIN_T2, "9"}, {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_SDB_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.HG}}) -- L'appartement est BUSY -- GEA.add( -- shortcuts.T2_IS_BUSY, -1, "", { -- {"turnOn", devicesEx.LIGHTS_T2}, -- {"ThermostatLevel", devicesEx.THERMOSTAT_T2, {"Global", shortcuts.TEMP_MAX_T2}}}) -- T < consigne ? ECO (appartement FREE) GEA.add({ shortcuts.T2_IS_FREE, shortcuts.OUTSIDE_IS_COLD, shortcuts.T2_WINDOW_CLOSED, shortcuts.T2_DOOR_CLOSED, {"Value-", devicesEx.TEMP_LIVING_T2, {"Global", shortcuts.TEMP_MIN_T2}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.ECO}, {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.ECO}, {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.ECO}, {"Repeat"}}) -- T > consigne ? ECO (appartement FREE) GEA.add({ shortcuts.T2_IS_FREE, {"Or",{"Value+", devicesEx.TEMP_LIVING_T2, {"Global", shortcuts.TEMP_MIN_T2}},{"Value+", devicesEx.TEMP_BEDROOM_T2, {"Global", shortcuts.TEMP_MIN_T2}}} }, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_KITCHEN_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_LIVING_T2, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_BEDROOM_T2, vd_heater_values.HG}, {"Repeat"}}) -- GESTION RADIATEURS ALPHONSE - END end -- Radiateur SDB - auto OFF quand douche éteinte GEA.add({"turnOff",devices.SDB_T2}, HEATING_CYCLE, "", {"PressButton", devicesEx.VD_HEATER_SDB_T2, vd_heater_values.HG},{"Repeat"}) -- Radiateur SDB - auto ON -- ...Quand la douche est allumée GEA.add({ shortcuts.T2_IS_BUSY, {"Time", "6:00", "23:00"}, {"turnOn",devices.SDB_T2}, -- shortcuts.OUTSIDE_IS_COLD }, 180, "", {"PressButton", devicesEx.VD_HEATER_SDB_T2, vd_heater_values.CONF}) -- Lumière living fns.autoOff({id=devicesEx.LIVING_T2, minutes=180}) -- Lumière terrasse fns.autoOff({id=devicesEx.OUTSIDE_T2, minutes=120}) fns.autoOff({id=devices.OUTSIDE_CAB, minutes=60}) if (shortcuts.AUTO_LIGHTS) then GEA.add({shortcuts.T2_IS_BUSY, {"Time", "Sunset"}}, 30, "", {"turnOn", devicesEx.OUTSIDE_T2}) GEA.add({shortcuts.T2_IS_BUSY, {"Time", "Sunset"}}, 30, "", {"turnOn", devices.OUTSIDE_CAB}) end -- Niveau supérieur -- Garage + VS -- GEA.add({"Power+", devicesEx.LIGHTS_GARAGE, 50}, 30, "Le vide sanitaire ou le garage sont allumés.") -- GESTION RADIATEURS CHALET - BEGIN if (HEATING_ON) then -- CABINET -- T < consigne pendant la nuit ? ECO GEA.add({ {"Time", "19:31","7:14"}, {"Value-", devicesEx.TEMP_CAB, {"Global", shortcuts.TEMP_MIN_CAB}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_CAB, vd_heater_values.ECO}, {"Repeat"}}) -- T > consigne pendant la nuit ? HG GEA.add({ {"Time", "19:31","7:14"}, {"Value+", devicesEx.TEMP_CAB, {"Global", shortcuts.TEMP_MIN_CAB}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_CAB, vd_heater_values.HG}, {"Repeat"}}) -- T < consigne en journée ? CONF GEA.add({ shortcuts.IAM_THERE, shortcuts.CAB_IS_BUSY, -- shortcuts.OUTSIDE_IS_COLD, {"Time", "7:15","19:30"}, {"Value-", devicesEx.TEMP_CAB, {"Global", shortcuts.CONSIGNE_CAB}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_CAB, vd_heater_values.CONF}, {"Repeat"}}) -- T > consigne ? GEA.add({ {"Or", {"Value+", devicesEx.TEMP_CAB, {"Global", shortcuts.CONSIGNE_CAB}}, shortcuts.OUTSIDE_IS_HOT, }}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_CAB, vd_heater_values.HG}, {"Repeat"}}) -- ENTRÉE -- T < consigne pendant la nuit ? ECO GEA.add({ {"Time", "21:31","6:14"}, {"Value-", devicesEx.TEMP_KITCHEN, {"Global", shortcuts.TEMP_MIN_KITCHEN}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_KITCHEN, vd_heater_values.ECO}, {"Repeat"}}) -- T > consigne pendant la nuit ? HG GEA.add({ {"Time", "21:31","6:14"}, {"Value+", devicesEx.TEMP_KITCHEN, {"Global", shortcuts.TEMP_MIN_KITCHEN}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_KITCHEN, vd_heater_values.HG}, {"Repeat"}}) -- T < consigne en journée ? CONF GEA.add({ shortcuts.IAM_THERE, shortcuts.OUTSIDE_IS_COLD, {"Time", "6:15","21:30"}, {"Value-", devicesEx.TEMP_KITCHEN, {"Global", shortcuts.CONSIGNE_KITCHEN}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_KITCHEN, vd_heater_values.CONF}, {"Repeat"}}) -- T > consigne ? GEA.add({ {"Or", {"Value+", devicesEx.TEMP_KITCHEN, {"Global", shortcuts.CONSIGNE_KITCHEN}}, shortcuts.OUTSIDE_IS_HOT, }}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_KITCHEN, vd_heater_values.HG}, {"Repeat"}}) -- CHAMBRE -- T < consigne pendant la nuit ? ECO GEA.add({ {"Time", "23:56","06:14"}, {"Value-", devicesEx.TEMP_BROOM, {"Global", shortcuts.TEMP_MIN_BROOM}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BROOM, vd_heater_values.ECO}, {"Repeat"}}) -- T > consigne pendant la nuit ? HG GEA.add({ {"Or", {"Time", "23:56","06:14"}, {"Time", "09:01","20:14"}}, {"Value+", devicesEx.TEMP_BROOM, {"Global", shortcuts.TEMP_MIN_BROOM}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BROOM, vd_heater_values.HG}, {"Repeat"}}) -- T < consigne en journée ? CONF GEA.add({ shortcuts.IAM_THERE, shortcuts.OUTSIDE_IS_COLD, {"Or", {"Time", "20:15","23:55"}, {"Time", "6:15","09:00"}}, {"Value-", devicesEx.TEMP_BROOM, {"Global", shortcuts.CONSIGNE_BROOM}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BROOM, vd_heater_values.CONF}, {"Repeat"}}) -- T > consigne ? GEA.add({ {"Or", {"Value+", devicesEx.TEMP_BROOM, {"Global", shortcuts.CONSIGNE_BROOM}}, shortcuts.OUTSIDE_IS_HOT, }}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_BROOM, vd_heater_values.HG}, {"Repeat"}}) -- DRESSING -- T < consigne pendant la nuit ? ECO GEA.add({ {"Time", "21:31","6:14"}, {"Value-", devicesEx.TEMP_DRESS, {"Global", shortcuts.TEMP_MIN_DRESS}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_DRESSING, vd_heater_values.ECO}, -- {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.ECO}, {"Repeat"}}) -- T > consigne pendant la nuit ? HG GEA.add({ {"Time", "21:31","6:14"}, {"Value+", devicesEx.TEMP_DRESS, {"Global", shortcuts.TEMP_MIN_DRESS}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_DRESSING, vd_heater_values.HG}, -- {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.HG}, {"Repeat"}}) -- T < consigne en journée ? CONF GEA.add({ shortcuts.IAM_THERE, shortcuts.OUTSIDE_IS_COLD, {"Time", "6:15","21:30"}, {"Value-", devicesEx.TEMP_DRESS, {"Global", shortcuts.CONSIGNE_DRESS}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_DRESSING, vd_heater_values.CONF}, -- {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.CONF}, {"Repeat"}}) -- T > consigne ? GEA.add({ {"Or", {"Value+", devicesEx.TEMP_DRESS, {"Global", shortcuts.CONSIGNE_DRESS}}, shortcuts.OUTSIDE_IS_HOT, }}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_DRESSING, vd_heater_values.HG}, -- {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.HG}, {"Repeat"}}) -- LIVING -- T < consigne pendant la nuit ? ECO GEA.add({ {"Time", "21:31","6:14"}, {"Value-", devicesEx.TEMP_LIVING, {"Global", shortcuts.TEMP_MIN_LIVING}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_TV, vd_heater_values.ECO}, {"PressButton", devicesEx.VD_HEATER_BABY, vd_heater_values.ECO}, {"Repeat"}}) -- T > consigne pendant la nuit ? HG GEA.add({ {"Time", "21:31","6:14"}, {"Value+", devicesEx.TEMP_LIVING, {"Global", shortcuts.TEMP_MIN_LIVING}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_TV, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_BABY, vd_heater_values.HG}, {"Repeat"}}) -- T < consigne en journée ? CONF GEA.add({ shortcuts.IAM_THERE, shortcuts.OUTSIDE_IS_COLD, {"Time", "6:15","21:30"}, {"Value-", devicesEx.TEMP_LIVING, {"Global", shortcuts.CONSIGNE_LIVING}}}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_TV, vd_heater_values.CONF}, {"PressButton", devicesEx.VD_HEATER_BABY, vd_heater_values.CONF}, {"Repeat"}}) -- T > consigne ? GEA.add({ {"Or", {"Value+", devicesEx.TEMP_LIVING, {"Global", shortcuts.CONSIGNE_LIVING}}, shortcuts.OUTSIDE_IS_HOT, }}, HEATING_CYCLE, "", { {"PressButton", devicesEx.VD_HEATER_TV, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_BABY, vd_heater_values.HG}, {"Repeat"}}) end -- Radiateur SDB - auto OFF quand douche éteinte -- GEA.add({"turnOff",devices.SDB_SHOWER}, HEATING_CYCLE, "", {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.HG},{"Repeat"}) GEA.add({"turnOff",devices.SDB_SHOWER}, 60*15, "", {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.HG},{"Repeat"}) -- Radiateur SDB - auto OFF après 20 minutes -- ne fonctionne pas... -- GEA.add({vd_heater_values.CONF,devicesEx.VD_HEATER_SDB}, 60*1, "", {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.HG}) -- Radiateur SDB - auto ON -- ...Quand la douche est allumée GEA.add({ shortcuts.IAM_THERE, {"Time", "6:00", "23:30"}, devices.SDB_SHOWER -- shortcuts.OUTSIDE_IS_COLD }, 120, "", {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.CONF}, {"Repeat"}) -- ...à 7:30 heures du matin quand il fait froid GEA.add({ shortcuts.IAM_THERE, {"Time", "7:45"}, shortcuts.OUTSIDE_IS_COLD }, 30, "", {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.ECO}) -- ...et on éteint à 9:00 si la SDB est OFF GEA.add({ {"Time", "8:45"}, {"turnOff", devices.SDB_SHOWER}}, 30, "", {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.HG}) -- Minimote BLACK --[[GEA.add( shortcuts.REQ_MM_BLACK_1, -1 , "", {{"turnOn",devices.HUE_SOFA}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_3, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_5, -1 , "", {{"Switch",devices.OUTSIDE}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_7, -1 , "", {{"Scenario",scenes.ALL_OFF}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_2, -1 , "", {{"turnOff",devices.HUE_SOFA}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_4, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_6, -1 , "", {{"Switch",scenes.OUTSIDE}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_8, -1 , "", {{"Scenario",scenes.ALL_OFF}, shortcuts.RESET_MM_BLACK} )--]] local wiki=function(id,value) net.HTTPClient():request('https://wiki-pad.net/gandalf/$stories/'..id..'/'..value,{options={ method="GET", checkCertificate = false }}); end -- metricAlert() --[[GEA.add( shortcuts.REQ_MM_BLACK_1, -1 , "", {{"Function", function() wiki('personnage','terminator') end}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_3, -1 , "", {{"Function", function() wiki('personnage','jackson') end}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_5, -1 , "", {{"Function", function() wiki('personnage','marilyn') end}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_7, -1 , "", {{"Function", function() wiki('personnage','elvis') end}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_2, -1 , "", {{"Function", function() wiki('ville','sydney') end}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_4, -1 , "", {{"Function", function() wiki('ville','paris') end}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_6, -1 , "", {{"Function", function() wiki('ville','moscou') end}, shortcuts.RESET_MM_BLACK} ) GEA.add( shortcuts.REQ_MM_BLACK_8, -1 , "", {{"Function", function() wiki('ville','vegas') end}, shortcuts.RESET_MM_BLACK} -- Minimote WHITE GEA.add( shortcuts.REQ_MM_WHITE_1, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_WHITE_3, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_WHITE_5, -1 , "", {{"Switch",devices.OUTSIDE}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_WHITE_7, -1 , "", {{"Scenario",scenes.ALL_OFF}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_WHITE_2, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_WHITE_4, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_WHITE_6, -1 , "", {{"Switch",devices.OUTSIDE}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_WHITE_8, -1 , "", {{"Scenario",scenes.ALL_OFF}, shortcuts.RESET_MM_WHITE} )--]] -- Minimote BLACK GEA.add( shortcuts.REQ_MM_BLACK_1, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_BLACK_3, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_BLACK_5, -1 , "", {{"Switch",devices.OUTSIDE}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_BLACK_7, -1 , "", {{"Scenario",scenes.ALL_OFF}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_BLACK_2, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_BLACK_4, -1 , "", {{"Switch",devices.PLUG_KITCHEN}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_BLACK_6, -1 , "", {{"Switch",devices.OUTSIDE}, shortcuts.RESET_MM_WHITE} ) GEA.add( shortcuts.REQ_MM_BLACK_8, -1 , "", {{"Scenario",scenes.ALL_OFF}, shortcuts.RESET_MM_WHITE} )--]] -- GLOBAL REQUESTS -- Extinction générale GEA.add( shortcuts.REQ_ALL_OFF, -1 , "", {{"Function", function() fns.resetRequests() fns.allOff() end}} ) -- Ouverture des stores GEA.add( shortcuts.REQ_OPEN_SHUTTERS, -1 , "", {{"Function", function() fns.resetRequests() fibaro:setGlobal ("SHUTTERS_CLOSED", "0") fibaro:call(devicesEx.SHUTTERS_OPEN,"turnOn") end}} ) -- Fermeture des stores GEA.add( shortcuts.REQ_CLOSE_SHUTTERS, -1 , "", {{"Function", function() fns.resetRequests() fibaro:setGlobal ("SHUTTERS_CLOSED", "1") fibaro:call(devicesEx.SHUTTERS_CLOSE,"turnOn") end}} ) -- Fermeture des stores - notification GEA.add( shortcuts.REQ_NCLOSE_SHUTTERS, -1 , "", {{"Function", function() fns.resetRequests() metricAlert({ frames = { { icon = 23011, text = " BYE" }, -- { icon = 9219, text = " MOUVEMENT DANS L'ESCALIER EXTERIEUR !!!" }, }, sound = { category = "notifications", id = "win2", }, }) end}} ) -- Ouverture des velux GEA.add( shortcuts.REQ_OPEN_VELUX, -1 , "", {{"Function", function() fns.resetRequests() fibaro:setGlobal ("VELUX_CLOSED", "0") if tonumber(fibaro:getValue(devicesEx.TEMP_OUTSIDE, "value"))>2 then fibaro:call(devicesEx.VELUX_OPEN,"turnOn") end end}} ) -- Fermeture des velux GEA.add( shortcuts.REQ_CLOSE_VELUX, -1 , "", {{"Function", function() fns.resetRequests() fibaro:setGlobal ("VELUX_CLOSED", "1") if tonumber(fibaro:getValue(devicesEx.TEMP_OUTSIDE, "value"))>2 then fibaro:call(devicesEx.VELUX_CLOSE,"turnOn") end end}} ) -- Stores - fermeture interactive --[[GEA.add({ shortcuts.CONFIRM_BEFORE_CLOSING_SHUTTERS,shortcuts.SHUTTERS_ARE_OPEN, {"Time+", "20:00"}, {"Or",{"Time", "Sunset+180"},{"Time", "23:00"}}}, 60*10 , "", { shortcuts.ACTION_CLOSE_SHUTTERS, { "Ask", {140, 161}, "Repousser la fermeture des stores ?", scenes.ACTION_CLOSE_SHUTTERS }})--]] -- Stores - fermeture quand terrasse éteinte GEA.add({ shortcuts.SHUTTERS_ARE_OPEN, {"Time", "Sunset+40","Sunset+360"}, {"turnOff", devices.OUTSIDE}}, 60 *5 , "", { shortcuts.REQ_CLOSE_SHUTTERS}) -- Stores - fermeture quand terrasse éteinte - notification GEA.add({ shortcuts.SHUTTERS_ARE_OPEN, {"Time", "Sunset+40","Sunset+360"}, {"turnOff", devices.OUTSIDE}}, 60 *4 , "", { shortcuts.REQ_NCLOSE_SHUTTERS}) -- Fermeture des stores à 1:00 au plus tard GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_OPEN,{"Time", "1:00","3:00"}}, 30 , "", shortcuts.REQ_CLOSE_SHUTTERS) -- Fermeture des stores 10 minutes après la demande de confirmation --[[GEA.add({ shortcuts.REQ_IS_AVAILABLE, shortcuts.CONFIRM_BEFORE_CLOSING_SHUTTERS,shortcuts.SHUTTERS_ARE_OPEN, shortcuts.ACTION_CLOSE_SHUTTERS}, 600 , "", { {"Global", shortcuts.ACTION_PENDING, "0"}, shortcuts.REQ_CLOSE_SHUTTERS})--]] -- Stores - fermeture automatique si AUTO_CLOSING_SHUTTERS GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.AUTO_CLOSING_SHUTTERS,shortcuts.SHUTTERS_ARE_OPEN,{"Time", "Sunset+40","Sunset+360"}}, 30 , "", shortcuts.REQ_CLOSE_SHUTTERS) -- Stores - ouverture automatique GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_7,{"Time","7:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_8,{"Time","8:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_9,{"Time","9:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_10,{"Time","10:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) -- GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_11,{"Time","11:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_7,{"Time","7:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_8,{"Time","8:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_9,{"Time","9:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_10,{"Time","10:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) -- GEA.add({shortcuts.IAM_THERE,shortcuts.REQ_IS_AVAILABLE,shortcuts.SHUTTERS_ARE_CLOSED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_11,{"Time","11:00", "11:00"}}, 120 , "", shortcuts.REQ_OPEN_SHUTTERS) -- Velux - ouverture et fermeture automatique -- GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_OPEN,{"Days", "Friday", "Saturday"},{"Time", "Sunset+40"}}, 30 , "", shortcuts.REQ_CLOSE_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_OPEN,{"Or",{"Time", "Sunset+50", "Sunset+360"},shortcuts.OUTSIDE_IS_VERY_HOT}}, 30 , "", shortcuts.REQ_CLOSE_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_7,{"Time","7:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_8,{"Time","8:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_9,{"Time","9:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_10,{"Time","10:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) -- GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekDays"},shortcuts.OPEN_HOUR_WD_11,{"Time","11:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_7,{"Time","7:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_8,{"Time","8:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_9,{"Time","9:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_10,{"Time","10:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) -- GEA.add({shortcuts.REQ_IS_AVAILABLE,shortcuts.VELUX_ARE_CLOSED,shortcuts.VELUX_CAN_BE_OPENED,{"Days", "WeekEnd"},shortcuts.OPEN_HOUR_WE_11,{"Time","11:05", "12:00"}}, 120 , "", shortcuts.REQ_OPEN_VELUX) -- Fermeture cabinet GEA.add({{"Days", "WeekDays"},{"Time", "20:30"}}, 30 , "", {"turnOn", devicesEx.CAB_CLOSE}) GEA.add({{"Days", "WeekEnd"},{"Time", "12:30"}}, 30 , "", {"turnOn", devicesEx.CAB_CLOSE}) -- Démarrage de Plex le soir : on tamise le living --[[GEA.add({shortcuts.LIVING_IS_ON,{"Time", "19:00", "6:00"}, {"Global", "PlexTV", "1"}}, -1, "", { {"turnOn",{devices.HUE_BUFFET, devices.HUE_CHEM}}, {"turnOff",{devices.HUE_SOFA, devices.HUE_BD, devices.HUE_DESKTOP, devices.BABY_FOOT}}, {"Hue", devices.HUE_BUFFET, "bri", 100}, {"Hue", devices.HUE_CHEM, "bri", 100}, } ) -- Arrêt de Plex le soir : on réallume les Hues GEA.add({shortcuts.LIVING_IS_ON,{"Time", "19:00", "6:00"}, {"Global", "PlexTV", "0"}}, -1, "", { {"turnOn",{devices.HUE_SOFA,devices.HUE_BUFFET,devices.HUE_BD,devices.HUE_CHEM}}, {"Hue", devices.HUE_SOFA, "bri", 150}, {"Hue", devices.HUE_BUFFET, "bri", 250}, {"Hue", devices.HUE_CHEM, "bri", 250}, {"Hue", devices.HUE_BD, "bri", 250}, } )--]] -- Extinction des Hues après micro coupure --[[GEA.add({ {"Hue", devices.HUE_SOFA_CAB, "on", 1}, {"Hue", devices.HUE_SOFA, "on", 1}, {"Hue", devices.HUE_CHEM, "on", 1}, {"Hue", devices.HUE_BUFFET, "on", 1}}, 30, "", {"turnOff", { devices.HUE_ALL } } )--]] -- Lumière garde-manger fns.onMotion({sensor=devicesEx.EYE_FOOD, id=devices.FOOD, minutes=5}) -- Lumière BABY_FOOT fns.autoOff({id=devices.BABY_FOOT, minutes=3*60}) GEA.add({"turnOff", devices.BABY_FOOT}, -1, "", {"turnOff", devices.PLUG_COMICS} ) GEA.add({"turnOn", devices.BABY_FOOT}, -1, "", {"turnOn", devices.PLUG_COMICS} ) -- Allumage HUE_DESKTOP si HUE_SOFA ON -- GEA.add({"Hue", devices.HUE_SOFA, "on", 1}, 30, "", {"turnOn", devices.HUE_DESKTOP} ) -- Extinction HUE_DESKTOP si HUE_SOFA OFF -- GEA.add({"Hue", devices.HUE_SOFA, "on", 0}, 30, "", {"turnOff", devices.HUE_DESKTOP} ) -- Lumière entrée (PLUG) fns.onMotion({sensor=devicesEx.EYE_KITCHEN, id=devices.PLUG_KITCHEN, minutes=10, condition={{ "turnOff", devices.PLUG_KITCHEN}, {"Time", "22:00", "10:00"} }}) fns.onMotion({sensor=devicesEx.EYE_KITCHEN, id=devices.PLUG_KITCHEN, minutes=60, condition={shortcuts.LUX_KITCHEN_IS_WEAK,{ "turnOff", devices.PLUG_KITCHEN}, {"Time", "17:00", "21:59"} }}) -- Lumière entrée (plafonnier) -- fns.onMotion({sensor=devicesEx.EYE_KITCHEN, id=devices.KITCHEN, minutes=5, condition={shortcuts.LUX_KITCHEN_IS_WEAK}}) -- Allumage initial entrée selon LUX en journée -- fns.autoOn({id=devices.PLUG_KITCHEN, minutes=60, condition={shortcuts.PERIOD_WORKING_TIME, shortcuts.LUX_KITCHEN_IS_WEAK}}) -- Extinction auto cuisine fns.autoOff({id=devices.PLUG_KITCHEN, minutes=60}) -- fns.autoOff({id=devices.KITCHEN, minutes=20}) -- Allumage PLUG_KITCHEN si KITCHEN ON -- GEA.add({"turnOn", devices.KITCHEN}, -1, "", {"turnOn", devices.PLUG_KITCHEN} ) -- Extinction PLUG_KITCHEN si KITCHEN OFF -- GEA.add({"turnOff", devices.KITCHEN}, -1, "", {"turnOff", devices.PLUG_KITCHEN} ) -- Sonos cuisine - informations du matin --[[GEA.add({shortcuts.HOLIDAYS_MODE_IS_OFF,{"Global", "SONOS_KITCHEN", "0"},{"Days", "WeekDays"},{"Time", "7:00", "9:00"},devicesEx.EYE_KITCHEN}, -1 , "", {{"Function", function() -- local state = fibaro:getValue(devicesEx.SONOS_KITCHEN,'state') -- fibaro:debug("SONOS STATE : "..state) fibaro:setGlobal("SONOS_KITCHEN", "1") fibaro:call(devicesEx.SONOS_KITCHEN, "setVolume", "15") fibaro:call(devicesEx.SONOS_KITCHEN, "play") end}} ) GEA.add({"Time", "9:00"}, 30 , "", {"Global", "SONOS_KITCHEN", "0"})--]] -- Mouvement escalier en bas GEA.add({ shortcuts.PERIOD_OVERNIGHT, {"turnOff", devices.OUTSIDE_CAB}, devicesEx.EYE_OUTSIDE}, -1, "", {{"Function", function() fibaro:call(devices.OUTSIDE_CAB, "turnOn") setTimeout(function() fibaro:call(devices.OUTSIDE_CAB, "turnOff") end, 300000) end}} ) -- Mouvement escalier en bas quand volets fermés GEA.add({ {"global", shortcuts.SOMEBODY_THERE, "0"}, shortcuts.SHUTTERS_ARE_CLOSED, {"turnOff", devices.OUTSIDE_CAB}, devicesEx.EYE_OUTSIDE}, -1, "", {{"global", shortcuts.SOMEBODY_THERE, "1"}, {"Function", function() fibaro:call(devices.OUTSIDE_CAB, "turnOn") setTimeout(function() fibaro:call(devices.OUTSIDE_CAB, "turnOff") end, 300000) setTimeout(function() fibaro:setGlobal (shortcuts.SOMEBODY_THERE, "0") end, 180000) end}} ) -- Mouvement escalier en bas quand volets ouverts GEA.add({{"global", shortcuts.SOMEBODY_THERE, "0"}, shortcuts.SHUTTERS_ARE_OPEN, devicesEx.EYE_OUTSIDE}, -1, "", {{"global", shortcuts.SOMEBODY_THERE, "1"}, {"Function", function() -- fibaro:setGlobal (shortcuts.SOMEBODY_THERE, "1") if fibaro:getGlobalValue("SONOS_ALARM") == "1" then metricAlert({ frames = { { icon = 2899, text = " ALERTE" }, -- { icon = 9219, text = " MOUVEMENT DANS L'ESCALIER EXTERIEUR !!!" }, }, sound = { category = "notifications", id = "positive"..math.random(1,6), }, }) elseif fibaro:getGlobalValue("SONOS_ALARM") == "666" then local getSonosObject = function ( id ) local o = { id = id, playing = false, play = function ( this ) if this.playing == true then fibaro:call(this.id, "setVolume", 0) else fibaro:call(this.id, "setVolume", 25) fibaro:call(this.id, "play") end end, restore = function ( this ) fibaro:call(this.id, "setVolume", this.volume) if this.playing == false then fibaro:call(this.id, "pause") end end } o.playing = fibaro:getValue(id, "state") == "PLAYING" o.volume = fibaro:getValue(id, "volume") return o end local KITCHEN = getSonosObject (devicesEx.SONOS_KITCHEN) local LIVING = getSonosObject (devicesEx.SONOS_LIVING) KITCHEN:play ( ) LIVING:play ( ) setTimeout(function() KITCHEN:restore ( ) LIVING:restore ( ) end, 10000) else fibaro:call(devicesEx.BELL, "turnOn") -- setTimeout(function() -- fibaro:call(devicesEx.BELL, "turnOn") -- end, 4000) end setTimeout(function() fibaro:setGlobal (shortcuts.SOMEBODY_THERE, "0") end, 120000) end}} ) GEA.add({"time","23:00"}, 30, "",{"global", shortcuts.SOMEBODY_THERE, "-1"} ) GEA.add({"time","7:00"}, 30, "",{"global", shortcuts.SOMEBODY_THERE, "0"} ) -- lumières extérieures fns.autoOff({id=devices.OUTSIDE, minutes=180, condition={{"turnOn", devices.OUTSIDE},{"time","17:00","8:00"}}}) fns.autoOff({id=devices.OUTSIDE, minutes=1, condition={{"turnOn", devices.OUTSIDE},{"time","8:01","17:01"}}}) if (shortcuts.AUTO_LIGHTS) then GEA.add({ {"Time", "Sunset-15"}}, 30, "", {"turnOn", devices.OUTSIDE}) end -- Lumière dressing+couloir WC -- fns.autoOff({id=devices.WC, minutes=10}) -- Lumière dressing fns.autoOff({id=devices.DRESSING, minutes=30}) -- Si le plafonnier du dressing est OFF, on éteint tout le dressing -- GEA.add({"turnOff", devices.DRESSING}, 30, "", {"turnOff", devices.WC} ) -- Extinction SDB si dressing OFF GEA.add({{"turnOff", devices.DRESSING}, {"Or", {"turnOn", devices.SDB_SHOWER}, {"turnOn", devices.SDB}}}, 60*15, "",{"turnOff", {devices.SDB, devices.SDB_SHOWER} } ) -- Allumage dressing si douche SDB ON GEA.add({"turnOn", devices.SDB_SHOWER}, 90, "",{"turnOn", devices.DRESSING } ) -- Allumage dressing SEB & SABINE si douche dressing ON GEA.add({{"turnOn", devices.DRESSING},{"time","6:00","23:00"}}, -1, "",{"turnOn", {devices.DRESS_SEB,devices.DRESS_BIN} } ) GEA.add({"turnOff", devices.DRESSING}, -1, "",{"turnOff", {devices.DRESS_SEB,devices.DRESS_BIN} } ) -- GEA.add({{"turnOn", devices.WC}}, -1, "",{"turnOn", devices.DRESSING } ) local turnOnSDB = function() setTimeout(function() fibaro:call(devicesEx.VD_HEATER_SDB, "pressButton", vd_heater_values.CONF) -- extinction après 15 minutes setTimeout(function() fibaro:call(devicesEx.VD_HEATER_SDB, "pressButton", vd_heater_values.HG) end, 1000 *60 *15) metricAlert({ frames = { { icon = 40847, text = " SÈCHE SERVIETTES ALUMÉ !" }, }, sound = { category = "notifications", id = "notification3", }, }) end) end GEA.add({{"Time", "07:00", "18:59"}, {"Switch", devicesEx.SUN_SWITCH}}, -1, "",{{"Function", function() local SHUTTERS_CLOSED = fibaro:getGlobalValue("SHUTTERS_CLOSED") == "1" if SHUTTERS_CLOSED then setTimeout(function() fibaro:setGlobal ("GLOBAL_REQUEST", "SUP") end, 1000) end if fibaro:getGlobalValue("VELUX_CLOSED") == "1" then setTimeout(function() fibaro:setGlobal ("GLOBAL_REQUEST", "VUP") end, 5000) end if (SHUTTERS_CLOSED) then metricAlert({ frames = { { icon = 36955, text = " HELLO!" }, }, sound = { category = "notifications", id = "notification3", }, }) else turnOnSDB() end end}} ) GEA.add({{"Time", "19:00", "02:00"}, {"Switch", devicesEx.SUN_SWITCH}}, -1, "",{{"Function", function() local SHUTTERS_OPEN = fibaro:getGlobalValue("SHUTTERS_CLOSED") == "0" if SHUTTERS_OPEN then setTimeout(function() fibaro:setGlobal ("GLOBAL_REQUEST", "SDOWN") end, 20000) end if fibaro:getGlobalValue("VELUX_CLOSED") == "0" then setTimeout(function() fibaro:setGlobal ("GLOBAL_REQUEST", "VDOWN") end, 30000) end --if (SHUTTERS_OPEN) then setTimeout(function() fns.allOff() end, 60000) metricAlert({ frames = { { icon = 23011, text = " BYE !" }, }, sound = { category = "notifications", id = "notification4", }, }) --else --turnOnSDB() --end end}} ) -- Lumières SDB fns.autoOff({id=devices.SDB, minutes=30}) fns.autoOff({id=devices.SDB_SHOWER, minutes=30}) -- Lumières SDB Alphonse fns.autoOff({id=devices.SDB_T2, minutes=30}) -- VMC SDB - auto ON selon horaires local sheduledVmc = fns.autoOn({id=devices.VMC, minutes=1, condition={ "Or",{"Time", "10:00", "12:00"},{"Time", "16:00", "18:00"}}}) -- VMC SDB haut - auto OFF selon horaires GEA.add( {{ "Or", {"Time", "10:00", "12:00"}, {"Time", "16:00", "18:00"}, }, {"turnOff", devices.SDB_SHOWER}}, 5*60, "", {{"Inverse"}, {"turnOff", devices.VMC }} ) -- VMC SDB haut - auto ON si lumière douche allumée fns.autoOn({id=devices.VMC, minutes=3, condition={"turnOn", devices.SDB_SHOWER}}) -- VMC SDB haut - auto OFF si lumière douche éteinte GEA.add({"turnOff", devices.SDB_SHOWER}, 5*60, "", {{"turnOff", devices.VMC}, { "RestartTask", sheduledVmc }} ) -- Lumières HUE - auto OFF fns.autoOff({id=devices.HUE_SOFA, minutes=180, hue=true}) fns.autoOff({id=devices.HUE_BUFFET, minutes=180, hue=true}) fns.autoOff({id=devices.HUE_CHEM, minutes=180, hue=true}) fns.autoOff({id=devices.HUE_TV, minutes=180, hue=true}) fns.autoOff({id=devices.HUE_DESKTOP, minutes=60, hue=true}) fns.autoOff({id=devices.HUE_MEZ, minutes=120, hue=true}) fns.autoOff({id=devices.HUE_BUANDRIE, minutes=60, hue=true}) fns.autoOff({id=devices.HUE_STAIRS, minutes=3, hue=true}) fns.autoOff({id=devices.HUE_CAB, minutes=45, hue=true}) fns.autoOff({id=devices.HUE_SOFA_CAB, minutes=120, hue=true}) fns.autoOff({id=devices.HUE_BROOM, minutes=20, hue=true}) -- Plug comics - auto OFF fns.autoOff({id=devices.PLUG_COMICS, minutes=120}) -- Plug living - auto OFF fns.autoOff({id=devices.PLUG_LIVING, minutes=60}) -- Plug cabinet - auto OFF -- fns.autoOff({id=devices.PLUG_CAB, minutes=120}) -- Plug DOLL - auto OFF fns.autoOff({id=devices.PLUG_DOLL, minutes=240}) -- RGB cabinet - auto OFF fns.autoOff({id=devices.RGB_CAB, minutes=180}) -- Allumage de la RGB_CAB si buffet allumé fns.autoOn({id=devices.RGB_CAB, minutes=3, condition={{"Hue", devices.HUE_STAIRS, "on", 1}}}) -- Allumage de la DOLL entre 20 heures et 23 heures si buffet allumé fns.autoOn({id=devices.PLUG_DOLL, minutes=1, condition={{"Hue", devices.HUE_BUFFET, "on", 1}, {"Time", "20:00", "23:00"}}}) -- Extinction de la DOLL si le buffet est éteint fns.autoOff({id=devices.PLUG_DOLL, minutes=1, condition={"Hue", devices.HUE_BUFFET, "on", 0}}) -- TV chambre - auto OFF fns.autoOff({id=devicesEx.PLUG_TV, minutes=240}) -- Allumage initial des lumières le soir à Sunset if (shortcuts.AUTO_LIGHTS) then GEA.add( { shortcuts.IAM_THERE, {"Time", "Sunset-15"}, -- {"Value-", devicesEx.LUX_BEDROOM, 20} }, 30, "", { {"turnOn", {devices.PLUG_KITCHEN,devices.PLUG_COMICS, devices.HUE_BUFFET, devices.HUE_CHEM}}, {"Hue", devices.HUE_BUFFET, "bri", 150}, {"Hue", devices.HUE_TV, "bri", 150}, {"Hue", devices.HUE_CHEM, "bri", 150}, } ) end -- Ajustement à SUNSET-30M si HUE_SOFA ou HUE_BUFFET sont allumés GEA.add( { {"Time", "Sunset"}, shortcuts.LIVING_IS_ON }, 30, "", { {"Hue", devices.HUE_CHEM, "bri", 250}, {"Hue", devices.HUE_TV, "bri", 250}, {"Hue", devices.HUE_BUFFET, "bri", 250}, } ) -- Global OFF - 01:30 GEA.add( {"Time", "01:30"}, 30 , "", {{"Function", function() fns.resetRequests() fns.allOff() end}, {"PressButton", devicesEx.VD_HEATER_SDB, vd_heater_values.HG}, {"PressButton", devicesEx.VD_HEATER_SDB_T2, vd_heater_values.HG}, {"turnOff", devicesEx.OUTSIDE_T2}, {"turnOff", devicesEx.LIVING_T2}, } ) -- GEA.add({{"Weather!", "Temperature" ,""},{"WeatherLocal!",""}}, 30, "", {"SonosTTS", devices.SONOS, 28, "Nous sommes le #datefull# il fait dehors #value[1]# degrer et le temps est #value[2]#", 100}) -- GEA.add( {"Hue", devices.HUE_SOFA, "on", 1}, 30, "", {"SonosTTS", devices.SONOS, 28, "Extinction des feux", 50} ) -- GEA.add(true, 30, "La température ext. est de {WeatherLocal, Temperature}° - météo : {WeatherLocal}") --]] -- -------------------------------------------------------- -- FIN DU CODE UTILISATEUR -- -------------------------------------------------------- end 2 1
sebcbien Posté(e) le 28 octobre 2021 Auteur Signaler Posté(e) le 28 octobre 2021 Génial ! Merci, quel code, c'est énorme ! Je te suggère de passer tout le code dans une fenêtre "code" pour plus de lisibilité Exemple: Utilise le type de code "LUA" @Lazer, peux-tu effacer ce message une fois que ce sera fait ? histoire de ne pas polluer le fil :-) local heatingConf = { T2 = { LABEL = "ALPHONSE", TID = devicesEx.THERMOSTAT_T2, T = devicesEx.TEMP_LIVING_T2, TMAX = shortcuts.TEMP_MAX_T2, TMIN = shortcuts.TEMP_MIN_T2, C = shortcuts.CONSIGNE_T2, VDS = {devicesEx.VD_HEATER_KITCHEN_T2, devicesEx.VD_HEATER_LIVING_T2, devicesEx.VD_HEATER_BEDROOM_T2}, PRECOND = function () return tonumber(fibaro:getGlobalValue(shortcuts.ALPHONSE_BUSY)) == 1 and tonumber(fibaro:getGlobalValue(shortcuts.T2_DOOR)) == 0 and tonumber(fibaro:getGlobalValue(shortcuts.T2_WINDOW)) == 0 end, POSTFUNC = function (consigne) fibaro:setGlobal(shortcuts.TEMP_MIN_T2, consigne-2) end, }, CAB = { LABEL = "CABINET", TID = devicesEx.THERMOSTAT_CAB, T = devicesEx.TEMP_CAB, TMAX = shortcuts.TEMP_MAX_CAB, TMIN = shortcuts.TEMP_MIN_CAB, C = shortcuts.CONSIGNE_CAB, VDS = {devicesEx.VD_HEATER_CAB}, }, KITCHEN = { LABEL = "CUISINE", TID = nil, T = devicesEx.TEMP_KITCHEN, TMAX = shortcuts.TEMP_MAX_KITCHEN, TMIN = shortcuts.TEMP_MIN_KITCHEN, C = shortcuts.CONSIGNE_KITCHEN, VDS = {devicesEx.VD_HEATER_KITCHEN}, }, DRESS = { LABEL = "DRESSING", TID = devicesEx.THERMOSTAT_DRESS, T = devicesEx.TEMP_DRESS, TMAX = shortcuts.TEMP_MAX_DRESS, TMIN = shortcuts.TEMP_MIN_DRESS, C = shortcuts.CONSIGNE_DRESS, VDS = {devicesEx.VD_HEATER_DRESSING,devicesEx.VD_HEATER_SDB}, }, BROOM = { LABEL = "CHAMBRE", TID = nil, T = devicesEx.TEMP_BROOM, TMAX = shortcuts.TEMP_MAX_BROOM, TMIN = shortcuts.TEMP_MIN_BROOM, C = shortcuts.CONSIGNE_BROOM, VDS = {devicesEx.VD_HEATER_BROOM}, }, LIVING = { LABEL = "SALON", TID = devicesEx.THERMOSTAT_LIVING, T = devicesEx.TEMP_LIVING, TMAX = shortcuts.TEMP_MAX_LIVING, TMIN = shortcuts.TEMP_MIN_LIVING, C = shortcuts.CONSIGNE_LIVING, VDS = {devicesEx.VD_HEATER_TV,devicesEx.VD_HEATER_BABY}, } } local metricAlert=function( model ) -- fibaro:debug("metricAlert !!!!!") -- local messages = {"alerte:quelqu'un est dans l'escalier !"} -- local message = messages[math.random(#messages)] -- local alarms = {"alarm10","alarm12","alarm13"} -- local alarm = alarm[math.random(#alarms)] net.HTTPClient():request("http://" .. '192.168.1.23' .. ":8080/api/v2/device/notifications", {options = { method = 'POST', headers = { ['Content-Type'] = 'application/json', ['Authorization'] = 'Basic ' .. 'xxxxxxxxxxxxxxxx=', }, data = json.encode( { --icon_type = "alert", priority = "critical", model = model, cycles = 30 / 4.5 }) }, }) end local fns fns = { updateHeaters = function (conf) local consigne = tonumber(fibaro:getGlobalValue(conf.C)) if conf.PRECOND == nil then conf.PRECOND = function () return true end end if conf.PRECOND() then local T = tonumber(fibaro:getValue(conf.T, "value")) local value = vd_heater_values.CONF local text = " " .. conf.LABEL if T > consigne then value = vd_heater_values.HG end for _,v in ipairs(conf.VDS) do fibaro:call(v, "pressButton",value) end end end, updateConsigne = function (conf) local max = tonumber(fibaro:getGlobalValue(conf.TMAX)) local min = tonumber(fibaro:getGlobalValue(conf.TMIN)) local consigne if conf.TID == nil then consigne = tonumber(fibaro:getGlobalValue(conf.C)) if consigne > max then consigne = max end if consigne < min then consigne = min end else consigne = tonumber(fibaro:getValue(conf.TID, "value")) if consigne > max then consigne = max end if consigne < min then consigne = min end consigne = consigne -0.5 end fibaro:setGlobal(conf.C, consigne) if conf.POSTFUNC then conf.POSTFUNC (consigne) end fns.updateHeaters (conf) local T = tonumber(fibaro:getValue(conf.T, "value")) local text = "··· THERMOSTAT " .. conf.LABEL if T > consigne then text = text .. " : HG ··· consigne : " .. consigne .. " °C ··· temperature : " .. T .. " °C ··· HG" else text = text .. " : ON ··· consigne : " .. consigne .. " °C ··· temperature : " .. T .. " °C ··· ON" end metricAlert({ frames = { -- { icon = 7431, text = text }, { text = text }, }, }) end, resetRequests = function () fibaro:setGlobal ("GLOBAL_REQUEST", "0") -- fibaro:setGlobal ("ACTION_PENDING", "0") end, idFromNumber = function (number) local result = "UNKNOWN" for k,v in pairs(devices) do if v == number then result = k end end return result end, allOff = function () for k,v in pairs(devices) do fibaro:call(v, "turnOff") fibaro:sleep(100) end end, auto = function (operation, params) local seconds = 30 local deviceCond = params.id local deviceAction = {operation, params.id} if params.hue == true then deviceCond = {"Hue", params.id, "on", 1} if operation == "turnOff" then deviceCond = {"Hue", params.id, "on", 0} else deviceCond = {"Hue", params.id, "on", 1} end end if params.minutes then seconds = params.minutes *60 end return GEA.add(params.condition or deviceCond, seconds, "", deviceAction) end, autoOff = function (params) return fns.auto ("turnOff", params) end, autoOn = function (params) return fns.auto ("turnOn", params) end, onMotion = function (params) local c = { params.sensor } if params.condition then for _, v in pairs(params.condition) do table.insert (c, v) end end fns.autoOff({id=params.id,minutes=params.minutes,hue=params.hue}) GEA.add(params.sensor, -1, "", { "RestartTask", fns.autoOff({id=params.id,minutes=params.minutes,hue=params.hue}) } ) fns.autoOn({id=params.id,condition=c,minutes=-1/60,hue=params.hue}) end, }
flacon030 Posté(e) le 8 janvier 2022 Signaler Posté(e) le 8 janvier 2022 voici ma petite configuration de gea essentiellement pour la gestion de la climatisation -- ========================================================== -- Règles utilisateur -- ========================================================== local id = { WEATHER = 3, SENSOR_CH2 = 271, SENSOR_2_CH2 = 278, SENSOR_CH1 = 397, SENSOR_SALON = 293, SENSOR_ENTREE = 301, SENSOR_BUREAU = 309, SENSOR_CELLIER = 305, SENSOR_CUISINE = 297, CONTROL_CLIM_SALON = 287, CONTROL_CLIM_CH2 = 281, --CONTROL_CLIM_CH1 = 392, --zxt120 ghis CONTROL_CLIM_CH1 = 534, CONTROL_CLIM_BUREAU = 51, ECL_ENTREE = 165, ECL_EXT_ENTREE = 166, ECL_TV_SALON = 64, ECL_APPLIQUE_CH1 = 359, ECL_SPOTS_CH1 = 353, ECL_LIT_CH2 = 148, ECL_DRESSING_CH2 = 142, ECL_ETAGERE_CH2 = 223, ECL_JARDIN = 1, ECL_ALLEE = 1, ECL_GARAGE = 100, ECL_BAIN = 136, ECL_COULOIR = 347, ECL_ECALIER = 94, ECL_ATELIER = 110, ECL_CREDANCE = 154, ECL_JARDIN_ALLEE = 328, ECL_JARDIN_OLIVIERS = 251, ECL_JARDIN_CARPORT = 250, ECL_SPA = 448, ECL_BALCON = 505, SECHE_SERVIETTE = 175, PILOT_SERVIETTE = 168, DIM_CUISINE = 180, DIM_TABLE = 120, DIM_CANAPE = 130, DIM_SPOT_TC = 159, RGBW_SALON = 203, RGBW_CH2 = 185, MO_TEMP_SALON = 340, MO_SENSOR_SALON = 339, MO_LUX_SALON = 341, MO_TEMP_CH1 = 198, MO_SENSOR_CH1 = 197, MO_LUX_CH1 = 199, MO_TEMP_CH2 = 412, MO_SENSOR_CH2 = 411, MO_LUX_CH2 = 413, MO_SENSOR_ALLEE = 253, MO_TEMP_ALLEE =254, MO_LUX_ALLEE = 255, MO_SENSOR_ENTREE = 241, MO_TEMP_ENTREE = 242, MO_LUX_ENTREE = 243, ROLLER_CH1 = 233, ROLLER_CH2 = 228, ROLLER_DRESSING = 218, ROLLER_STORE = 238, ROLLER_GARAGE = 113, EV_JARDIN = 418, EV_JARDIN_2 = 420, NAT_TEMP_CH2 = 30, NAT_HYDRO_CH2 = 29, NAT_CO2_CH2 = 27, NAT_NOISE_CH2 = 28, NAT_PRESS_JARDIN = 26, NAT_TEMP_JARDIN = 37, NAT_HYDRO_JARDIN = 36, NAT_TEMP_SB = 47, NAT_HYDRO_SB = 46, NAT_CO2_SB = 45, WALP_MULTIP2_SALON = 337, WALP_BUREAU_CH2 = 210, WALP_YAMAHA_SALON = 335, WALP_BUREAU_EMAES = 315, WALP_HOMECINE_CH2 = 212, WALP_TV_CH2 = 214, WALP_CHAUFFE_EAU = 80, WALP_BUREAU_CH1 = 331, WALP_TV_CH1 = 333, WALP_POELE = 486, T_SMOKE_ENTREE = 346, -- BOUTON_1_CHAMBRE = 362, -- BOUTON_2_CHAMBRE = 361, CONSO_CLIM = 82, CONSO_CUISINE = 88, SONETTE = 313, DANALOCK_BUREAU = 400, DANALOCK_ENTREE = 402, SWITCH_VMC_V1 = 383, SWITCH_VMC_V2 = 376, SWITCH_VMC_BYPASS = 378, RESISTANCE_CUMULUS = 70, SURPRESSEUR = 425, } GEA.add(true, 0, "Démarrage de GEA le #date# à #time#", nil, "Démarrage GEA") GEA.add({"Info+", "serverStatus", os.time()-120}, 0, "Box redémarrée à #time# le #date#", nil, "Démarrage box") GEA.add({"Info", "updateStableAvailable", true}, 24*60*60, "Une nouvelle version est disponible", nil, "Détection nouvelle version") GEA.add({"Info", "updateBetaAvailable", true}, 24*60*60, "Une nouvelle version BETA est disponible", nil, "Détection nouvelle version beta") -----------------------------Mode chaud climatisation-------------------------en tenant compte des profils vacance / home------ -- ID5 Marche mode chaud 20°C clim chambre 2 si T° jardin < 15°C et T° motion sensor 2 chambre 2 < 19°C et que les fenetres de la chambre 2 sont fermés entre 16h30 et 21H30 en semaine GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_CH2"], false}, {"Value", id["SENSOR_2_CH2"], false}, {"Value-", id["NAT_TEMP_JARDIN"], 15}, {"Value-", id["NAT_TEMP_CH2"], 19}, {"Days", "Weekday"}, {"Time", "16:30", "21:30"}}, 30, "Marche clim chambre 2 en chaud le soir en semaine T°20°C", {{"ThermostatMode", id["CONTROL_CLIM_CH2"], "Heat"}, {"HeatingThermostatSetpoint", id["CONTROL_CLIM_CH2"], "20"}}) -- ID6 Marche mode chaud 20°C clim chambre 2 si T° jardin < 15°C et T° motion sensor 2 chambre 2 < 19°C et que les fenetres de la chambre 2 sont fermés entre 6h15 et 7h00 en semaine GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_CH2"], false}, {"Value", id["SENSOR_2_CH2"], false}, {"Value-", id["NAT_TEMP_JARDIN"], 15}, {"Value-", id["NAT_TEMP_CH2"], 19}, {"Days", "Weekday"}, {"Time", "6:15", "7:00"}}, 30, "Marche clim chambre 2 en chaud le matin en semaine T°20°C", {{"ThermostatMode", id["CONTROL_CLIM_CH2"], "Heat"}, {"HeatingThermostatSetpoint", id["CONTROL_CLIM_CH2"], "20"}}) -- ID7 Marche mode chaud 20°C clim chambre 2 si T° jardin < 15°C et T° motion sensor 2 chambre 2 < 19°C et que les fenetres de la chambre 2 sont fermés entre 8h00 et 22h30 le week end GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_CH2"], false}, {"Value", id["SENSOR_2_CH2"], false}, {"Value-", id["NAT_TEMP_JARDIN"], 15}, {"Value-", id["NAT_TEMP_CH2"], 19}, {"Days", "Weekend"}, {"Time", "08:00", "22:30"}}, 30, "Marche clim chambre 2 en chaud T°20°C", {{"ThermostatMode", id["CONTROL_CLIM_CH2"], "Heat"}, {"HeatingThermostatSetpoint", id["CONTROL_CLIM_CH2"], "20"}}) -- ID08 Marche mode chaud 20°C clim salon si T° jardin < 15°C et T° motion sensor salon < 19°C et que la fenetres du salon, de l'entrée et de la cuisine sont fermés entre 6h15 et 7h00 en semaine GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_SALON"], false}, {"Value", id["SENSOR_ENTREE"], false}, {"Value", id["SENSOR_CUISINE"], false}, {"Value-", id["NAT_TEMP_JARDIN"], 15}, {"Value-", id["MO_TEMP_SALON"], 19}, {"Days", "Weekday"}, {"Time", "6:15", "7:00"}}, 30, "Marche clim salon en chaud matin semaine T°20°C", {{"ThermostatMode", id["CONTROL_CLIM_SALON"], "Heat"}, {"HeatingThermostatSetpoint", id["CONTROL_CLIM_SALON"], "20"}}) --------------------------------Mode froid climatisation------------------------en tenant compte des profils vacance / home------ -- ID09 Marche mode froid 26°C clim chambre 1 si le chauffe eau ne fonctionne pas et que la T° du jardin est > 25°C et T° motion sensor chambre 1 > 27°C et que la fenetre de la chambre 2 est fermés entre 20h30 et 21H30 en semaine GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_CH1"], false}, {"Power-", id["WALP_CHAUFFE_EAU"], 50}, {"Value+", id["NAT_TEMP_JARDIN"], 25}, {"Value+", id["MO_TEMP_CH1"], 27}, {"Days", "Weekday"}, {"Time", "20:30", "21:30"}}, 30, "Marche clim chambre 1 en froid le soir en semaine T°26C", {{"ThermostatMode", id["CONTROL_CLIM_CH1"], "Cool"}, {"CoolingThermostatSetpoint", id["CONTROL_CLIM_CH1"], "26"}}) -- ID10 Marche mode froid 26°C clim chambre 1 si le chauffe eau ne fonctionne pas et que la T° du jardin est > 25°C et T° motion sensor chambre 1 > 27°C et que la fenetre de la chambre 1 sont fermés entre 8h et 20h30 le week end GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_CH1"], false}, {"Power-", id["WALP_CHAUFFE_EAU"], 50}, {"Value+", id["NAT_TEMP_JARDIN"], 25}, {"Value+", id["MO_TEMP_CH1"], 27}, {"Days", "Weekend"}, {"Time", "08:00", "20:30"}}, 30, "Marche clim chambre 1 en froid week end", {{"ThermostatMode", id["CONTROL_CLIM_CH1"], "Cool"}, {"CoolingThermostatSetpoint", id["CONTROL_CLIM_CH1"], "26"}}) -- ID11 Marche mode froid 26°C clim chambre 2 si le chauffe eau ne fonctionne pas et que la T° du jardin est > 25°C et T° motion sensor 2 chambre 2 > 27°C et que les fenetres de la chambre 2 sont fermés entre 16h30 et 21H30 en semaine GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_CH2"], false}, {"Value", id["SENSOR_2_CH2"], false}, {"Power-", id["WALP_CHAUFFE_EAU"], 50}, {"Value+", id["NAT_TEMP_JARDIN"], 25}, {"Value+", id["NAT_TEMP_CH2"], 27}, {"Days", "Weekday"}, {"Time", "16:30", "22:30"}}, 30, "Marche clim chambre 2 en froid le soir en semaine T°25C", {{"ThermostatMode", id["CONTROL_CLIM_CH2"], "Cool"}, {"CoolingThermostatSetpoint", id["CONTROL_CLIM_CH2"], "26"}}) -- ID12 Marche mode froid 26°C clim chambre 2 si le chauffe eau ne fonctionne pas et que la T° du jardin est > 25°C et T° motion sensor 2 chambre 2 > 27°C et que les fenetres de la chambre 2 sont fermés entre 8h et 22h30 le week end GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_CH2"], false}, {"Value", id["SENSOR_2_CH2"], false}, {"Power-", id["WALP_CHAUFFE_EAU"], 50}, {"Value+", id["NAT_TEMP_JARDIN"], 25}, {"Value+", id["NAT_TEMP_CH2"], 27}, {"Days", "Weekend"}, {"Time", "08:00", "22:30"}}, 30, "Marche clim chambre 2 en froid week end", {{"ThermostatMode", id["CONTROL_CLIM_CH2"], "Cool"}, {"CoolingThermostatSetpoint", id["CONTROL_CLIM_CH2"], "26"}}) -- ID13 Marche mode froid 26°C clim salon si le chauffe eau ne fonctionne pas et que la T° du jardin est > 25°C et T° motion sensor salon, > 27°C et que la fenetre de du salon de l'entrée et de la cuisine sont fermés entre 16h30 et 20H30 en semaine GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_SALON"], false}, {"Value", id["SENSOR_ENTREE"], false}, {"Value", id["SENSOR_CUISINE"], false}, {"Power-", id["WALP_CHAUFFE_EAU"], 50}, {"Value+", id["NAT_TEMP_JARDIN"], 25}, {"Value+", id["MO_TEMP_SALON"], 27}, {"Days", "Weekday"}, {"Time", "16:30", "22:30"}}, 30, "Marche clim salon en froid le soir soir en semaine T°25C", {{"ThermostatMode", id["CONTROL_CLIM_SALON"], "Cool"}, {"CoolingThermostatSetpoint", id["CONTROL_CLIM_SALON"], "26"}}) -- ID14 Marche mode froid 26°C clim salon si le chauffe eau ne fonctionne pas et que la T° du jardin est > 25°C et T° motion sensor salon > 27°C et que la fenetre du salon de l'entrée et de la cuisine sont fermés entre 8h et 20h30 le week end GEA.add({{"Or", {"Profile","HOME"}, {"Profile","VACANCE H"}, {"Profile","VACANCE GHIS"}, {"Profile","VACANCE JCB"}}, {"Value", id["SENSOR_SALON"], false}, {"Value", id["SENSOR_ENTREE"], false}, {"Value", id["SENSOR_CUISINE"], false}, {"Power-", id["WALP_CHAUFFE_EAU"], 50}, {"Value+", id["NAT_TEMP_JARDIN"], 25}, {"Value+", id["MO_TEMP_SALON"], 27}, {"Days", "Weekend"}, {"Time", "08:00", "22:30"}}, 30, "Marche clim salon en froid week end", {{"ThermostatMode", id["CONTROL_CLIM_SALON"], "Cool"}, {"CoolingThermostatSetpoint", id["CONTROL_CLIM_SALON"], "26"}}) ----------------------------------Arret climatisation detecteurs--------------------------- -- ID15 Arrêt clim chambre 1 - ouverture fenetre après 120 secondes-- GEA.add(id["SENSOR_CH1"], 120, "arret clim, sensor chambre 1 ouvert", {"ThermostatMode", id["CONTROL_CLIM_CH1"], "Off"} ) -- ID16 Arrêt clim chambre 2 - ouverture fenetre après 120 secondes GEA.add(id["SENSOR_CH2"], 120, "arret clim, sensor 1 chambre 2 ouvert", {"ThermostatMode", id["CONTROL_CLIM_CH2"], "Off"} ) -- ID17 Arrêt clim chambre 2 - ouverture fenetre 2 après 120 secondes GEA.add(id["SENSOR_2_CH2"], 120, "arret clim, sensor 2 chambre 2 ouvert", {"ThermostatMode", id["CONTROL_CLIM_CH2"], "Off"} ) -- ID18 Arrêt clim salon - ouverture fenetre après 120 secondes GEA.add(id["SENSOR_SALON"], 120, "arret clim, sensor salon ouvert", {"ThermostatMode", id["CONTROL_CLIM_SALON"], "Off"} ) -- ID19 Arrêt clim salon - ouverture fenetre après 120 secondes GEA.add(id["SENSOR_CUISINE"], 120, "arret clim, sensor cuisine ouvert", {"ThermostatMode", id["CONTROL_CLIM_SALON"], "Off"} ) -- ID20 Arrêt clim salon - ouverture porte entree après 120 secondes GEA.add(id["SENSOR_ENTREE"], 120, "arret clim, sensor entree ouvert", {"ThermostatMode", id["CONTROL_CLIM_SALON"], "Off"} ) -- ID21 Arrêt clim bureau - ouverture fenetre après 120 secondes GEA.add(id["SENSOR_BUREAU"], 120, "arret clim, sensor bureau ouvert", {"ThermostatMode", id["CONTROL_CLIM_BUREAU"], "Off"} ) -----------------------------------Fermeture store horaire----------------------------------- -- ID22 fermeture store à 16h30 GEA.add(true, 30, "Fermeture store à 16H30", {{"Time", "16:30", "16:31"}, {"Close", id["ROLLER_STORE"], 100}}) ---------------------------------Arret climatisation horaire--------------------------------- -- ID23 Arrêt clim salon 22H30 GEA.add(true, 30, "Arrêt clim salon 22H30", {{"Time", "22:30", "22:31"}, {"ThermostatMode", id["CONTROL_CLIM_SALON"], "Off"}}) -- ID24 Arrêt clim Ch1 22H30 GEA.add(true, 30, "Arrêt clim CH1 22H30", {{"Time", "22:30", "22:31"}, {"ThermostatMode", id["CONTROL_CLIM_CH1"], "Off"}}) -- ID25 Arrêt clim Ch1 23H30 GEA.add(true, 30, "Arrêt clim CH1 23H30", {{"Time", "23:30", "23:31"}, {"ThermostatMode", id["CONTROL_CLIM_CH1"], "Off"}}) -- ID26 Arrêt clim Ch2 02H00 GEA.add(true, 30, "Arrêt clim CH2 22H35", {{"Time", "22:35", "22:36"}, {"ThermostatMode", id["CONTROL_CLIM_CH2"], "Off"}}) 1
Domodial Posté(e) le 3 novembre 2022 Signaler Posté(e) le 3 novembre 2022 Le 19/12/2014 à 16:37, sebcbien a dit : Gestion porte garage avec une seule commande (le même bouton ouvre et ferme la porte) Gestion des états en n'ayant qu'une seule information d'état (quand la porte est fermée) Gère les états inhabituels comme une commande de fermeture qui ouvrirait la porte au lieu de la fermer, après XX secondes, va re-envoyer l'ordre pour envoyer la porte dans l'autre sens et vérifier si pas en dead node. Révéler le contenu masqué local estClosed = {"Global!", "Porte_Garage", "Not_Closed"}local estNot_Closed = {"Global", "Porte_Garage", "Not_Closed"}--------------------GARAGE----------------------- Le scénario enverra un push toutes les 5mn 4X et puis toutes les 30 min tant que la porte sera ouverte GEA.add( id["DETECTEUR_PORTE_GARAGE"], 5*60, "La porte du garage est ouverte depuis plus de #duration# à#time#", {{"MaxTime", 8},{"Repeat"}}) GEA.add( id["DETECTEUR_PORTE_GARAGE"], 30*60, "La porte du garage est ouverte depuis plus de #duration# à#time#", {{"Repeat"}}) -- Msg àla fermeture du garage GEA.add( id["DETECTEUR_PORTE_GARAGE"], -1, "La porte du garage a été fermée à#time#", {{"Global", "Porte_Garage", "Closed"},{"Global", "Porte_Gar_Action", "En_Attente"},{"Inverse"}})-- Avertissement push si la porte du garage s'ouvre àdes heures non inappropriée GEA.add( id["DETECTEUR_PORTE_GARAGE"], -1, "Ouverture porte du garage à#time#", {{"Global", "Porte_Garage", "Not_Closed"},{"Global", "Porte_Gar_Action", "En_Attente"}}) -- Si demande Actionner, then push, actionne remote et reset global àen_attente GEA.add({"Global", "Porte_Gar_Action", "Actionner"}, -1, "Demande Action Porte Garage à#time#", {{"turnOn",id["REMOTE_GARAGE"]},{"Global", "Porte_Gar_Action", "En_Attente"}}) -- Si demande d'ouverture et porte fermée, then push, ouvre porte et reset global àen_attente GEA.add({{"Global", "Porte_Gar_Action", "Demande_Ouverture"}, estClosed}, -1, "Demande Ouverture Porte Garage à#time#", {{"turnOn",id["REMOTE_GARAGE"]},{"Global", "Porte_Gar_Action", "En_Attente"}}) -- Si demande d'ouverture et porte Ouverte, then push, ouvre porte et reset global àen_attente GEA.add({{"Global", "Porte_Gar_Action", "Demande_Ouverture"}, estNot_Closed}, -1, "Demande Ouverture Inutile à#time#", {{"Global", "Porte_Gar_Action", "En_Attente"}})-- Si demande de fermeture et porte fermée, then reset global àen_attente GEA.add({{"Global", "Porte_Gar_Action", "Demande_Fermeture"}, estClosed}, -1, "Demande Fermeture Inutile", {{"Global", "Porte_Gar_Action", "En_Attente"}}) -- Si demande de fermeture et porte non fermée (position inconnue), then push, ferme porte GEA.add({{"Global", "Porte_Gar_Action", "Demande_Fermeture"}, estNot_Closed}, -1, "Demande Fermeture Porte Garage à#time#", {{"turnOn",id["REMOTE_GARAGE"]}}) -- si pas fermé après 30 sec, on relance GEA.add({{"Global", "Porte_Gar_Action", "Demande_Fermeture"}, estNot_Closed}, 35, "Fermeture ratée ré-essai à#time#", {{"WakeUp", id["REMOTE_GARAGE"]},{"Function", function() fibaro:sleep(1000) end},{"turnOn",id["REMOTE_GARAGE"]},{"Repeat"}}) --GEA.add({{"Global", "Porte_Gar_Action", "Demande_Fermeture"},{"Value", id["DETECTEUR_PORTE_GARAGE"], 1}}, -1, "Demande Fermeture Porte Garage GEA à#time#", {{"turnOn",id["REMOTE_GARAGE"]}}) --------------------- Hello @sebcbien, je remarque ce code qui me semble très cool. Là ou je ne comprends pas, c'est que tu dis que le code n'utilise qu'un seul bouton pour la fermeture / ouverture. Je vois 3 étapes : Actionner / Demande_Ouverture / Demande_Fermeture ça fonctionne sur le principe d'un triple clic ?
sebcbien Posté(e) le 3 novembre 2022 Auteur Signaler Posté(e) le 3 novembre 2022 Salut @Domodial Franchement je ne me souviens plus le pourquoi du comment, mais oui, j'ai 3 boutons, ouvrir fermer et actionner une seule variable globale et gestion du double click pour la commande ouvrir et actionner. -- Double click by sebcbien -- local msg = "Ré-appuyer pour confirmer" -- Confirm message local action_msg = "!! ACTION: OUVRIR !!" -- message when double click activated local labelId = "Message" -- ID of the label hosting the messages local secondes = 2 -- maximum time between two clicks for the action to be validated -- do not modify below and place your action in line 25 local current = fibaro:getValue(fibaro:getSelfId(), "ui."..labelId..".value") local action if (current == "") then fibaro:call(fibaro:getSelfId(), "setProperty", "ui."..labelId..".value", msg.." ("..string.sub(os.time(),-4)..")") fibaro:debug("First Click") action = false elseif tonumber(string.sub(os.time(),-4)) - tonumber(string.sub(current,-5,-2)) <= secondes then fibaro:call(fibaro:getSelfId(), "setProperty", "ui."..labelId..".value", action_msg) fibaro:debug("Double click Validated !") fibaro:sleep(2*1000) fibaro:call(fibaro:getSelfId(), "setProperty", "ui."..labelId..".value", "") action = true elseif tonumber(string.sub(os.time(),-4)) - tonumber(string.sub(current,-5,-2)) > secondes then fibaro:call(fibaro:getSelfId(), "setProperty", "ui."..labelId..".value", "") fibaro:debug("Cleaning") action = false end if action then -- PLACE YOUR CODE HERE -- local previous_mode = fibaro:getGlobalValue("Porte_Gar_Action"); fibaro:setGlobal("Porte_Gar_Action", "Demande_Ouverture") local current_mode = fibaro:getGlobalValue("Porte_Gar_Action"); fibaro:debug(os.date("%a %d/%m", os.time()).." Previous mode was: " .. previous_mode .. ". Has been changed to: " .. current_mode); end
Domodial Posté(e) le 4 novembre 2022 Signaler Posté(e) le 4 novembre 2022 Merci @sebcbien , ce script fonctionne pour HC3 ?
jojo Posté(e) le 4 novembre 2022 Signaler Posté(e) le 4 novembre 2022 je n'ai pas lu tous vos échanges, mais @Lazera redéveloppé GEA pour HC3, et (normalement) les règles définies pour HC2 continuent de fonctionner. 1
Messages recommandés