Bonjour a tous,
Je me penche sur la gestion automatique de mes volets roulants, je vous partage ce que j’ai mis en place pour ceux que cela intéresserais.
En tant qu’ancien jeedomien, j’essaie de me rapprocher pour ceux qui connaissent, du plugin de gestion automatique des volets qui est fortement paramétrable.
Mon besoin principal est la gestion « Azimuth » donc en fonction du soleil, sachant que j’ai 21 volets à automatiser (15 classiques + 6 velux).
Avec une approche un peu différente, je me suis inspiré de " Automatiser ses volets roulants en fonction du soleil été / hiver" et " Gestion des volets sous Node-Red en fonction du soleil, avec offsets paramétrables"
Mon approche générale est de calculer à interval régulier une position automatique (selon certaines règles).
Pour ce faire, je m’appuie donc sur:
- Mes entités volet (heu bein oui hein! )
- L’entité native sun.sun
- Une entité input_select par volet qui détermine le « mode » dans lequel est le volet (Auto / Auto Forcé / Manuel / Manuel Forcé), qui sera utile par ailleurs si par exemple on veux stopper momentanément les choses, ou relancer à un instant t.
- Une entité input_number par volet, qui stocke le dernier calcul automatisé d’ouverture (Je positionne ce dernier à -1 lorsque les conditions d’automatisation ne sont pas/plus satisfaites).
Nb: Pour faciliter les choses, j’ai nommé les entités correspondantes input_number.automatic_cover_xxx et input_select.automatic_cover_xxx avec xxx = l’id de mes volets. - Une entité weather pour déterminer l’ouverture en fonction de la météo
Voici le flow node red :
[{"id":"95ecbc95.0554a","type":"inject","z":"89f218d7.aa0978","name":"Every 10 minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"*/10 0-22 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":520,"wires":[["d7a5d568.814168","793d8219.413c3c","1db9a926.7248d7","289583d4.90e80c","3312478c.5afc08","8536b819.199ec8","39c75d78.017d22","37a381d6.daca1e","aa37bb31.41bdc8","e3a25d07.93fa9","8d5c3001.f6ea3","4c75d0d0.c4ca8","dc69505e.5d14c","71b185e7.8b152c","46151ee5.be99e","ee630115.8cf07","989ec058.547e4","d12fd595.351738","d1f25df0.a4ce6","3e11173a.1e8b38","ac5b5e16.209fe"]]},{"id":"3d4a6d42.363c12","type":"group","z":"89f218d7.aa0978","name":"Azimuth Determinations","style":{"fill":"#e3f3d3","label":true},"nodes":["fbcf2a56.083e78","3dd06558.4b1c7a","54e3b9ff.b145a8","e11df07c.9b74c","7f92ef8b.db24f","c1be037a.e09d3","9025c67b.9b6858","50f14e0d.81bc6","ee213cef.4a9dd"],"x":1054,"y":419,"w":512,"h":562},{"id":"fbcf2a56.083e78","type":"function","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Is Azimuth","func":"\n\nconst azimuth = global.get('homeassistant.homeAssistant.states[\"sun.sun\"].attributes.azimuth');\nvar ouverture;\nvar is_azimuth;\n\n// Determine opening\nif (azimuth > msg.azimuth_min && azimuth < msg.azimuth_max) \n {is_azimuth = true;}\nelse \n {is_azimuth = false;}\n\n\nmsg.is_azimuth = is_azimuth;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1150,"y":460,"wires":[["e11df07c.9b74c"]]},{"id":"3dd06558.4b1c7a","type":"switch","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Auto Forced / Auto","property":"input_select[0].state","propertyType":"msg","rules":[{"t":"eq","v":"Auto_Forced","vt":"str"},{"t":"eq","v":"Auto","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1210,"y":760,"wires":[["c1be037a.e09d3"],["9025c67b.9b6858"]]},{"id":"54e3b9ff.b145a8","type":"function","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Opening Determination","func":"\nvar opening_min = msg.opening_min;\nif (opening_min == null) {opening_min = 20;}\nvar opening = 100;\n\n\nif (msg.weather[0].attributes.forecast[0].condition == \"sunny\") \n {\n opening = opening_min;\n }\n \n\n\nmsg.opening = opening;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1250,"y":560,"wires":[["7f92ef8b.db24f"]]},{"id":"e11df07c.9b74c","type":"switch","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"True?","property":"is_azimuth","propertyType":"msg","rules":[{"t":"eq","v":"true","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1470,"y":460,"wires":[["54e3b9ff.b145a8"],["1504325c.29f4fe"]]},{"id":"7f92ef8b.db24f","type":"api-call-service","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Save opening","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.automatic_cover_{{id}}","data":"{\"value\":opening}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1220,"y":640,"wires":[["3dd06558.4b1c7a"]]},{"id":"c1be037a.e09d3","type":"api-call-service","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Set Auto","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"{{input_select.0.entity_id}}","data":"{\"option\":\"Auto\"}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1480,"y":700,"wires":[["422b64c3.68e51c"]]},{"id":"9025c67b.9b6858","type":"switch","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Last Position is -1?","property":"last_position[0].state","propertyType":"msg","rules":[{"t":"eq","v":"-1","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1190,"y":920,"wires":[["ee213cef.4a9dd"],["50f14e0d.81bc6"]]},{"id":"50f14e0d.81bc6","type":"switch","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Current = last?","property":"cover[0].attributes.current_position","propertyType":"msg","rules":[{"t":"eq","v":"last_position[0].state","vt":"msg"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1440,"y":940,"wires":[["422b64c3.68e51c"],["20c02a39.255c36"]]},{"id":"ee213cef.4a9dd","type":"switch","z":"89f218d7.aa0978","g":"3d4a6d42.363c12","name":"Current = 100?","property":"cover[0].attributes.current_position","propertyType":"msg","rules":[{"t":"eq","v":"100","vt":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1440,"y":860,"wires":[["422b64c3.68e51c"],["20c02a39.255c36"]]},{"id":"74685640.813718","type":"server","name":"Home Assistant","addon":true},{"id":"a3d84fb8.38362","type":"group","z":"89f218d7.aa0978","name":"Covers","style":{"fill":"#e3f3d3","label":true},"nodes":["793d8219.413c3c","6e4f632d.7f698c","445b010a.5d6a7"],"x":348,"y":53,"w":304,"h":1014},{"id":"793d8219.413c3c","type":"change","z":"89f218d7.aa0978","g":"a3d84fb8.38362","name":"sud","rules":[{"t":"set","p":"id","pt":"msg","to":"sud","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"110","tot":"num"},{"t":"set","p":"azimuth_max","pt":"msg","to":"230","tot":"num"},{"t":"set","p":"opening_min","pt":"msg","to":"25","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":520,"wires":[["2533a315.1def9c"]]},{"id":"6e4f632d.7f698c","type":"group","z":"89f218d7.aa0978","g":"a3d84fb8.38362","name":"Est","style":{"fill":"#ffffbf","label":true},"nodes":["d7a5d568.814168","71b185e7.8b152c","ac5b5e16.209fe","3e11173a.1e8b38","46151ee5.be99e","ee630115.8cf07","989ec058.547e4","d12fd595.351738","d1f25df0.a4ce6"],"x":374,"y":79,"w":232,"h":402},{"id":"d7a5d568.814168","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"vide_sur_sejour","rules":[{"t":"set","p":"id","pt":"msg","to":"vide_sur_sejour","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"83","tot":"num"},{"t":"set","p":"azimuth_max","pt":"msg","to":"110","tot":"num"},{"t":"set","p":"opening_min","pt":"msg","to":"25","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":440,"wires":[["2533a315.1def9c"]]},{"id":"71b185e7.8b152c","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"mezzanine","rules":[{"t":"set","p":"id","pt":"msg","to":"mezzanine","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"10","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"110","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":400,"wires":[[]]},{"id":"ac5b5e16.209fe","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"escalier","rules":[{"t":"set","p":"id","pt":"msg","to":"escalier","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"10","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"110","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":360,"wires":[[]]},{"id":"3e11173a.1e8b38","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"cuisine","rules":[{"t":"set","p":"id","pt":"msg","to":"cuisine","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"10","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"110","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":320,"wires":[[]]},{"id":"46151ee5.be99e","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"sdb","rules":[{"t":"set","p":"id","pt":"msg","to":"sdb","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"10","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"110","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":280,"wires":[[]]},{"id":"ee630115.8cf07","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"anthony","rules":[{"t":"set","p":"id","pt":"msg","to":"vide_sur_sejour","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"205","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"270","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":240,"wires":[[]]},{"id":"989ec058.547e4","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"velux_sdb","rules":[{"t":"set","p":"id","pt":"msg","to":"velux_sdb","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"90","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"215","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"15","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":200,"wires":[["2533a315.1def9c"]]},{"id":"d12fd595.351738","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"velux_chambre_est","rules":[{"t":"set","p":"id","pt":"msg","to":"velux_chambre_est","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"90","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"215","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"15","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":120,"wires":[["2533a315.1def9c"]]},{"id":"d1f25df0.a4ce6","type":"change","z":"89f218d7.aa0978","g":"6e4f632d.7f698c","name":"velux_sdj_est","rules":[{"t":"set","p":"id","pt":"msg","to":"velux_sdj_est","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"90","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"215","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"15","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":160,"wires":[["2533a315.1def9c"]]},{"id":"445b010a.5d6a7","type":"group","z":"89f218d7.aa0978","g":"a3d84fb8.38362","name":"Ouest","style":{"fill":"#ffffbf","label":true},"nodes":["1db9a926.7248d7","289583d4.90e80c","3312478c.5afc08","39c75d78.017d22","8536b819.199ec8","37a381d6.daca1e","aa37bb31.41bdc8","e3a25d07.93fa9","8d5c3001.f6ea3","4c75d0d0.c4ca8","dc69505e.5d14c"],"x":374,"y":559,"w":252,"h":482},{"id":"1db9a926.7248d7","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"bureau","rules":[{"t":"set","p":"id","pt":"msg","to":"bureau","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"205","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"270","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"25","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":600,"wires":[["2533a315.1def9c"]]},{"id":"289583d4.90e80c","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"oceane","rules":[{"t":"set","p":"id","pt":"msg","to":"oceane","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"205","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"270","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"25","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":640,"wires":[["2533a315.1def9c"]]},{"id":"3312478c.5afc08","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"parents","rules":[{"t":"set","p":"id","pt":"msg","to":"parents","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"205","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"270","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"25","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":680,"wires":[["2533a315.1def9c"]]},{"id":"39c75d78.017d22","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"sdb2","rules":[{"t":"set","p":"id","pt":"msg","to":"sdb2","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"205","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"270","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"25","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":720,"wires":[["2533a315.1def9c"]]},{"id":"8536b819.199ec8","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"salon","rules":[{"t":"set","p":"id","pt":"msg","to":"salon","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"180","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"265","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"40","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":760,"wires":[["2533a315.1def9c"]]},{"id":"37a381d6.daca1e","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"sam","rules":[{"t":"set","p":"id","pt":"msg","to":"sam","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"180","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"265","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"25","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":800,"wires":[["2533a315.1def9c"]]},{"id":"aa37bb31.41bdc8","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"wc","rules":[{"t":"set","p":"id","pt":"msg","to":"wc","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"220","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"270","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"40","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":840,"wires":[["2533a315.1def9c"]]},{"id":"e3a25d07.93fa9","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"buanderie","rules":[{"t":"set","p":"id","pt":"msg","to":"buanderie","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"180","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"265","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"20","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":880,"wires":[["2533a315.1def9c"]]},{"id":"8d5c3001.f6ea3","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"velux_chambre_ouest","rules":[{"t":"set","p":"id","pt":"msg","to":"velux_chambre_ouest","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"150","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"285","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"15","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1000,"wires":[["2533a315.1def9c"]]},{"id":"4c75d0d0.c4ca8","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"velux_escalier","rules":[{"t":"set","p":"id","pt":"msg","to":"velux_escalier","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"150","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"285","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"20","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":920,"wires":[["2533a315.1def9c"]]},{"id":"dc69505e.5d14c","type":"change","z":"89f218d7.aa0978","g":"445b010a.5d6a7","name":"velux_sdj_ouest","rules":[{"t":"set","p":"id","pt":"msg","to":"velux_sdj_ouest","tot":"str"},{"t":"set","p":"azimuth_min","pt":"msg","to":"150","tot":"str"},{"t":"set","p":"azimuth_max","pt":"msg","to":"285","tot":"str"},{"t":"set","p":"opening_min","pt":"msg","to":"15","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":960,"wires":[["2533a315.1def9c"]]},{"id":"be14a3e1.74fb","type":"group","z":"89f218d7.aa0978","name":"Moving is authorized","style":{"fill":"#e3f3d3","label":true},"nodes":["6ddb7261.bcd37c","422b64c3.68e51c"],"x":1634,"y":659,"w":272,"h":142},{"id":"6ddb7261.bcd37c","type":"api-call-service","z":"89f218d7.aa0978","g":"be14a3e1.74fb","name":"Set Cover Position","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"cover","service":"set_cover_position","entityId":"{{cover.0.entity_id}}","data":"{\"position\":opening}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1790,"y":760,"wires":[[]]},{"id":"422b64c3.68e51c","type":"switch","z":"89f218d7.aa0978","g":"be14a3e1.74fb","name":"Different Position ?","property":"cover[0].attributes.current_position","propertyType":"msg","rules":[{"t":"neq","v":"opening","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":1750,"y":700,"wires":[["6ddb7261.bcd37c"]]},{"id":"dd307ce0.a8cf7","type":"group","z":"89f218d7.aa0978","name":"Manual Action detected","style":{"fill":"#e3f3d3","label":true},"nodes":["20c02a39.255c36","3a54ba9a.cd6126"],"x":1634,"y":839,"w":272,"h":142},{"id":"20c02a39.255c36","type":"api-call-service","z":"89f218d7.aa0978","g":"dd307ce0.a8cf7","name":"Set Manual","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"{{input_select.0.entity_id}}","data":"{\"option\":\"Manual\"}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1730,"y":880,"wires":[["3a54ba9a.cd6126"]]},{"id":"3a54ba9a.cd6126","type":"api-call-service","z":"89f218d7.aa0978","g":"dd307ce0.a8cf7","name":"Last Position = -1","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.automatic_cover_{{id}}","data":"{\"value\": -1}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1790,"y":940,"wires":[[]]},{"id":"e0281d85.666e8","type":"group","z":"89f218d7.aa0978","name":"Daily Reset","style":{"fill":"#e3f3d3","label":true},"nodes":["505dfc38.ac3564","e53f536f.5acf1","f585d702.0bb268","78c48ab5.0b25e4"],"x":1114,"y":119,"w":252,"h":262},{"id":"505dfc38.ac3564","type":"inject","z":"89f218d7.aa0978","g":"e0281d85.666e8","name":"Every Day @ 10h","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 10 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1250,"y":160,"wires":[["e53f536f.5acf1"]]},{"id":"e53f536f.5acf1","type":"ha-get-entities","z":"89f218d7.aa0978","g":"e0281d85.666e8","server":"74685640.813718","name":"Input_selects","rules":[{"property":"entity_id","logic":"starts_with","value":"input_select.automatic_cover_","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"input_selects","output_results_count":1,"x":1230,"y":220,"wires":[["f585d702.0bb268"]]},{"id":"f585d702.0bb268","type":"switch","z":"89f218d7.aa0978","g":"e0281d85.666e8","name":"Manual?","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"Manual","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1220,"y":280,"wires":[["78c48ab5.0b25e4"]]},{"id":"78c48ab5.0b25e4","type":"api-call-service","z":"89f218d7.aa0978","g":"e0281d85.666e8","name":"Set Auto","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"{{payload.entity_id}}","data":"{\"option\":\"Auto\"}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1220,"y":340,"wires":[[]]},{"id":"e2c11f94.933bf","type":"group","z":"89f218d7.aa0978","name":"Exiting Azimuth","style":{"fill":"#e3f3d3","label":true},"nodes":["7b7580fe.fa75f","ca3832b.21fd7d","1504325c.29f4fe"],"x":1634,"y":419,"w":272,"h":202},{"id":"7b7580fe.fa75f","type":"api-call-service","z":"89f218d7.aa0978","g":"e2c11f94.933bf","name":"Open Cover","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"cover","service":"open_cover","entityId":"{{cover.0.entity_id}}","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1750,"y":580,"wires":[[]]},{"id":"ca3832b.21fd7d","type":"switch","z":"89f218d7.aa0978","g":"e2c11f94.933bf","name":"Current == last position ?","property":"cover[0].attributes.current_position","propertyType":"msg","rules":[{"t":"eq","v":"last_position[0].state","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":1770,"y":520,"wires":[["7b7580fe.fa75f"]]},{"id":"1504325c.29f4fe","type":"api-call-service","z":"89f218d7.aa0978","g":"e2c11f94.933bf","name":"Last Position = -1","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.automatic_cover_{{id}}","data":"{\"value\": -1}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1750,"y":460,"wires":[["ca3832b.21fd7d"]]},{"id":"f69917c1.8b92e8","type":"group","z":"89f218d7.aa0978","name":"Get Entities","style":{"fill":"#e3f3d3","label":true},"nodes":["2533a315.1def9c","2b0e8e2c.a4c022","f107645b.91bd98","198209a1.d03936","74fc100b.0c056"],"x":714,"y":479,"w":272,"h":402},{"id":"2533a315.1def9c","type":"ha-get-entities","z":"89f218d7.aa0978","g":"f69917c1.8b92e8","server":"74685640.813718","name":"Get Cover","rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t $entity().entity_id,\t \"cover.\" & id\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"cover","output_results_count":1,"x":800,"y":520,"wires":[["f107645b.91bd98"]]},{"id":"2b0e8e2c.a4c022","type":"ha-get-entities","z":"89f218d7.aa0978","g":"f69917c1.8b92e8","server":"74685640.813718","name":"Get Input_select","rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t $entity().entity_id,\t \"input_select.automatic_cover_\" & id\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"input_select","output_results_count":1,"x":840,"y":680,"wires":[["74fc100b.0c056"]]},{"id":"f107645b.91bd98","type":"ha-get-entities","z":"89f218d7.aa0978","g":"f69917c1.8b92e8","server":"74685640.813718","name":"Get Last Position","rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t $entity().entity_id,\t \"input_number.automatic_cover_\" & id\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"last_position","output_results_count":1,"x":850,"y":600,"wires":[["2b0e8e2c.a4c022"]]},{"id":"198209a1.d03936","type":"switch","z":"89f218d7.aa0978","g":"f69917c1.8b92e8","name":"Auto?","property":"input_select[0].state","propertyType":"msg","rules":[{"t":"cont","v":"Auto","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":910,"y":840,"wires":[["fbcf2a56.083e78"]]},{"id":"74fc100b.0c056","type":"ha-get-entities","z":"89f218d7.aa0978","g":"f69917c1.8b92e8","server":"74685640.813718","name":"Get Weather","rules":[{"property":"entity_id","logic":"is","value":"weather.wavrin","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"weather","output_results_count":1,"x":830,"y":760,"wires":[["198209a1.d03936"]]}]
Bloc « Covers »:
Ici je spécifie tous les volets que je souhaite automatiser.
Pour chacun d’entres eux, je spécifie les paramètres nécessaires à ce dernier, à savoir:
- L’id du volet (qui sera nécessaire pour récupérer l’entité cover, mais également les input_select et input_number précédents)
- L’azimuth min et max de chaquun d’entres eux (je reviens la dessus ci-dessous)
- L’ouverture minimale du volet (en fonction du volet, j’ai des besoins différents, par exemple dans le salon, je ne veux pas que le volet descende à moins de 40% car si jamais je suis dehors quand le volet descent, je souhaite pouvoir re rentrer chez moi :), je fais également une différence en fonction de la hauteur totale du volet, ou si c’est un velux)
Nb: Il est possible d’en ajouter d’autres selon les besoins, j’envisage par exemple d’ajouter un indicateur is_velux, ou encore une élévation minimale.
Bloc « Get Entities »
Ici je vais rechercher dans HA l’ensemble des entités nécessaires
Bloc « Azimuth Determinations »
Ici je fais les différentes déterminations dans le cas d’une gestion Azimuth.
Pour expliquer brièvement les étapes:
Tout d’abord je vérifie que je suis dans l’intervalle de l’Azimuth (c’est à dire que le soleil est orienté pour taper sur la fenêtre).
Puis je calcule l’ouverture cible (pour le moment je fais uniquement du soit 100%, soit valeur minimale paramétrée dans le cas ou il y a du soleil, je n’ai pas encore trouvé le calcul savant pour que cette ouverture soit proportionnelle à l’élévation du soleil, je suis preneur de tout conseil).
Je stocke la valeur calculée, puis,
J’autorise le mouvement si: Je suis en « Auto Forcé », ou que je suis en « Auto » et que le volet est positionné à 100% ou qu’il est positionné comme au dernier calcul, ou qu’il vient tout juste de rentrer dans l’intervalle de l"azimuth (last position = -1).
Sinon, c’est que le volet à été bougé manuellement et que dont il n’a pas à être bougé
Bloc « Existing Azimuth »
Je stocke que les conditions d’azimuth ne sont plus satisfaites (position -1), puis si le volet est à la position precedemment calculée, je l’ouvre.
Bloc « Moving is authorized »
Si le volet n’est pas positionné comme calculé, alors je bouge le volet à la cible calculée
Bloc « Manual action detected »
Je positionne l’input_select sur « Manual », et l’input_number sur -1.
Bloc « Daily Reset »
Tous les jours à heure fixe, je réarme tous les volets qui ont été passés en Manuel. Cela n’affecte pas ceux qui seraient en Manuel Forcé.
L’Azimuth:
Pour revenir un peu sur le sujet, je ne vais pas faire un cours dessus, il y a plein de sites qui le font très bien, mais juste vous donner la démarche que j’ai adoptée pour déterminer mes azimuth min et max.
Dans un premier temps, vous pouvez utiliser l’outil suivant (Calcul de la position du soleil dans le ciel pour chaque localisation à importe quel moment) qui vous donnera un ordre d’idée de départ.
Bon je ne prends plus l’exemple de l’Elysée comme @Yul car visiblement google le foute maintenant, on va donc prendre la mairie de paris sur une fenêtre coté sud:
En suite, et en fonction de la configuration de votre maison (arbres, épaisseur des murs, distance des caches moineaux, est ce que la fenêtre est inclinée comme sur un toit…), vous pouvez affiner une valeur qui corresponde au mieux à la configuration physique de votre maison (j’ai pour ma part guetté pendant une semaine le soleil sur mes fenêtres pour optimiser mes valeurs ).
La même chose est envisageable pour la partie « Elevation », mais je ne me suis pas penché sur la question.
Afin de piloter les modes en cours dans HA, j’ai regrouper cela dans une carte:
Cette solution n’est peut être pas parfaite, mais du moins pour le moment elle fonctionne correctement chez moi depuis quelques jours.
Si vous avez des suggestions d’amélioration, ou des questions, ou encore retours d’expériences similaires avec des supers calculs savants n’hésitez pas!
Ps: En tant que bon informaticien je n’ai pas encore pris assez de temps pour correctement faire ma documentation, donc veuillez m’excusé si je n’ai pas (encore du moins), mis toute la mise en forme dans ce post