Hey Guys, my aim is to turn the heating in my bathroom off, if anybody opens the window. And if the window get's closed, the Heating should restore the Temperature from before.
I put this thing together but unfortunately i have often the problem, that the variable tempsetprevbath is set to 11° which should only be the case while the window is open. It seems that anything in the flow sets the "open-setting" as default temperature.. Can you help me:
[{"id":"7c2d60d2.04a9a8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"90ed896d.43723","type":"filter","z":"7c2d60d2.04a9a8","name":"Sensorenfilter?","property":"payload.r","propertyType":"msg","asArray":false,"itemProperty":"","itemPropertyType":"item","rules":[{"t":"eq","v":"sensors","vt":"str","output":1}],"checkall":"true","outputs":1,"x":230,"y":160,"wires":[["b87a9151.edaac8"]]},{"id":"fe150591.914c1","type":"api-current-state","z":"7c2d60d2.04a9a8","name":"Status Badthermostat","server":"89ca3e9d.c3689","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"climate.danfoss_devolo_home_control_radiator_thermostat_heating_1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1080,"y":200,"wires":[["e941bdff.753838"]]},{"id":"e941bdff.753838","type":"function","z":"7c2d60d2.04a9a8","name":"","func":"var tempsetprevbath=msg.data.attributes.temperature; //Hole aktuell eingestellte Temperatur\nflow.set('tempsetprevbath',tempsetprevbath);\nmsg.payload = tempsetprevbath;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1260,"y":200,"wires":[["53768eb0.e2866"]]},{"id":"a8be5d7f.7a7c58","type":"api-call-service","z":"7c2d60d2.04a9a8","name":"Stelle 11° ein (Heizung off)","server":"89ca3e9d.c3689","version":1,"debugenabled":false,"service_domain":"climate","service":"set_temperature","entityId":"climate.danfoss_devolo_home_control_radiator_thermostat_heating_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1649,"y":200,"wires":[[]]},{"id":"6d3dee35.268b6","type":"switch","z":"7c2d60d2.04a9a8","name":"","property":"payload.state.open","propertyType":"msg","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":160,"wires":[["265bd25.1fbf42e"],["12a34d96.cdd842"]]},{"id":"265bd25.1fbf42e","type":"template","z":"7c2d60d2.04a9a8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"data\":{\"temperature\":\"{{{flow.tempsetprevbath}}}\" }\n }","output":"str","x":770,"y":120,"wires":[["7e6d8a10.7c8da4"]]},{"id":"7e6d8a10.7c8da4","type":"api-call-service","z":"7c2d60d2.04a9a8","name":"restore","server":"89ca3e9d.c3689","version":1,"debugenabled":false,"service_domain":"climate","service":"set_temperature","entityId":"climate.danfoss_devolo_home_control_radiator_thermostat_heating_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":900,"y":120,"wires":[["e0171bd7.2431f8"]]},{"id":"b87a9151.edaac8","type":"filter","z":"7c2d60d2.04a9a8","name":"Fensterkontakt Bad (ID:22)","property":"payload.id","propertyType":"msg","asArray":false,"itemProperty":"","itemPropertyType":"item","rules":[{"t":"eq","v":"22","vt":"str","output":1}],"checkall":"true","outputs":1,"x":450,"y":160,"wires":[["6d3dee35.268b6"]]},{"id":"53768eb0.e2866","type":"template","z":"7c2d60d2.04a9a8","name":"Template 12°","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"data\":{\"temperature\":\"11\" }\n }","output":"str","x":1439,"y":200,"wires":[["a8be5d7f.7a7c58"]]},{"id":"e0171bd7.2431f8","type":"delay","z":"7c2d60d2.04a9a8","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1069,"y":120,"wires":[["245619d2.5e55fe"]]},{"id":"245619d2.5e55fe","type":"api-current-state","z":"7c2d60d2.04a9a8","name":"","server":"89ca3e9d.c3689","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"Bad Heizung Status","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1319,"y":120,"wires":[["5c00c14e.e0a868"]]},{"id":"5c00c14e.e0a868","type":"switch","z":"7c2d60d2.04a9a8","name":"","property":"msg.data.attributes.temperature","propertyType":"msg","rules":[{"t":"eq","v":"11","vt":"num"},{"t":"neq","v":"11","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":1549,"y":120,"wires":[["5fc5063c.a018c8"],[]]},{"id":"5fc5063c.a018c8","type":"template","z":"7c2d60d2.04a9a8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n \"data\":{\"temperature\":\"{{{flow.tempsetprevbath}}}\" }\n }","output":"str","x":1699,"y":100,"wires":[["ecfe54.3f02b9b"]]},{"id":"ecfe54.3f02b9b","type":"api-call-service","z":"7c2d60d2.04a9a8","name":"restore","server":"89ca3e9d.c3689","version":1,"debugenabled":false,"service_domain":"climate","service":"set_temperature","entityId":"climate.danfoss_devolo_home_control_radiator_thermostat_heating_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1829,"y":100,"wires":[[]]},{"id":"12a34d96.cdd842","type":"delay","z":"7c2d60d2.04a9a8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":810,"y":200,"wires":[["fe150591.914c1"]]},{"id":"89ca3e9d.c3689","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]