-
Notifications
You must be signed in to change notification settings - Fork 0
/
Nodered_proxon_flow
1 lines (1 loc) · 30.4 KB
/
Nodered_proxon_flow
1
[{"id":"a5815ba7c7afa2f9","type":"tab","label":"HA-Proxon ","disabled":false,"info":"","env":[]},{"id":"1dde0404bec1be4b","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"State Changed: Helfer Offset Temperatur","server":"d0108cd6.fca61","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"input_number.helper_offset_temperatur_","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":100,"wires":[["24eb724af6d3cf94"]]},{"id":"574595b4df5539b0","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"Modbus Write Register - Offset Temperatur","server":"d0108cd6.fca61","version":5,"debugenabled":false,"domain":"modbus","service":"write_register","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":250,"y":280,"wires":[[]]},{"id":"62f42978d07d6714","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"State Changed: Proxon Offset Temperatur","server":"d0108cd6.fca61","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"sensor.offsettemperatur_*","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":460,"wires":[["3262012e7a87e484"]]},{"id":"5fcfe3ca85664ac8","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"HA Wert setzen - Helfer Offset Temperatur","server":"d0108cd6.fca61","version":5,"debugenabled":true,"domain":"input_number","service":"set_value","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":240,"y":620,"wires":[[]]},{"id":"24eb724af6d3cf94","type":"function","z":"a5815ba7c7afa2f9","name":"Modbus Address & Register Value bestimmen","func":"//16Bit -> 65536 \n//With 16 bits, you have 2^16 possibilities = 65536.\n//half of them are used for negative numbers, which have the most significant bit set to 1 (negative). So the range goes from -32768 to (and including) +32767. Note that the ‘positive’ numbers start at 0.\n\n\n//{\t \n// \"address\":msg.payload.address,\n// \"unit\":\"41\",\n// \"value\": msg.payload.value,\n// \"hub\":\"proxon\"\n// }\nvar inputTopic = msg.topic;\nvar outputAddress = \"\";\n\nswitch (inputTopic) {\n case \"input_number.helper_offset_temperatur_yannic\": outputAddress = 213; break;\n case \"input_number.helper_offset_temperatur_flur\": outputAddress = 214; break;\n case \"input_number.helper_offset_temperatur_arbeitszimmer\": outputAddress = 215; break;\n case \"input_number.helper_offset_temperatur_schlafen\": outputAddress = 216; break;\n case \"input_number.helper_offset_temperatur_schlafzimmer\": outputAddress = 217; break;\n case \"input_number.helper_offset_temperatur_kizi\": outputAddress = 218; break;\n case \"input_number.helper_clima_arbeitszimmer\": outputAddress = 215; break;\n case \"input_number.helper_clima_flur\": outputAddress = 214; break;\n case \"input_number.helper_clima_kinderzimmer\": outputAddress = 218; break;\n case \"input_number.helper_clima_schlafzimmer\": outputAddress = 217; break;\n case \"input_number.helper_clima_playroom\": outputAddress = 213; break;\n case \"input_number.helper_clima_wohnzimmer\": outputAddress = 70; break;\n}\n\n\nvar inputValue = msg.payload | 0;\nvar outputValue = 0;\n\nswitch (inputValue) {\n case -3: outputValue = 65533; break;\n case -2: outputValue = 65534; break;\n case -1: outputValue = 65535; break;\n default: outputValue = inputValue; break;\n}\n\nif (outputAddress == '70')\n (outputValue = outputValue * 100 )\n\nmsg.payload = {\n \"data\": {\n \"address\": outputAddress,\n \"unit\":\"41\",\n \"value\": outputValue,\n \"hub\":\"proxon\"\n }\n}\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":240,"y":220,"wires":[["574595b4df5539b0"]]},{"id":"9236b01255486a4d","type":"comment","z":"a5815ba7c7afa2f9","name":"Setzen der Offset Temperatur via HA","info":"","x":160,"y":40,"wires":[]},{"id":"febee0a47b390b45","type":"comment","z":"a5815ba7c7afa2f9","name":"Setzen der Offset Temperatur via Proxon","info":"","x":180,"y":400,"wires":[]},{"id":"275bd77bcf9042d9","type":"comment","z":"a5815ba7c7afa2f9","name":"Setzen Wassertank Temp via HA","info":"","x":150,"y":680,"wires":[]},{"id":"c42ec7c4de9fc41b","type":"function","z":"a5815ba7c7afa2f9","name":"Modbus Address & Register Value bestimmen","func":"//16Bit -> 65536 \n//With 16 bits, you have 2^16 possibilities = 65536.\n//half of them are used for negative numbers, which have the most significant bit set to 1 (negative). So the range goes from -32768 to (and including) +32767. Note that the ‘positive’ numbers start at 0.\n\n\n//{\t \n// \"address\":msg.payload.address,\n// \"unit\":\"41\",\n// \"value\": msg.payload.value,\n// \"hub\":\"proxon\"\n// }\nvar inputTopic = msg.topic;\nvar outputAddress = \"0.0\" ;\n\nvar inputValue = msg.payload;\n\nswitch (inputTopic) {\n case \"input_number.helper_wasser_temperatur\": outputAddress = 2000; break;\n case \"input_number.helper_wasser_temperatur_booster\": outputAddress = 2003; break;\n \n}\n\nlet number = Number(inputValue)*10;\n\nmsg.payload = {\n \"data\": {\n \"address\": outputAddress,\n \"unit\":\"41\",\n \"value\": number,\n \"hub\":\"proxon\"\n }\n}\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":860,"wires":[["162277c14643f410"]]},{"id":"162277c14643f410","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"Modbus Write Register - Wassetemperatur","server":"d0108cd6.fca61","version":5,"debugenabled":true,"domain":"modbus","service":"write_register","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":310,"y":940,"wires":[[]]},{"id":"dcd829021694cc2a","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"State Changed: Proxon Offset Temperatur","server":"d0108cd6.fca61","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"sensor.soll_temperatur_wasser","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":1080,"wires":[["949150394525c307"]]},{"id":"d27f16b7d687227e","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"HA Wert setzen - Helfer Wasser Temperatur","server":"d0108cd6.fca61","version":5,"debugenabled":true,"domain":"input_number","service":"set_value","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":250,"y":1240,"wires":[[]]},{"id":"1a78a33a98ad5c49","type":"comment","z":"a5815ba7c7afa2f9","name":"Setzen der Wassertemperatur via Proxon","info":"","x":180,"y":1020,"wires":[]},{"id":"949150394525c307","type":"function","z":"a5815ba7c7afa2f9","name":"HA Entity & Wert bestimmen","func":"var inputEntity = JSON.parse(JSON.stringify(msg.data)).entity_id;\nvar inputValueOld = JSON.parse(JSON.stringify(msg.data)).old_state.state;\nvar inputValueNew = JSON.parse(JSON.stringify(msg.data)).new_state.state;\n\n\nvar outputEntity = \"\";\n\nswitch (inputEntity) {\n case \"sensor.soll_temperatur_wasser\": outputEntity = \"input_number.helper_wasser_temperatur\"; break;\n case \"sensor.temperatur_schwelle_heizstab_wasser\": outputEntity = \"input_number.helper_wasser_temperatur_booster\"; break;\n default: fail;\n}\n\n\n//var outputValue = 0.0;\n\nif (inputValueOld == inputValueNew) {\n fail;\n} else {\n var outputValue = inputValueNew;\n}\n\n\nmsg.payload = {\n \"data\": {\n \"entity_id\": outputEntity,\n \"value\": outputValue\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":180,"y":1160,"wires":[["d27f16b7d687227e"]]},{"id":"bea4efe3c2556c03","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"State Changed: Helfer Wasser Temperatur","server":"d0108cd6.fca61","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"input_number.helper_wasser_temperatur*","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":740,"wires":[["c42ec7c4de9fc41b"]]},{"id":"8c68cdee9cbdae8b","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"State Changed: Proxon Booster Temperatur","server":"d0108cd6.fca61","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"sensor.temperatur_schwelle_heizstab_wasser","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":1360,"wires":[["0acc7ca4d026a243"]]},{"id":"3e86298ad9a77ad4","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"HA Wert setzen - Helfer Booster Temperatur","server":"d0108cd6.fca61","version":5,"debugenabled":true,"domain":"input_number","service":"set_value","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":250,"y":1520,"wires":[[]]},{"id":"f25a88ad74fa6a03","type":"comment","z":"a5815ba7c7afa2f9","name":"Setzen der Booster Wassertemperatur via Proxon","info":"","x":200,"y":1300,"wires":[]},{"id":"0acc7ca4d026a243","type":"function","z":"a5815ba7c7afa2f9","name":"HA Entity & Wert bestimmen","func":"var inputEntity = JSON.parse(JSON.stringify(msg.data)).entity_id;\nvar inputValueOld = JSON.parse(JSON.stringify(msg.data)).old_state.state;\nvar inputValueNew = JSON.parse(JSON.stringify(msg.data)).new_state.state;\n\n\nvar outputEntity = \"\";\n\nswitch (inputEntity) {\n case \"sensor.soll_temperatur_wasser\": outputEntity = \"input_number.helper_wasser_temperatur\"; break;\n case \"sensor.temperatur_schwelle_heizstab_wasser\": outputEntity = \"input_number.helper_wasser_temperatur_booster\"; break;\n default: fail;\n}\n\n\n//var outputValue = 0.0;\n\nif (inputValueOld == inputValueNew) {\n fail;\n} else {\n var outputValue = inputValueNew;\n}\n\n\nmsg.payload = {\n \"data\": {\n \"entity_id\": outputEntity,\n \"value\": outputValue\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":180,"y":1440,"wires":[["3e86298ad9a77ad4"]]},{"id":"6b80853f46549c8b","type":"comment","z":"a5815ba7c7afa2f9","name":"Automatisierungen Wassertemp","info":"","x":1130,"y":20,"wires":[]},{"id":"a35b028ebcda8d5f","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"e3dc_grid_power_neg2pos_only","server":"19ba0d47.328053","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"sensor.e3dc_grid_power_neg2pos_only","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"500","ifStateType":"num","ifStateOperator":"gt","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":1130,"y":80,"wires":[["d6befbb906c2fcf8","83a8a981314f9934","daf575b93f830ffb","a01015153433bd97"],[]]},{"id":"d6befbb906c2fcf8","type":"debug","z":"a5815ba7c7afa2f9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1510,"y":60,"wires":[]},{"id":"83a8a981314f9934","type":"debug","z":"a5815ba7c7afa2f9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":1500,"y":100,"wires":[]},{"id":"daf575b93f830ffb","type":"debug","z":"a5815ba7c7afa2f9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data","targetType":"msg","statusVal":"","statusType":"auto","x":1500,"y":140,"wires":[]},{"id":"a01015153433bd97","type":"switch","z":"a5815ba7c7afa2f9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1490,"y":200,"wires":[[]]},{"id":"bb6e5309e8430305","type":"function","z":"a5815ba7c7afa2f9","name":"","func":"var inputEntity = JSON.parse(JSON.stringify(msg.data)).entity_id;\nvar inputValueOld = JSON.parse(JSON.stringify(msg.data)).old_state.state;\nvar inputValueNew = JSON.parse(JSON.stringify(msg.data)).new_state.state;\n\n\nvar istWassertemperatur =\"\";\nvar sollWassertemperatur =\"\";\n\nswitch (inputEntity) {\n case \"sensor.temperatur_schwelle_heizstab_wasser\": sollWassertemperatur = inputValueNew; break;\n case \"sensor.temperatur_wasser\": istWassertemperatur = inputValueNew; break;\n default: fail;\n}\n\n\nvar bool = \"\";\n\nif (istWassertemperatur => sollWassertemperatur) {\n bool = true;\n} else {\n bool = false;\n}\n\n\nmsg.payload = {\n \"data\": {\n \"value\": bool\n }\n}\n\nreturn msg;","outputs":1,"noerr":3,"initialize":"","finalize":"","libs":[],"x":1460,"y":500,"wires":[["2c38b80664a82773","2f58ba696ee474a4"]]},{"id":"905c3e747b449577","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"","server":"19ba0d47.328053","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"sensor.temperatur_wasser","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":1110,"y":440,"wires":[["bb6e5309e8430305"]]},{"id":"62517845ac37a36b","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"","server":"19ba0d47.328053","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"sensor.temperatur_schwelle_heizstab_wasser","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":1230,"y":540,"wires":[["bb6e5309e8430305"]]},{"id":"d465c3e0cc29bbb7","type":"debug","z":"a5815ba7c7afa2f9","name":"nach switch","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":2170,"y":440,"wires":[]},{"id":"cf35ef291f1645dc","type":"debug","z":"a5815ba7c7afa2f9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":2220,"y":180,"wires":[]},{"id":"dfa49fd8741ce6f1","type":"debug","z":"a5815ba7c7afa2f9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"data","targetType":"msg","statusVal":"","statusType":"auto","x":2220,"y":260,"wires":[]},{"id":"2f58ba696ee474a4","type":"switch","z":"a5815ba7c7afa2f9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1750,"y":300,"wires":[["582b3094941199d2","d465c3e0cc29bbb7"],["d465c3e0cc29bbb7"]]},{"id":"582b3094941199d2","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"","server":"19ba0d47.328053","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.heizelement_wasser"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1940,"y":240,"wires":[["cf35ef291f1645dc","dfa49fd8741ce6f1"]]},{"id":"9a22fb274703d8f4","type":"debug","z":"a5815ba7c7afa2f9","name":"nach Change","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1790,"y":460,"wires":[]},{"id":"2c38b80664a82773","type":"debug","z":"a5815ba7c7afa2f9","name":"nach function","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1670,"y":560,"wires":[]},{"id":"3d0c1bebb8f94151","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"State Changed: Helfer Clima","server":"d0108cd6.fca61","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"input_number.helper_clima_","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":160,"wires":[["24eb724af6d3cf94"]]},{"id":"ade79f3ac433fee3","type":"comment","z":"a5815ba7c7afa2f9","name":"Setzen der Offset Temperatur via HA","info":"","x":660,"y":40,"wires":[]},{"id":"3262012e7a87e484","type":"function","z":"a5815ba7c7afa2f9","name":"HA Entity & Wert bestimmen","func":"var inputEntity = JSON.parse(JSON.stringify(msg.data)).entity_id;\nvar inputValueOld = JSON.parse(JSON.stringify(msg.data)).old_state.state;\nvar inputValueNew = JSON.parse(JSON.stringify(msg.data)).new_state.state;\n\n\nvar outputEntity = \"\";\n\nswitch (inputEntity) {\n \n \n case \"sensor.offsettemperatur_nbp_arbeitszimmer\": outputEntity = \"input_number.helper_clima_arbeitszimmer\"; break;\n case \"sensor.offsettemperatur_nbp_flur\": outputEntity = \"input_number.helper_clima_flur\"; break;\n case \"sensor.offsettemperatur_nbp_yannic\": outputEntity = \"input_number.helper_clima_playroom\"; break;\n case \"sensor.offsettemperatur_nbp_schlafen\": outputEntity = \"input_number.helper_clima_schlafzimmer\"; break;\n case \"sensor.offsettemperatur_nbp_kizi\": outputEntity = \"input_number.helper_clima_kinderzimmer\"; break;\n\n}\n\n\n//var outputValue = 0;\n\nif (inputValueOld == inputValueNew) ;\n else { var outputValue = inputValueNew };\n\n\nmsg.payload = {\n \"data\": {\n \"entity_id\": outputEntity,\n \"value\": outputValue\n }\n}\n\nreturn msg;","outputs":1,"timeout":"","noerr":1,"initialize":"","finalize":"","libs":[],"x":220,"y":540,"wires":[["5fcfe3ca85664ac8"]]},{"id":"0f6c660fa60d86a9","type":"comment","z":"a5815ba7c7afa2f9","name":"Heizmodus Climate an / aus","info":"","x":140,"y":1580,"wires":[]},{"id":"97972f5674e5ce45","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"Climate Change","server":"fea0b72a.a4cd68","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"climate.heizung","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":1620,"wires":[["28520817d7be320d"]]},{"id":"28520817d7be320d","type":"function","z":"a5815ba7c7afa2f9","name":"Climate zu Heizelement umsetzen & Service Typ bestimmen","func":"\nvar inputTopic = msg.topic;\nvar output = \"\";\n\nswitch (inputTopic) {\n case \"climate.heizung_flur\": output = \"switch.heizelement_flur\"; break;\n case \"climate.heizung_arbeitszimmer\": output = \"switch.heizelement_arbeitszimmer\"; break;\n case \"climate.heizung_kinderzimmer\": output = \"switch.heizelement_kizi\"; break;\n case \"climate.heizung_playroom\": output = \"switch.heizelement_yannic_zone2\"; break;\n case \"climate.heizung_schlafzimmer\": output = \"switch.heizelement_schlafen\"; break;\n case \"climate.heizung_wohnzimmer\": output = \"switch.heizelement_wohnzimmer_zone1\"; break;\n}\n\n\nvar inputValue = msg.payload ;\nvar outputValue = \"\";\n\n\nswitch (inputValue) {\n case \"auto\": outputValue = \"turn_off\"; break;\n case \"heat\": outputValue = \"turn_on\"; break;\n case \"cool\": outputValue = \"cool\";break;\n}\n\nvar msg1 = { payload: 1 };\nvar msg2 = { payload: 2 };\n\nif (outputValue != \"cool\" ) {\n \n msg1.payload = {\n \"domain\": \"switch\",\n \"service\": outputValue,\n \"target\": {\n \"entity_id\": output\n } \n }\n msg2.payload = {\n \"domain\": \"switch\",\n \"service\": \"turn_off\",\n \"target\": {\n \"entity_id\": \"switch.kuhlung_global\" \n }\n }\n\n node.send([msg1, msg2]);\n} else if (outputValue == 'cool') {\n msg1.payload = {\n \"domain\": \"switch\",\n \"service\": \"turn_on\",\n \"target\": {\n \"entity_id\": \"switch.kuhlung_global\"\n } \n } \n msg2.payload = {\n \"domain\": \"switch\",\n \"service\": \"turn_off\",\n \"target\": {\n \"entity_id\": \"switch.heizelemente_alle\"\n }\n } \n node.send([msg1, msg2]);\n}\n\n return \n\n\n","outputs":2,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":1760,"wires":[["254727a04516c0bf"],["07d33c2a5b51126b"]]},{"id":"254727a04516c0bf","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"","server":"fea0b72a.a4cd68","version":5,"debugenabled":true,"domain":"switch","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"all","x":480,"y":1840,"wires":[[]]},{"id":"85aa09eeece0aae3","type":"comment","z":"a5815ba7c7afa2f9","name":"Manuelles Eischalten der Heizelemente","info":"","x":150,"y":1940,"wires":[]},{"id":"526343ecbdf07393","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"","server":"fea0b72a.a4cd68","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"switch.heizelement","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":2020,"wires":[["37dad7a0c77d8360"]]},{"id":"ace9637e9223f900","type":"function","z":"a5815ba7c7afa2f9","name":"Climate zu Heizelement umsetzen & Service Typ bestimmen","func":"// @ts-nocheck\n\nvar inputTopic = msg.topic;\nvar output = \"\";\n\n\nswitch (inputTopic) {\n case \"switch.heizelement_flur\": output = \"climate.heizung_flur\"; break;\n case \"switch.heizelement_arbeitszimmer\": output = \"climate.heizung_arbeitszimmer\"; break;\n case \"switch.heizelement_kizi\": output = \"climate.heizung_kinderzimmer\"; break;\n case \"switch.heizelement_yannic_zone2\": output = \"climate.heizung_playroom\"; break;\n case \"switch.heizelement_schlafen\": output = \"climate.heizung_schlafzimmer\"; break;\n case \"switch.heizelement_wohnzimmer_zone1\": output = \"climate.heizung_wohnzimmer\"; break\n}\n\n\nvar inputValue = msg.payload ;\nvar outputValue = \"\";\n\nswitch (inputValue) {\n case \"off\": outputValue = \"auto\"; break;\n case \"on\": outputValue = \"heat\"; break;\n\n}\n\n\n\n\nmsg.payload = {\n\n \"data\": {\n \"hvac_mode\": outputValue,\n },\n \"target\": {\n \"entity_id\": output,\n }\n\n }\n\n\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":2160,"wires":[["ef1252fd90aa26ae"]]},{"id":"ef1252fd90aa26ae","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"","server":"fea0b72a.a4cd68","version":5,"debugenabled":true,"domain":"climate","service":"set_hvac_mode","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":2200,"wires":[[]]},{"id":"37dad7a0c77d8360","type":"function","z":"a5815ba7c7afa2f9","name":"Filter Gruppe EG / OG","func":"var inputTopic = msg.topic;\n\nif (inputTopic != \"switch.heizelemente_eg\")\nif (inputTopic != \"switch.heizelemente_og\")\nif (inputTopic != \"switch.heizelemente_alle\")\nreturn [msg];","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":2080,"wires":[["ace9637e9223f900"]]},{"id":"0d51472c700bcd3b","type":"server-state-changed","z":"a5815ba7c7afa2f9","name":"","server":"fea0b72a.a4cd68","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"climate.heizung_","entityIdType":"regex","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":2300,"wires":[[]]},{"id":"07d33c2a5b51126b","type":"api-call-service","z":"a5815ba7c7afa2f9","name":"","server":"fea0b72a.a4cd68","version":5,"debugenabled":true,"domain":"switch","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"all","x":480,"y":1900,"wires":[[]]},{"id":"d0108cd6.fca61","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"19ba0d47.328053","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"fea0b72a.a4cd68","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]