Après quelques temps d’utilisation, je me suis aperçu que dans le temps, l’ouverture de mes vannes 3 voies n’étaient pas toujours synchro, c’est à dire que le retour d’état calculé, n’est pas dans 100% des cas exacte à l’état réel. Pour ce faire, j’ai rajouté une fonctionnalité de reset dans le cas ou je détecte un souci.
J’ai par ailleurs un peu revu le flow pour simplifier les choses avec mes 3 zones, voici donc ma dernière version en date:
[{"id":"481ec58f.8415ac","type":"inject","z":"c8f6bacd.b33d38","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":270,"y":260,"wires":[["86761f8f.073","34a9054e.0b5baa","bd9c8f73.16bcf"]]},{"id":"86761f8f.073","type":"change","z":"c8f6bacd.b33d38","name":"rdc","rules":[{"t":"set","p":"id","pt":"msg","to":"rdc","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":200,"wires":[["311b7eb.d2b2b82"]]},{"id":"3c239f68.17c82","type":"api-call-service","z":"c8f6bacd.b33d38","name":"Set position","server":"74685640.813718","version":1,"debugenabled":false,"service_domain":"cover","service":"set_cover_position","entityId":"{{servo.0.entity_id}}","data":"{\"position\": \"{{payload}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1730,"y":240,"wires":[[]]},{"id":"34a9054e.0b5baa","type":"change","z":"c8f6bacd.b33d38","name":"etage","rules":[{"t":"set","p":"id","pt":"msg","to":"etage","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":260,"wires":[["311b7eb.d2b2b82"]]},{"id":"bd9c8f73.16bcf","type":"change","z":"c8f6bacd.b33d38","name":"grenier","rules":[{"t":"set","p":"id","pt":"msg","to":"grenier","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":320,"wires":[["311b7eb.d2b2b82"]]},{"id":"1d8796c7.5c8b79","type":"group","z":"c8f6bacd.b33d38","name":"Resynchronize V3V","style":{"stroke":"#bfbfbf","label":true,"fill":"#ffdf7f"},"nodes":["5688ce36.8a127","f29fbce4.34fd5","7c7c1ef3.c9f55","1d8c1ae2.7e7225"],"x":934,"y":259,"w":672,"h":82},{"id":"5688ce36.8a127","type":"delay","z":"c8f6bacd.b33d38","g":"1d8796c7.5c8b79","name":"Wait 7 min","pauseType":"delay","timeout":"7","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1030,"y":300,"wires":[["f29fbce4.34fd5"]]},{"id":"f29fbce4.34fd5","type":"function","z":"c8f6bacd.b33d38","g":"1d8796c7.5c8b79","name":"Resynchronize?","func":"const depart = msg.depart[0].state;\nconst retour = msg.retour[0].state;\nconst delta = msg.delta;\n\nif (retour >= depart && delta >=0.5)\n {msg.payload = 'yes';}\nelse\n {msg.payload = 'no';}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":300,"wires":[["7c7c1ef3.c9f55"]]},{"id":"7c7c1ef3.c9f55","type":"switch","z":"c8f6bacd.b33d38","g":"1d8796c7.5c8b79","name":"Yes","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"yes","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1350,"y":300,"wires":[["1d8c1ae2.7e7225"]]},{"id":"1d8c1ae2.7e7225","type":"function","z":"c8f6bacd.b33d38","g":"1d8796c7.5c8b79","name":"Calc Resynchro","func":"\nvar actual = msg.servo[0].attributes.current_position\nvar resynchro;\n\n\nif (actual >= 50)\n {resynchro = 0;}\nelse\n {resynchro = 100;}\n\nmsg.payload = resynchro;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1500,"y":300,"wires":[["3c239f68.17c82"]]},{"id":"7504cd73.3591a4","type":"group","z":"c8f6bacd.b33d38","name":"V3V Opening determination","style":{"label":true,"fill":"#bfdbef"},"nodes":["aedb1506.d92e38","d7e19dde.a7d8a","b0cadb6c.8bde08"],"x":934,"y":159,"w":672,"h":82},{"id":"aedb1506.d92e38","type":"function","z":"c8f6bacd.b33d38","g":"7504cd73.3591a4","name":"Calc Delta","func":"\nvar consigne = msg.climate[0].attributes.temperature;\nvar mesure = msg.climate[0].attributes.current_temperature;\nvar delta = consigne - mesure;\n\nmsg.delta = delta;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1030,"y":200,"wires":[["d7e19dde.a7d8a"]]},{"id":"d7e19dde.a7d8a","type":"function","z":"c8f6bacd.b33d38","g":"7504cd73.3591a4","name":"Calc ouverture","func":"var ouverture = 0;\nvar delta = msg.delta;\n\nif (delta > 1) {ouverture = 100;}\nelse if (delta >= 0.6) {ouverture = 75;}\nelse if (delta >= 0.2) {ouverture = 50;}\nelse if (delta >= -0.2) {ouverture = 25;}\n\n\nmsg.payload = ouverture;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1260,"y":200,"wires":[["b0cadb6c.8bde08","5688ce36.8a127"]]},{"id":"b0cadb6c.8bde08","type":"switch","z":"c8f6bacd.b33d38","g":"7504cd73.3591a4","name":"Different Position?","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"servo[0].attributes.current_position","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":1490,"y":200,"wires":[["3c239f68.17c82"]]},{"id":"b556dd66.0c4bf","type":"group","z":"c8f6bacd.b33d38","name":"Get Entities","style":{"label":true,"fill":"#c8e7a7"},"nodes":["311b7eb.d2b2b82","fa449613.e9f488","db909287.2c959","943c66af.d93568"],"x":654,"y":119,"w":192,"h":262},{"id":"311b7eb.d2b2b82","type":"ha-get-entities","z":"c8f6bacd.b33d38","g":"b556dd66.0c4bf","server":"74685640.813718","name":"Get Climate","rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t $entity().entity_id,\t \"climate.\" & id\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"climate","output_results_count":1,"x":750,"y":160,"wires":[["943c66af.d93568"]]},{"id":"fa449613.e9f488","type":"ha-get-entities","z":"c8f6bacd.b33d38","g":"b556dd66.0c4bf","server":"74685640.813718","name":"Get Depart","rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t $entity().entity_id,\t \"sensor.pc_\" & id & \"_temperature_depart\"\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"depart","output_results_count":1,"x":750,"y":280,"wires":[["db909287.2c959"]]},{"id":"db909287.2c959","type":"ha-get-entities","z":"c8f6bacd.b33d38","g":"b556dd66.0c4bf","server":"74685640.813718","name":"Get Retour","rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t $entity().entity_id,\t \"sensor.pc_\" & id & \"_temperature_retour\"\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"retour","output_results_count":1,"x":750,"y":340,"wires":[["aedb1506.d92e38"]]},{"id":"943c66af.d93568","type":"ha-get-entities","z":"c8f6bacd.b33d38","g":"b556dd66.0c4bf","server":"74685640.813718","name":"Get Servo","rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t $entity().entity_id,\t \"cover.servomoteur_\" & id\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"servo","output_results_count":1,"x":740,"y":220,"wires":[["fa449613.e9f488"]]},{"id":"74685640.813718","type":"server","name":"Home Assistant","addon":true}]