Intuis connect sur Node RED - v1.4 2024 par Yann V
Ce flow permet de se connecter à l'API Intuis connect (by Netatmo) pour récupérer toutes les infos concernant les radiateurs du domicile : température instantanée, consigne, état, détecteur présence, fenêtre ouverte et consommation jounalière.
Pour le créer, je me suis basé sur le flow existant "Get Netatmo Weather station data" de matz33 qui permet de récupérer le token sur les serveurs Netatmo puis j'ai improvisé avec les commandes Intuis connect en les récupérants depuis l'application sur Iphone.
Pour l'exploiter, il faut une bonne maitrise de Node RED ainsi que des connaissances Java.
Notice d'installation :
- mise à jour des noeuds : Le flow est générique, il est nécessaire de renseigner vos identifants et d'adapter les noeuds au nombre de pièces et de modules à votre domicile.
noeud "Set Intuis username et password" : renseigner votre email et votre mot de passe de connexion au serveur Intuis Connect Pour s'assurer que l'authentification fonctionne, activer le noeud debug "contrôle authentification" et contrôler la réponse du serveur dans la fenêtre de débogage.
noeud "Set param get config 1": RAS, l'id de votre installation est automatiquement renseigné (appelé home_id)
noeud "Set param get config 2" (veille et jour J) : L'id de votre installation (home_id), les id de vos 2 premières pièces (rooms) et l'id de votre pont (bridge) sont automatiquement renseignés. Si vous avez + ou - de 2 pièces dans votre domicile, il est nécessaire de modifier ce noeud et le noeud "définir rooms_ids" en prenant exemple sur les rooms déjà renseignées.
- création des entités : Pour pouvoir accéder aux différentes infos rapptriées dans Home Assistant, il est nécessaire de créer des entités. Elles peuvent être crées directement depuis Node Red. Pour cela, ouvrir la fenêtre de modification d'un noeud sensor et cliquer sur le bouton " + " à côté du champ "Entity config". Renseigner votre serveur Home Assistant, un nom et un friendly name, sélectionnez la category « diagnostic », puis selon les cas : une device class (temperature, energy, etc.), l’unit of measurement et la state class. Cliquer enfin sur le bouton « Ajouter » en haut de la page et ensutie sur "Enregistrer". Si vous avez + ou - de 2 pièces dans votre domicile, là aussi il est nécessaire de modifier le flow pour ajouter ou retirer des entités.
Notice d'utilisation : Une fois le flow configuré avec vos informations personnelles,
- Cliquer une fois sur le noeud "Set first info"
- Cliquer une fois sur le noeud "Start"
- Le token est automatiquement réactivé. Il sera toutefois nécessaire de recliquer sur les deux noeuds en cas de redémmarrage de Home Assistant.
Ce flow est un modèle, vous pouvez le personnaliser ou l'améliorer selon vos besoins et vos envies. Il est possible de récupérer d'autres informations depuis le serveur, d'ajouter d'autres commandes, etc. Pour obtenir une première aide sur la configuration du flow, consulter ce post HACF : https://forum.hacf.fr/t/integration-radiateurs-intuis-connect-sans-homekit/41313
Yann V - créé en juillet 2024 - dernière mise à jour en octobre 2024
[{"id":"a3667737564f7de1","type":"tab","label":"Intuis connect - modèle","disabled":false,"info":"Créé par Yann V. le 03/07/2024\nDernière mise a jour le 17/10/2024","env":[]},{"id":"52dda859303a9e7b","type":"group","z":"a3667737564f7de1","name":"Récupération consommations ","style":{"label":true},"nodes":["9394b4d8841f3020","b81624a10616b079","60931de8d68a35ce","2dac9207fbeacbca","a7fa7bc3fdcf29cb","f9c55eb38e63f82f","691e2058bd943c46","86ab6bcc5d67d931","a7d0f6a353a3662f","6ebb80f837312213","b4f63770bf75b8f8","4e160860baa3b54c","114ba7eaf86e62aa"],"x":208,"y":1599,"w":1838,"h":588},{"id":"b4ecf9cd91687f9b","type":"group","z":"a3667737564f7de1","name":"Récupération statuts","style":{"label":true},"nodes":["a6b9b86c1ca02d52","aa0f5b870c42b3c2","8a5334571d731133","2005082b2084e96a","a4195a3212abfe87","626736ce4f00434b","b886246f23555cf6","9ee93a23ae3dc3ea","30eb9f725cd02415","4d96ad2fad57578b","85bb1b1722144f1c","2c9638711c5b7b90","d517d9053ca31584"],"x":1094,"y":779,"w":812,"h":742},{"id":"1282f94706731784","type":"group","z":"a3667737564f7de1","name":"Connexion préliminaire et récupération du token","style":{"label":true},"nodes":["e2b937effce815c2","bcf1f2d3e7ca2f6a","d5b71025d46d7744","e9494dd20a419ed4","639ae927bce13e53","77dfcff74212faa6","7970da3f1675a226","c0591c272dcd2777","e8596f7f50bc05d8","9cda1fcc120901f8","43542daf578a4abb","d854767798bcbdbf","20d048608db5e5f5","cf4a45632cea2d4d","be2ba172eef1a14a"],"x":14,"y":19,"w":1617,"h":322},{"id":"a7d0f6a353a3662f","type":"group","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Définition début et fin de plage","style":{"label":true},"nodes":["4be6036fef820625","4a9277d1a6e0e4af","a4603047c37c9ccf","d1306ed7f8aac635","14c1c0ac41e49e9b","636d70287e18f7aa","379ab7ed0dd8c6fa","8cf5423bdba99af6"],"x":234,"y":1899,"w":492,"h":262},{"id":"e2b937effce815c2","type":"http request","z":"a3667737564f7de1","g":"1282f94706731784","name":"Send refresh request","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://app.muller-intuitiv.net/oauth2/token","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/x-www-form-urlencoded"}],"x":1020,"y":160,"wires":[["c0591c272dcd2777","20d048608db5e5f5"]]},{"id":"bcf1f2d3e7ca2f6a","type":"inject","z":"a3667737564f7de1","g":"1282f94706731784","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":110,"y":140,"wires":[["d5b71025d46d7744"]]},{"id":"d5b71025d46d7744","type":"change","z":"a3667737564f7de1","g":"1282f94706731784","name":"Set param request refresh","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t \"client_id\": $globalContext(\"ClientId\"),\t \"user_prefix\":\"muller\",\t \"client_secret\":$globalContext(\"ClientSecret\"),\t \"grant_type\":\"password\",\t \"scope\":\"read_muller write_muller\",\t \"password\":$globalContext(\"password\"),\t \"username\":$globalContext(\"username\")\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":160,"wires":[["e2b937effce815c2"]]},{"id":"e9494dd20a419ed4","type":"change","z":"a3667737564f7de1","g":"1282f94706731784","name":"Store tokens & delay","rules":[{"t":"set","p":"AccessToken","pt":"global","to":"payload.access_token","tot":"msg"},{"t":"set","p":"RefreshToken","pt":"global","to":"payload.refresh_token","tot":"msg"},{"t":"set","p":"delay","pt":"msg","to":"payload.expires_in*1000-300000","tot":"jsonata"},{"t":"set","p":"status","pt":"msg","to":"OK","tot":"str"},{"t":"set","p":"LastUpdateTime","pt":"global","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":100,"wires":[["9cda1fcc120901f8","43542daf578a4abb"]]},{"id":"639ae927bce13e53","type":"change","z":"a3667737564f7de1","g":"1282f94706731784","name":"Intuis Creds","rules":[{"t":"set","p":"ClientId","pt":"global","to":"59e604948fe283fd4dc7e355","tot":"str"},{"t":"set","p":"ClientSecret","pt":"global","to":"rAeWu8Y3YqXEPqRJ4BpFzFG98MRXpCcz","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":60,"wires":[["be2ba172eef1a14a"]]},{"id":"77dfcff74212faa6","type":"inject","z":"a3667737564f7de1","g":"1282f94706731784","name":"Set first info","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":60,"wires":[["639ae927bce13e53"]]},{"id":"7970da3f1675a226","type":"inject","z":"a3667737564f7de1","g":"1282f94706731784","name":"Stop","props":[{"p":"reset","v":"1","vt":"num"},{"p":"status","v":"STOP","vt":"str"},{"p":"delay","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":200,"wires":[["9cda1fcc120901f8","43542daf578a4abb","d854767798bcbdbf"]]},{"id":"c0591c272dcd2777","type":"switch","z":"a3667737564f7de1","g":"1282f94706731784","name":"All ok ?","property":"payload","propertyType":"msg","rules":[{"t":"hask","v":"access_token","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1260,"y":160,"wires":[["e9494dd20a419ed4"],["e8596f7f50bc05d8"]],"outputLabels":["Response OK","Error"]},{"id":"e8596f7f50bc05d8","type":"change","z":"a3667737564f7de1","g":"1282f94706731784","name":"Delay 1 hour on error","rules":[{"t":"set","p":"delay","pt":"msg","to":"3600000","tot":"num"},{"t":"set","p":"status","pt":"msg","to":"KO","tot":"str"},{"t":"set","p":"NetatmoLastUpdateTime","pt":"global","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":1505,"y":220,"wires":[["9cda1fcc120901f8","43542daf578a4abb"]]},{"id":"9cda1fcc120901f8","type":"delay","z":"a3667737564f7de1","g":"1282f94706731784","name":"Refresh","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":425,"y":160,"wires":[["d5b71025d46d7744"]]},{"id":"43542daf578a4abb","type":"delay","z":"a3667737564f7de1","g":"1282f94706731784","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":425,"y":220,"wires":[["d854767798bcbdbf"]]},{"id":"d854767798bcbdbf","type":"function","z":"a3667737564f7de1","g":"1282f94706731784","name":"Next refresh in...","func":"var d = new Date();\nvar n = d.getTime();\nvar start_time = global.get('LastUpdateTime')||0;\nvar duration = msg.delay/1000;\nvar elapsed_time = Math.round((n - start_time)/1000);\n\nvar remains = new Date(null);\nremains.setSeconds(duration - elapsed_time); // specify value for SECONDS here\nvar remains_h = remains.toISOString().substr(11, 8);\nif (msg.status == \"STOP\") {\n node.status({});\n msg.remains = \"00:00:00\";\n msg.payload = 0;\n return [null, msg];\n}\nif (elapsed_time < duration) {\n node.status({fill:msg.status == \"OK\" ? \"blue\" : \"red\",shape:\"dot\", text:remains_h});\n msg.remains = remains_h;\n return [ msg, null ];\n}\n\n","outputs":2,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":300,"wires":[["43542daf578a4abb"],[]]},{"id":"0b708dd99a7fdecb","type":"change","z":"a3667737564f7de1","name":"","rules":[{"t":"set","p":"token","pt":"msg","to":"\"Bearer \" & $globalContext(\"AccessToken\")\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":380,"wires":[["4adc010b8102129c","67ee9631179a9d0f"]]},{"id":"4adc010b8102129c","type":"http request","z":"a3667737564f7de1","name":"Intuis homedata","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app.muller-intuitiv.net/api/homesdata","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Authorization","valueType":"msg","valueValue":"token"}],"x":1200,"y":380,"wires":[["58e86513b5620844","19f864237658d884","4eb030f7e69e9077","a4df9b81c4858403","7ffa5b33183e8288"]]},{"id":"311e5c9e03e928ce","type":"inject","z":"a3667737564f7de1","name":"Get Intuis Data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":380,"wires":[["0b708dd99a7fdecb","4be6036fef820625","4a9277d1a6e0e4af","14c1c0ac41e49e9b","636d70287e18f7aa"]]},{"id":"20d048608db5e5f5","type":"debug","z":"a3667737564f7de1","g":"1282f94706731784","name":"contrôle authentification","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1190,"y":60,"wires":[]},{"id":"626dc70dbf75a137","type":"http request","z":"a3667737564f7de1","name":"Intuis getconfig","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://app.muller-intuitiv.net/syncapi/v1/getconfigs","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Authorization","valueType":"msg","valueValue":"token"},{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/x-www-form-urlencoded"}],"x":1200,"y":700,"wires":[["e011522b9b1daca4"]]},{"id":"e011522b9b1daca4","type":"debug","z":"a3667737564f7de1","name":"Intuis getconfig","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1520,"y":700,"wires":[]},{"id":"58e86513b5620844","type":"debug","z":"a3667737564f7de1","name":"Intuis homedata","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.body.homes[0]","targetType":"msg","statusVal":"","statusType":"auto","x":1520,"y":380,"wires":[]},{"id":"d9f2befaac2b726d","type":"change","z":"a3667737564f7de1","name":"Set param get config 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t \"home_id\":$globalContext(\"home_id\")\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":700,"wires":[["626dc70dbf75a137","a6b9b86c1ca02d52"]]},{"id":"a6b9b86c1ca02d52","type":"http request","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Intuis homestatus","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://app.muller-intuitiv.net/syncapi/v1/homestatus","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Authorization","valueType":"msg","valueValue":"token"},{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/x-www-form-urlencoded"}],"x":1210,"y":820,"wires":[["aa0f5b870c42b3c2","8a5334571d731133","2005082b2084e96a","a4195a3212abfe87","b886246f23555cf6","9ee93a23ae3dc3ea","30eb9f725cd02415","4d96ad2fad57578b","85bb1b1722144f1c","2c9638711c5b7b90","d517d9053ca31584"]]},{"id":"aa0f5b870c42b3c2","type":"debug","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Intuis homestatus","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.body","targetType":"msg","statusVal":"","statusType":"auto","x":1530,"y":820,"wires":[]},{"id":"8a5334571d731133","type":"ha-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Température Room 0","entityConfig":"","version":0,"state":"payload.body.home.rooms[0].therm_measured_temperature","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1540,"y":880,"wires":[[]]},{"id":"2005082b2084e96a","type":"ha-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Mode fonctionnement Room 0","entityConfig":"","version":0,"state":"payload.body.home.rooms[0].therm_setpoint_mode","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1570,"y":940,"wires":[[]]},{"id":"a4195a3212abfe87","type":"ha-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Température consigne Room 0","entityConfig":"","version":0,"state":"payload.body.home.rooms[0].therm_setpoint_temperature","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1570,"y":1000,"wires":[[]]},{"id":"9394b4d8841f3020","type":"http request","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Intuis gethomemeasure","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://app.muller-intuitiv.net/api/gethomemeasure","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Authorization","keyValue":"","valueType":"msg","valueValue":"token"},{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/json"}],"x":1290,"y":1760,"wires":[["b81624a10616b079","60931de8d68a35ce","2dac9207fbeacbca","f9c55eb38e63f82f"]]},{"id":"b81624a10616b079","type":"debug","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Intuis gethomemeasure","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1610,"y":1660,"wires":[]},{"id":"60931de8d68a35ce","type":"ha-sensor","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Consommation Room 0","entityConfig":"","version":0,"state":"payload.body.home.rooms[0].measures[0].value[0][0]","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1610,"y":1780,"wires":[[]]},{"id":"2dac9207fbeacbca","type":"function","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Calcul conso totale","func":"var ConsoRoom0 = msg.payload.body.home.rooms[0].measures[0].value[0][0];\nvar ConsoRoom1 = msg.payload.body.home.rooms[1].measures[0].value[0][0];\n\nvar ConsoTotal = ConsoRoom0 + ConsoRoom1 ;\nmsg.consototal = ConsoTotal;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1590,"y":1720,"wires":[["a7fa7bc3fdcf29cb"]]},{"id":"a7fa7bc3fdcf29cb","type":"ha-sensor","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Consommation totale chauffage","entityConfig":"","version":0,"state":"consototal","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1890,"y":1720,"wires":[[]]},{"id":"f9c55eb38e63f82f","type":"ha-sensor","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Consommation Room 1","entityConfig":"","version":0,"state":"payload.body.home.rooms[1].measures[0].value[0][0]","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1610,"y":1840,"wires":[[]]},{"id":"cf4a45632cea2d4d","type":"comment","z":"a3667737564f7de1","g":"1282f94706731784","name":"Renseigner ici vos identifiants Intuis connect","info":"Noeud Set Intuis Creds & Tokens","x":750,"y":100,"wires":[]},{"id":"626736ce4f00434b","type":"comment","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Pensez à créer les entitées à rattacher aux différents capteurs","info":"","x":1660,"y":1180,"wires":[]},{"id":"691e2058bd943c46","type":"comment","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"Pensez à créer les entitées à rattacher aux différents capteurs","info":"","x":1720,"y":1900,"wires":[]},{"id":"19f864237658d884","type":"change","z":"a3667737564f7de1","name":"Identifier les pièces","rules":[{"t":"set","p":"payload.rooms.0.name","pt":"msg","to":"payload.body.homes[0].rooms[0].name","tot":"msg"},{"t":"set","p":"payload.rooms.0.id","pt":"msg","to":"payload.body.homes[0].rooms[0].id","tot":"msg"},{"t":"set","p":"payload.rooms.1.name","pt":"msg","to":"payload.body.homes[0].rooms[1].name","tot":"msg"},{"t":"set","p":"payload.rooms.1.id","pt":"msg","to":"payload.body.homes[0].rooms[1].id","tot":"msg"},{"t":"set","p":"payload.rooms.2.name","pt":"msg","to":"payload.body.homes[0].rooms[2].name","tot":"msg"},{"t":"set","p":"payload.rooms.2.id","pt":"msg","to":"payload.body.homes[0].rooms[2].id","tot":"msg"},{"t":"set","p":"payload.rooms.3.name","pt":"msg","to":"payload.body.homes[0].rooms[3].name","tot":"msg"},{"t":"set","p":"payload.rooms.3.id","pt":"msg","to":"payload.body.homes[0].rooms[3].id","tot":"msg"},{"t":"set","p":"payload.rooms.4.name","pt":"msg","to":"payload.body.homes[0].rooms[4].name","tot":"msg"},{"t":"set","p":"payload.rooms.4.id","pt":"msg","to":"payload.body.homes[0].rooms[4].id","tot":"msg"},{"t":"set","p":"payload.rooms.5.name","pt":"msg","to":"payload.body.homes[0].rooms[5].name","tot":"msg"},{"t":"set","p":"payload.rooms.5.id","pt":"msg","to":"payload.body.homes[0].rooms[5].id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":440,"wires":[["a7cf91f7859e0c4a"]]},{"id":"a7cf91f7859e0c4a","type":"debug","z":"a3667737564f7de1","name":"Identifier les pièces","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.rooms","targetType":"msg","statusVal":"","statusType":"auto","x":1790,"y":440,"wires":[]},{"id":"4eb030f7e69e9077","type":"change","z":"a3667737564f7de1","name":"définir global.home_id et home_name","rules":[{"t":"set","p":"home_id","pt":"global","to":"payload.body.homes[0].id","tot":"msg"},{"t":"set","p":"home_name","pt":"global","to":"payload.body.homes[0].name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1590,"y":560,"wires":[[]]},{"id":"67ee9631179a9d0f","type":"delay","z":"a3667737564f7de1","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":620,"y":700,"wires":[["d9f2befaac2b726d","6ebb80f837312213"]]},{"id":"b886246f23555cf6","type":"ha-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Température Room 1","entityConfig":"","version":0,"state":"payload.body.home.rooms[1].therm_measured_temperature","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1540,"y":1240,"wires":[[]]},{"id":"9ee93a23ae3dc3ea","type":"ha-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Mode fonctionnement Room 1","entityConfig":"","version":0,"state":"payload.body.home.rooms[1].therm_setpoint_mode","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1570,"y":1300,"wires":[[]]},{"id":"30eb9f725cd02415","type":"ha-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Température consigne Room 1","entityConfig":"","version":0,"state":"payload.body.home.rooms[1].therm_setpoint_temperature","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1570,"y":1360,"wires":[[]]},{"id":"a4df9b81c4858403","type":"function","z":"a3667737564f7de1","name":"Identification routeur","func":"if (msg.payload.body.homes[0].modules[0].type === \"NMG\") {\n msg.payload = msg.payload.body.homes[0].modules[0];\n return msg;}\nelse if (msg.payload.body.homes[0].modules[1].type === \"NMG\") {\n msg.payload = msg.payload.body.homes[0].modules[1];\n return msg;}\nelse if (msg.payload.body.homes[0].modules[2].type === \"NMG\") {\n msg.payload = msg.payload.body.homes[0].modules[2];\n return msg;}\nelse if (msg.payload.body.homes[0].modules[3].type === \"NMG\") {\n msg.payload = msg.payload.body.homes[0].modules[3];\n return msg;}\nelse {msg.payload = \"ko\";\n return msg;}\t \t ","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1540,"y":620,"wires":[["940fc48d0b83b26f"]]},{"id":"940fc48d0b83b26f","type":"change","z":"a3667737564f7de1","name":"définir global routeur_id et routeur_name","rules":[{"t":"set","p":"routeur_id","pt":"global","to":"payload.id","tot":"msg"},{"t":"set","p":"routeur_name","pt":"global","to":"payload.name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1860,"y":620,"wires":[[]]},{"id":"7ffa5b33183e8288","type":"change","z":"a3667737564f7de1","name":"définir rooms_ids ","rules":[{"t":"set","p":"room0_id","pt":"global","to":"payload.body.homes[0].rooms[0].id","tot":"msg","dc":true},{"t":"set","p":"room1_id","pt":"global","to":"payload.body.homes[0].rooms[1].id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1530,"y":500,"wires":[[]]},{"id":"faac28666fd1e872","type":"comment","z":"a3667737564f7de1","name":"A compléter selon nombre de pièces ","info":"","x":1780,"y":500,"wires":[]},{"id":"86ab6bcc5d67d931","type":"comment","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"A compléter selon nombre de pièces ","info":"","x":940,"y":1880,"wires":[]},{"id":"4d96ad2fad57578b","type":"ha-binary-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Fenêtre ouverte room 0","entityConfig":"","version":0,"state":"payload.body.home.rooms[0].open_window","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1550,"y":1060,"wires":[[]]},{"id":"85bb1b1722144f1c","type":"ha-binary-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Détection présence room 0","entityConfig":"","version":0,"state":"payload.body.home.rooms[0].presence","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1560,"y":1120,"wires":[[]]},{"id":"2c9638711c5b7b90","type":"ha-binary-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Fenêtre ouverte room 1","entityConfig":"","version":0,"state":"payload.body.home.rooms[1].open_window","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1550,"y":1420,"wires":[[]]},{"id":"d517d9053ca31584","type":"ha-binary-sensor","z":"a3667737564f7de1","g":"b4ecf9cd91687f9b","name":"Détection présence room 1","entityConfig":"","version":0,"state":"payload.body.home.rooms[1].presence","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1560,"y":1480,"wires":[[]]},{"id":"be2ba172eef1a14a","type":"change","z":"a3667737564f7de1","g":"1282f94706731784","name":"Set Intuis username et password ","rules":[{"t":"set","p":"username","pt":"global","to":"E-mail à renseigner","tot":"str"},{"t":"set","p":"password","pt":"global","to":"MDP à renseigner","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":60,"wires":[[]]},{"id":"4be6036fef820625","type":"function","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"veille 12h01","func":"var a = new Date();\na.setHours(12, 1, 0, 0); \na.setDate(a.getDate() - 1); \nvar b = a.getTime(); \nvar c = b / 1000; \n\n{\n node.status({ fill: \"blue\", shape: \"ring\", text: c });\n msg.debut = c;\n return msg;\n}","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":1940,"wires":[["a4603047c37c9ccf"]]},{"id":"4a9277d1a6e0e4af","type":"function","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"jour J 23h59","func":"var d = new Date();\nvar e = d.setHours(23,59,59,0);\nvar f = e / 1000\n\n{\n node.status({fill:\"blue\",shape:\"ring\", text:f});\n msg.fin = f;\n return msg;\n}\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":2000,"wires":[["d1306ed7f8aac635"]]},{"id":"a4603047c37c9ccf","type":"change","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"","rules":[{"t":"set","p":"debut","pt":"global","to":"debut","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":1940,"wires":[[]]},{"id":"d1306ed7f8aac635","type":"change","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"","rules":[{"t":"set","p":"fin","pt":"global","to":"fin","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":2000,"wires":[[]]},{"id":"14c1c0ac41e49e9b","type":"function","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"veille 00h00","func":"var g = new Date();\ng.setDate(g.getDate() - 1);\nvar h = g.setHours(0,0,0,0);\nvar i = h / 1000;\n\n{\n node.status({ fill: \"blue\", shape: \"ring\", text:i}); \n msg.veille_debut = i;\n return msg;\n}\n\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":2060,"wires":[["379ab7ed0dd8c6fa"]]},{"id":"636d70287e18f7aa","type":"function","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"veille 23h59","func":"var j = new Date();\nj.setDate(j.getDate() - 1);\nvar k = j.setHours(23,59,59,0);\nvar l = k / 1000\n\n{\n node.status({fill:\"blue\",shape:\"ring\", text:l});\n msg.veille_fin = l;\n return msg;\n}\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":2120,"wires":[["8cf5423bdba99af6"]]},{"id":"379ab7ed0dd8c6fa","type":"change","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"","rules":[{"t":"set","p":"veille_debut","pt":"global","to":"veille_debut","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":2060,"wires":[[]]},{"id":"8cf5423bdba99af6","type":"change","z":"a3667737564f7de1","g":"a7d0f6a353a3662f","name":"","rules":[{"t":"set","p":"veille_fin","pt":"global","to":"veille_fin","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":2120,"wires":[[]]},{"id":"3967dc2dc34e149f","type":"change","z":"a3667737564f7de1","name":"Set param get config 2 (jour J)","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t \"date_end\": $globalContext(\"fin\"),\t \"home\": {\t \"id\": $globalContext(\"home_id\"),\t \"rooms\": [\t {\t \"id\": $globalContext(\"room0_id\"),\t \"bridge\": $globalContext(\"routeur_id\"),\t \"type\": \"sum_energy_elec$0\"\t },\t {\t \"id\": $globalContext(\"room1_id\"),\t \"bridge\": $globalContext(\"routeur_id\"),\t \"type\": \"sum_energy_elec$0\"\t }\t ]\t },\t \"app_identifier\": \"app_muller\",\t \"date_begin\": $globalContext(\"debut\"),\t \"scale\": \"1day\"\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":1840,"wires":[["4e160860baa3b54c","9394b4d8841f3020"]]},{"id":"4e160860baa3b54c","type":"debug","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"contrôle requête jour J","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1200,"y":1840,"wires":[]},{"id":"8150e047d1f38744","type":"change","z":"a3667737564f7de1","name":"Set param get config 2 (veille)","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t \"date_end\": $globalContext(\"veille_fin\"),\t \"home\": {\t \"id\": $globalContext(\"home_id\"),\t \"rooms\": [\t {\t \"id\": $globalContext(\"room0_id\"),\t \"bridge\": $globalContext(\"routeur_id\"),\t \"type\": \"sum_energy_elec$0\"\t },\t {\t \"id\": $globalContext(\"room1_id\"),\t \"bridge\": $globalContext(\"routeur_id\"),\t \"type\": \"sum_energy_elec$0\"\t }\t ]\t },\t \"app_identifier\": \"app_muller\",\t \"date_begin\": $globalContext(\"veille_debut\"),\t \"scale\": \"1day\"\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":1680,"wires":[["b4f63770bf75b8f8","9394b4d8841f3020"]]},{"id":"b4f63770bf75b8f8","type":"debug","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"contrôle requête veille","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1200,"y":1680,"wires":[]},{"id":"6ebb80f837312213","type":"function","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"00h00 - 03h00","func":"var now = new Date ();\nvar hours = now.getHours();\nvar minutes = now.getMinutes();\n\nif ((hours >= 0 && hours < 3) || (hours === 3 && minutes === 0)) {\n node.status({fill:\"blue\",shape:\"ring\", text:\"après 00h et avant 03h\"});\n return [msg, null]; // Sortie 1 \n} else { \n node.status({fill:\"blue\",shape:\"ring\", text:\"après 03h et avant 00h\"});\n return [null, msg]; // Sortie 2 \n}\n ","outputs":2,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":1760,"wires":[["8150e047d1f38744","d644fd2ee03b6a57"],["b1b7e9ab80be7c43","3967dc2dc34e149f"]]},{"id":"b1b7e9ab80be7c43","type":"debug","z":"a3667737564f7de1","name":"03h-00h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":1800,"wires":[]},{"id":"d644fd2ee03b6a57","type":"debug","z":"a3667737564f7de1","name":"00h-03h","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":1720,"wires":[]},{"id":"114ba7eaf86e62aa","type":"comment","z":"a3667737564f7de1","g":"52dda859303a9e7b","name":"A compléter selon nombre de pièces ","info":"","x":940,"y":1640,"wires":[]}]