HDL Smartbus via NodeRed and MQTT

Its the Floorheat Update/Answer from Heatmodule the error is on.


You can see that it changes after som refreshes.

Yes you were correct. Only it wont support changing between cooling and heating without doing some more coding but if you only have heating cables the type would always be 0(Heating). Should not be to hard to implement cooling as well, but will just keep it to heating for now and if anybody needs cooling it will have to be changed later.

Have changed to “work.status” on all the places needed i think. Also added the missing “/” between device id and channel in the context store. (My OCD kicking in)

[{"id":"d409d0a29f7f44cf","type":"tab","label":"hdl-mfh06 test","disabled":false,"info":"","env":[]},{"id":"f7688362d4a6624e","type":"function","z":"d409d0a29f7f44cf","name":"Dimmer or Relay Answer","func":"if (msg.payload.success == true) \n {\n    msg.topic = \"hdl/sc/\" + msg.sender + \"/\" + msg.payload.channel;\n    return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":100,"wires":[["c60be061e5ba0eac"]]},{"id":"90916b69f59f3b88","type":"function","z":"d409d0a29f7f44cf","name":"Dimmer or Relay Read","func":"var outputMsgs = [];\nif (msg.code == 52) {\n    for (i = 0; i < msg.payload.channels.length; i++) {\n          outputMsgs.push({\n          topic:\"hdl/sc/\" + msg.sender + \"/\" + msg.payload.channels[i].number,\n          payload:{\n              level:msg.payload.channels[i].level\n              \n          }\n      });\n    }\n    return [ outputMsgs ];\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":140,"wires":[["c60be061e5ba0eac"]]},{"id":"e6e91e6c6531d2e7","type":"mqtt out","z":"d409d0a29f7f44cf","name":"Status updates to MQTT","topic":"","qos":"0","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d110fe62.0ec2","x":990,"y":380,"wires":[]},{"id":"c60be061e5ba0eac","type":"range","z":"d409d0a29f7f44cf","minin":"0","maxin":"100","minout":"0","maxout":"255","action":"scale","round":true,"property":"payload.level","name":"","x":730,"y":100,"wires":[["e6e91e6c6531d2e7"]]},{"id":"7aed38565deb1c0c","type":"function","z":"d409d0a29f7f44cf","name":"Sensor Status Broadcasts","func":"var outputMsgs = [];\nif (msg.code == 5703) \n{\n    {\n        outputMsgs.push\n        ({\n          topic:\"hdl/temp/\" + msg.sender + \"/1\",\n          payload : msg.payload.temperature\n        });\n\n        outputMsgs.push\n        ({\n          topic:\"hdl/lux/\" + msg.sender + \"/lux\",\n           payload : msg.payload.brightness\n        });\n    }\n    return [ outputMsgs ];\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":380,"wires":[["e6e91e6c6531d2e7"]]},{"id":"bc29607c9c88a3a2","type":"hdl-raw-in","z":"d409d0a29f7f44cf","controller":"6e986e87.b7a2a","name":"From HDL","x":100,"y":480,"wires":[["cf22a85c315dec13"]]},{"id":"f4b85abf981827f6","type":"comment","z":"d409d0a29f7f44cf","name":"Feedback from HDL to MQTT","info":"","x":160,"y":40,"wires":[]},{"id":"102349dc9bae18da","type":"comment","z":"d409d0a29f7f44cf","name":"Single Channel Status","info":"","x":500,"y":60,"wires":[]},{"id":"34ac95eea1ee0cae","type":"comment","z":"d409d0a29f7f44cf","name":"Sensor Status Broadcasts Lux and Temp","info":"","x":560,"y":340,"wires":[]},{"id":"49f79449d95f025a","type":"mqtt in","z":"d409d0a29f7f44cf","name":"From MQTT","topic":"hdl/+/+/+/set","qos":"0","datatype":"auto","broker":"d110fe62.0ec2","nl":false,"rap":false,"inputs":0,"x":110,"y":1280,"wires":[["9b2e5f67d92eb556"]]},{"id":"565bad86310d0418","type":"json","z":"d409d0a29f7f44cf","name":"","property":"payload","action":"obj","pretty":true,"x":470,"y":1100,"wires":[["54c54c0e99f07499"]]},{"id":"54c54c0e99f07499","type":"range","z":"d409d0a29f7f44cf","minin":"0","maxin":"255","minout":"0","maxout":"100","action":"scale","round":true,"property":"payload.level","name":"","x":590,"y":1100,"wires":[["12f503b35aeff61c"]]},{"id":"12f503b35aeff61c","type":"function","z":"d409d0a29f7f44cf","name":"Light or Relay","func":"msg.code = 49;\n\nmsg.target = msg.topic.split(\"/\")[2];\nvar time = msg.payload.time;\nvar level = Math.min(Math.max(parseInt(msg.payload.level), 0), 100);\n\nmsg.payload = {\n    channel: msg.topic.split(\"/\")[3],\n    time: time,\n    level: level,\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":760,"y":1100,"wires":[["fef4ca11f287479d"]]},{"id":"48b0310ebeba4ba1","type":"comment","z":"d409d0a29f7f44cf","name":"Commands from MQTT to HDL","info":"","x":170,"y":1020,"wires":[]},{"id":"9b2e5f67d92eb556","type":"switch","z":"d409d0a29f7f44cf","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"hdl/sc/","vt":"str"},{"t":"cont","v":"hdl/us/","vt":"str"},{"t":"cont","v":"hdl/fh/","vt":"str"},{"t":"cont","v":"hdl/hm/","vt":"str"},{"t":"cont","v":"hdl/ac/","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":250,"y":1280,"wires":[["565bad86310d0418"],["b1b2f5578daf9921"],["b989c322da784388"],["5221b9e27190eefb"],["0277c060ae28fde2"]]},{"id":"94828825b61a85a1","type":"function","z":"d409d0a29f7f44cf","name":"Universal Switch Answer","func":"msg.topic = \"hdl/us/\" + msg.sender + \"/\" + msg.payload.switch;\nvar status = msg.payload.status\nif (status === true) \n    {\n    msg.payload = \"ON\";\n    } \n    else \n    {\n    msg.payload = \"OFF\";\n    }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":240,"wires":[["e6e91e6c6531d2e7"]]},{"id":"a472cec6ba103b35","type":"comment","z":"d409d0a29f7f44cf","name":"Universal Switch","info":"","x":480,"y":200,"wires":[]},{"id":"b1b2f5578daf9921","type":"function","z":"d409d0a29f7f44cf","name":"Universal Switch","func":"var usswitch = msg.topic.split(\"/\")[3];\nvar command = msg.payload;\nif (command === \"ON\") \n    {\n    hdlcommand = true;\n    } \n    else \n    {\n    hdlcommand = false;\n    }\nmsg.code = 57372;\nmsg.target = msg.topic.split(\"/\")[2];\nmsg.payload = {\n    switch: usswitch,\n    status: hdlcommand,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":740,"y":1200,"wires":[["fef4ca11f287479d"]],"info":"msg.topic = \"hdl/us/\" + msg.sender + \"/\" + msg.payload.switch;\nvar status = msg.payload.status\nif (status === true) \n    {\n    msg.payload = \"ON\";\n    } \n    else \n    {\n    msg.payload = \"OFF\";\n    }\nreturn msg;"},{"id":"cf22a85c315dec13","type":"switch","z":"d409d0a29f7f44cf","name":"","property":"code","propertyType":"msg","rules":[{"t":"eq","v":"50","vt":"str"},{"t":"eq","v":"52","vt":"str"},{"t":"eq","v":"57373","vt":"str"},{"t":"eq","v":"57369","vt":"str"},{"t":"eq","v":"5703","vt":"str"},{"t":"eq","v":"58341","vt":"str"},{"t":"eq","v":"6471","vt":"str"},{"t":"eq","v":"6469","vt":"str"},{"t":"eq","v":"7263","vt":"str"},{"t":"eq","v":"7261","vt":"str"},{"t":"eq","v":"6457","vt":"str"},{"t":"eq","v":"6459","vt":"str"}],"checkall":"false","repair":false,"outputs":12,"x":230,"y":480,"wires":[["f7688362d4a6624e"],["90916b69f59f3b88"],["94828825b61a85a1"],["73fc642b8eb78a77"],["7aed38565deb1c0c"],["367301f3fb7d3dae"],["ca3dc95602747d75","723cad02ff85aa77"],["723cad02ff85aa77","ca3dc95602747d75"],["d4c7e2802d3aab8a","945e3545774a5281"],["945e3545774a5281","d4c7e2802d3aab8a"],["05c09355d256695e","0ba22a37d6db866e"],["0ba22a37d6db866e","05c09355d256695e"]]},{"id":"b4977c49ff365c0e","type":"comment","z":"d409d0a29f7f44cf","name":"Temprature Sensors","info":"","x":490,"y":440,"wires":[]},{"id":"367301f3fb7d3dae","type":"function","z":"d409d0a29f7f44cf","name":"Temprature Broadcasts","func":"msg.topic = \"hdl/temp/\" + msg.sender + \"/\" + msg.payload.channel;\nvar temp = msg.payload.temperature\nmsg.payload = temp\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":480,"wires":[["e6e91e6c6531d2e7"]]},{"id":"73fc642b8eb78a77","type":"function","z":"d409d0a29f7f44cf","name":"Universal Switch Read","func":"msg.topic = \"hdl/us/\" + msg.sender + \"/\" + msg.payload.switch;\nvar status = msg.payload.status\nif (status === true) \n    {\n    msg.payload = \"ON\";\n    } \n    else \n    {\n    msg.payload = \"OFF\";\n    }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":280,"wires":[["e6e91e6c6531d2e7"]]},{"id":"c20fcfd152705dca","type":"comment","z":"d409d0a29f7f44cf","name":"AC / Heatpump","info":"","x":480,"y":820,"wires":[]},{"id":"c27be99c4d110263","type":"comment","z":"d409d0a29f7f44cf","name":"Floorheat Thermostat DLP","info":"","x":510,"y":540,"wires":[]},{"id":"05c09355d256695e","type":"function","z":"d409d0a29f7f44cf","name":"Air condition Unit Command from DLP    ","func":"//Insert MQTT Topic\nmsg.topic = \"hdl/ac/\" + msg.sender + \"/0\" + msg.payload.acno;\n\n//Mode - Change nr to Mode and set current set temprature\nvar amode= msg.payload.setupmode \nif (amode === 0){var Mode = \"cool\"; var Thismodetempset = msg.payload.temperature.cooling}\nif (amode === 1){var Mode = \"heat\"; var Thismodetempset = msg.payload.temperature.heating}\nif (amode === 2){var Mode = \"fan_only\"}\nif (amode === 3){var Mode = \"auto\"; var Thismodetempset = msg.payload.temperature.auto}\nif (amode === 4){var Mode = \"dry\"; var Thismodetempset = msg.payload.temperature.dry}\nmsg.payload.currentmode = Thismodetempset\n\n//Power - Change true to ON and mode to off if off\nvar power = msg.payload.acstatus;\nif (power === false){newpower = \"OFF\"; var Mode = \"off\"}\nmsg.payload.setupmode= Mode\n\n//Change nr to fanspeed\nvar aspeed= msg.payload.setupspeed \nif (aspeed === 0){var Speed = \"auto\"}\nif (aspeed === 1){var Speed = \"high\"}\nif (aspeed === 2){var Speed = \"medium\"}\nif (aspeed === 3){var Speed = \"low\"}\nmsg.payload.setupspeed= Speed\n\n//Change nr to sweep state\nvar sweep = msg.payload.sweep;\nif (sweep === 0){newsweep = \"OFF\"}\nif (sweep === 1){newsweep = \"ON\"}\nmsg.payload.sweep = newsweep\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":900,"wires":[["e6e91e6c6531d2e7"]]},{"id":"3f50d0f2fdbe5db9","type":"switch","z":"d409d0a29f7f44cf","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/mode/set","vt":"str"},{"t":"cont","v":"/temperature/set","vt":"str"},{"t":"cont","v":"/fan/set","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":530,"y":1740,"wires":[["aebb0c75dd969fca"],["f464921b1f442181"],["6b93b8e98eac4a13"]]},{"id":"4bcc7a8ae1787db5","type":"hdl-virtual-hvac-out","z":"d409d0a29f7f44cf","controller":"6e986e87.b7a2a","name":"TO HDL DLP","address":"1.99","x":970,"y":1740,"wires":[]},{"id":"ca3dc95602747d75","type":"function","z":"d409d0a29f7f44cf","name":"Floorheat Update/Answer from DLP","func":"//Insert MQTT Topic\nmsg.topic = \"hdl/fh/\" + msg.sender + \"/01\";\n\n//Power Change true/false to ON/OFF\nvar power = msg.payload.status;\nif (power === true){newpower = \"heat\"}\nif (power === false){newpower = \"off\"}\nmsg.payload.status = newpower\n\n//Mode Change from nr to mode 1:Normal 2:Day 3:Night 4:Away 5:Timer. And add current temprature\nvar fhmode= msg.payload.mode \nif (fhmode === 1){var textmode = \"Normal\"; var tempnow = msg.payload.temperature.normal}\nif (fhmode === 2){var textmode = \"Day\"; var tempnow = msg.payload.temperature.day}\nif (fhmode === 3){var textmode = \"Night\"; var tempnow = msg.payload.temperature.night}\nif (fhmode === 4){var textmode = \"Away\"; var tempnow = msg.payload.temperature.away}\nif (fhmode === 5){var textmode = \"Timer\"}\nmsg.payload.textmode= textmode\nmsg.payload.temperature.now = tempnow\n\n//Awaymode\n//if (textmode ==\"Away\"){msg.payload.awaymode = \"On\"}\n//    else{msg.payload.awaymode = \"Off\"}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":620,"wires":[["e6e91e6c6531d2e7"]]},{"id":"13cfc0ee1b828507","type":"switch","z":"d409d0a29f7f44cf","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/mode/set","vt":"str"},{"t":"cont","v":"/textmode/set","vt":"str"},{"t":"cont","v":"/temperature/set","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":570,"y":1340,"wires":[["234f971b363daf21"],["5d0d05ffb3b48f8f"],["1b3bfb4f62154808"]]},{"id":"723cad02ff85aa77","type":"function","z":"d409d0a29f7f44cf","name":"Save msg to flow variable","func":"//Save to flow variable for later use\nflow.set(\"hdl/fh/\" + msg.sender + \"/hdlstate\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":580,"wires":[[]]},{"id":"b989c322da784388","type":"function","z":"d409d0a29f7f44cf","name":"Flow get","func":"//Get Old status from flow variable for complete message\nmsg.oldhdlstate =flow.get(\"hdl/fh/\" + msg.topic.split(\"/\")[2] + \"/hdlstate\");\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":1340,"wires":[["13cfc0ee1b828507"]]},{"id":"fef7564cd271bf53","type":"comment","z":"d409d0a29f7f44cf","name":"Single Channel Status","info":"","x":560,"y":1060,"wires":[]},{"id":"06bae3f5d47d7691","type":"comment","z":"d409d0a29f7f44cf","name":"Universal Switch","info":"","x":540,"y":1160,"wires":[]},{"id":"24e411f3922a9ed1","type":"comment","z":"d409d0a29f7f44cf","name":"Floorheat Thermostat DLP","info":"","x":570,"y":1260,"wires":[]},{"id":"5d0d05ffb3b48f8f","type":"function","z":"d409d0a29f7f44cf","name":"New Preset Mode","func":"// Change from MQTT textmode to HDL nrmode \nvar fhmode = msg.payload\nif (fhmode === \"Normal\"){msg.oldhdlstate.mode = 1}\nif (fhmode === \"Day\"){msg.oldhdlstate.mode = 2}\nif (fhmode === \"Night\"){msg.oldhdlstate.mode = 3}\nif (fhmode === \"Away\"){msg.oldhdlstate.mode = 4}\nif (fhmode === \"Timer\"){msg.oldhdlstate.mode = 5}\n\n//Build new HDL message\nmsg.target = msg.topic.split(\"/\")[2]\nmsg.code = 6470\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":750,"y":1340,"wires":[["fef4ca11f287479d"]]},{"id":"234f971b363daf21","type":"function","z":"d409d0a29f7f44cf","name":"New Mode","func":"// Change from Off or heat to true/false\nif (msg.payload === \"off\") {msg.oldhdlstate.status = false}\nif (msg.payload === \"heat\") {msg.oldhdlstate.status = true}\n//Build new HDL message\nmsg.target = msg.topic.split(\"/\")[2]\nmsg.code = 6470\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":1300,"wires":[["fef4ca11f287479d"]]},{"id":"1b3bfb4f62154808","type":"function","z":"d409d0a29f7f44cf","name":"New Temp","func":"// Check witch mode active and save new temperature to that mode\nnormal = msg.oldhdlstate.temperature.normal \nday = msg.oldhdlstate.temperature.day\nnight = msg.oldhdlstate.temperature.night\naway = msg.oldhdlstate.temperature.away\n\nif (msg.oldhdlstate.mode === 1){normal = msg.payload}\nif (msg.oldhdlstate.mode === 2){day = msg.payload}\nif (msg.oldhdlstate.mode === 3){night = msg.payload}\nif (msg.oldhdlstate.mode === 4){away = msg.payload}\n\nmsg.oldhdlstate.temperature.normal = Number(normal)\nmsg.oldhdlstate.temperature.day = Number(day)\nmsg.oldhdlstate.temperature.night = Number(night)\nmsg.oldhdlstate.temperature.away = Number(away)\n\n//Build new HDL message\nmsg.target = msg.topic.split(\"/\")[2]\nmsg.code = 6470\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":1380,"wires":[["fef4ca11f287479d"]]},{"id":"e892611df0c139cb","type":"comment","z":"d409d0a29f7f44cf","name":"Air condition","info":"","x":530,"y":1640,"wires":[]},{"id":"0ba22a37d6db866e","type":"function","z":"d409d0a29f7f44cf","name":"Save msg to flow variable","func":"//Save to flow variable for later use\nflow.set(\"hdl/ac/\" + msg.sender + \"/hdlstate\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":860,"wires":[[]]},{"id":"0277c060ae28fde2","type":"function","z":"d409d0a29f7f44cf","name":"Flow get","func":"//Get Old status from flow variable for complete message\nmsg.oldhdlstate =flow.get(\"hdl/ac/\" + msg.topic.split(\"/\")[2] + \"/hdlstate\");\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":1740,"wires":[["3f50d0f2fdbe5db9"]]},{"id":"aebb0c75dd969fca","type":"function","z":"d409d0a29f7f44cf","name":"New Mode","func":"//Set current temperature from oldstate and change mode to nr and not text\nvar acmode = msg.payload\nif (acmode === \"cool\"){var acstatus = true; var accurrenttemp = msg.oldhdlstate.temperature.cooling; var newacmode = 0}\nif (acmode === \"heat\"){var acstatus = true; var accurrenttemp = msg.oldhdlstate.temperature.heating; var newacmode = 1}\nif (acmode === \"fan_only\"){var acstatus = true; var accurrenttemp = 0; var newacmode = 2}\nif (acmode === \"auto\"){var acstatus = true; var accurrenttemp = msg.oldhdlstate.temperature.auto; var newacmode = 3}\nif (acmode === \"dry\"){var acstatus = true; var accurrenttemp = msg.oldhdlstate.temperature.dry; var newacmode = 4}\n\n//If off change acstatus and old mode\nif (acmode === \"off\")\n{\n    var acstatus = false; \n    if (msg.oldhdlstate.setupmode === 0){var accurrenttemp = msg.oldhdlstate.temperature.cooling; var newacmode = 0}\n    if (msg.oldhdlstate.setupmode === 1){var accurrenttemp = msg.oldhdlstate.temperature.heating; var newacmode = 1}\n    if (msg.oldhdlstate.setupmode === 2){var accurrenttemp = 0; var newacmode = 2}\n    if (msg.oldhdlstate.setupmode === 3){var accurrenttemp = msg.oldhdlstate.temperature.auto; var newacmode = 3}\n    if (msg.oldhdlstate.setupmode === 4){var accurrenttemp = msg.oldhdlstate.temperature.dry; var newacmode = 4}\n}\n\n//   - Insert to msg object\nmsg.oldhdlstate.currentmode = accurrenttemp\nmsg.oldhdlstate.setupmode = newacmode\nmsg.oldhdlstate.acstatus = acstatus\n\n//Build new HDL message\nmsg.target = msg.topic.split(\"/\")[2]\nmsg.code = 6458\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":1680,"wires":[["4bcc7a8ae1787db5"]],"info":"msg.topic = \"hdl/us/\" + msg.sender + \"/\" + msg.payload.switch;\nvar status = msg.payload.status\nif (status === true) \n    {\n    msg.payload = \"ON\";\n    } \n    else \n    {\n    msg.payload = \"OFF\";\n    }\nreturn msg;"},{"id":"c4d3bf2fd3532ed5","type":"function","z":"d409d0a29f7f44cf","name":"Temp","func":"//Set new temperature to HDL message\nvar acurrtemp = msg.payload\nif (msg.oldhdlstate.setupmode === 0){msg.oldhdlstate.temperature.cooling = acurrtemp}\nif (msg.oldhdlstate.setupmode === 1){msg.oldhdlstate.temperature.heating = acurrtemp}\n//if (msg.oldhdlstate.setupmode === 2){var accurrtemp = 0}\nif (msg.oldhdlstate.setupmode === 3){msg.oldhdlstate.temperature.auto = acurrtemp}\nif (msg.oldhdlstate.setupmode === 4){msg.oldhdlstate.temperature.dry = acurrtemp}\n\n// Build AC broadcast\nmsg.target = msg.topic.split(\"/\")[2];\nmsg.code = 6458,\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":1740,"wires":[["4bcc7a8ae1787db5"]],"info":"msg.topic = \"hdl/us/\" + msg.sender + \"/\" + msg.payload.switch;\nvar status = msg.payload.status\nif (status === true) \n    {\n    msg.payload = \"ON\";\n    } \n    else \n    {\n    msg.payload = \"OFF\";\n    }\nreturn msg;"},{"id":"f464921b1f442181","type":"range","z":"d409d0a29f7f44cf","minin":"0","maxin":"100","minout":"0","maxout":"100","action":"scale","round":true,"property":"payload","name":"Round","x":650,"y":1740,"wires":[["c4d3bf2fd3532ed5"]]},{"id":"6b93b8e98eac4a13","type":"function","z":"d409d0a29f7f44cf","name":"New Fan Mode","func":"//AC fan speed text to speed\nvar acspeed = msg.payload\nif (acspeed === \"auto\"){msg.oldhdlstate.setupspeed = 0}\nif (acspeed === \"high\"){msg.oldhdlstate.setupspeed = 1}\nif (acspeed === \"medium\"){msg.oldhdlstate.setupspeed = 2}\nif (acspeed === \"low\"){msg.oldhdlstate.setupspeed = 3}\n\n// Build AC broadcast\nmsg.target = msg.topic.split(\"/\")[2];\nmsg.code = 6458,\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":1800,"wires":[["4bcc7a8ae1787db5"]],"info":"msg.topic = \"hdl/us/\" + msg.sender + \"/\" + msg.payload.switch;\nvar status = msg.payload.status\nif (status === true) \n    {\n    msg.payload = \"ON\";\n    } \n    else \n    {\n    msg.payload = \"OFF\";\n    }\nreturn msg;"},{"id":"fef4ca11f287479d","type":"hdl-raw-out","z":"d409d0a29f7f44cf","controller":"6e986e87.b7a2a","name":"","x":1250,"y":1340,"wires":[]},{"id":"924768afbce95647","type":"switch","z":"d409d0a29f7f44cf","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/mode/set","vt":"str"},{"t":"cont","v":"/textmode/set","vt":"str"},{"t":"cont","v":"/temperature/set","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":570,"y":1520,"wires":[["0f6e549052100ef1"],["45955344839086c8"],["f9abce9ded39bdf3"]]},{"id":"5221b9e27190eefb","type":"function","z":"d409d0a29f7f44cf","name":"Flow get","func":"//Get Old status from flow variable for complete message\nmsg.oldhdlstate =flow.get(\"hdl/hm/\" + msg.topic.split(\"/\")[2] + \"/\" + msg.topic.split(\"/\")[3] + \"/hdlstate\");\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":1520,"wires":[["924768afbce95647"]]},{"id":"b80b0e2e0e978d7a","type":"comment","z":"d409d0a29f7f44cf","name":"Floorheat Thermostat Heatmodule MFH06","info":"","x":620,"y":1440,"wires":[]},{"id":"45955344839086c8","type":"function","z":"d409d0a29f7f44cf","name":"New Preset Mode","func":"// Change from MQTT textmode to HDL nrmode \nvar fhmode = msg.payload\nif (fhmode === \"Normal\"){msg.oldhdlstate.mode = 1}\nif (fhmode === \"Day\"){msg.oldhdlstate.mode = 2}\nif (fhmode === \"Night\"){msg.oldhdlstate.mode = 3}\nif (fhmode === \"Away\"){msg.oldhdlstate.mode = 4}\nif (fhmode === \"Timer\"){msg.oldhdlstate.mode = 5}\n\n//Build new HDL message\nmsg.target = msg.topic.split(\"/\")[2]\nmsg.code = 7260\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":750,"y":1520,"wires":[["fef4ca11f287479d"]]},{"id":"0f6e549052100ef1","type":"function","z":"d409d0a29f7f44cf","name":"New Mode","func":"// Change from Off or heat to true/false\nif (msg.payload === \"off\") {msg.oldhdlstate.work.status = false}\nif (msg.payload === \"heat\") {msg.oldhdlstate.work.status = true}\n//Build new HDL message\nmsg.target = msg.topic.split(\"/\")[2]\nmsg.code = 7260\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":1480,"wires":[["fef4ca11f287479d"]]},{"id":"f9abce9ded39bdf3","type":"function","z":"d409d0a29f7f44cf","name":"New Temp","func":"// Check witch mode active and save new temperature to that mode\nnormal = msg.oldhdlstate.temperature.normal \nday = msg.oldhdlstate.temperature.day\nnight = msg.oldhdlstate.temperature.night\naway = msg.oldhdlstate.temperature.away\n\nif (msg.oldhdlstate.mode === 1){normal = msg.payload}\nif (msg.oldhdlstate.mode === 2){day = msg.payload}\nif (msg.oldhdlstate.mode === 3){night = msg.payload}\nif (msg.oldhdlstate.mode === 4){away = msg.payload}\n\nmsg.oldhdlstate.temperature.normal = Number(normal)\nmsg.oldhdlstate.temperature.day = Number(day)\nmsg.oldhdlstate.temperature.night = Number(night)\nmsg.oldhdlstate.temperature.away = Number(away)\n\n//Build new HDL message\nmsg.target = msg.topic.split(\"/\")[2]\nmsg.code = 7260\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":1560,"wires":[["fef4ca11f287479d"]]},{"id":"6e360050af29aab2","type":"comment","z":"d409d0a29f7f44cf","name":"Floorheat Thermostat Heatmodule MFH06","info":"","x":560,"y":680,"wires":[]},{"id":"945e3545774a5281","type":"function","z":"d409d0a29f7f44cf","name":"Floorheat Update/Answer from Heatmodule","func":"//Insert MQTT Topic\nmsg.topic = \"hdl/hm/\" + msg.sender + msg.payload.channel + \"/01\";\n\n//Power Change true/false to ON/OFF\nvar power = msg.payload.work.status;\nif (power === true){newpower = \"heat\"}\nif (power === false){newpower = \"off\"}\nmsg.payload.work.status = newpower\n\n//Mode Change from nr to mode 1:Normal 2:Day 3:Night 4:Away 5:Timer. And add current temprature\nvar fhmode= msg.payload.mode \nif (fhmode === 1){var textmode = \"Normal\"; var tempnow = msg.payload.temperature.normal}\nif (fhmode === 2){var textmode = \"Day\"; var tempnow = msg.payload.temperature.day}\nif (fhmode === 3){var textmode = \"Night\"; var tempnow = msg.payload.temperature.night}\nif (fhmode === 4){var textmode = \"Away\"; var tempnow = msg.payload.temperature.away}\nif (fhmode === 5){var textmode = \"Timer\"}\nmsg.payload.textmode= textmode\nmsg.payload.temperature.now = tempnow\n\n//Awaymode\n//if (textmode ==\"Away\"){msg.payload.awaymode = \"On\"}\n//    else{msg.payload.awaymode = \"Off\"}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":760,"wires":[["e6e91e6c6531d2e7"]]},{"id":"d4c7e2802d3aab8a","type":"function","z":"d409d0a29f7f44cf","name":"Save msg to flow variable","func":"//Save to flow variable for later use\nflow.set(\"hdl/hm/\" + msg.sender + \"/\" + msg.payload.channel +\"/hdlstate\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":720,"wires":[[]]},{"id":"d03ac02854ba9d67","type":"inject","z":"d409d0a29f7f44cf","name":"","props":[{"p":"payload","v":"Started!","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":true,"onceDelay":"","topic":"","payload":"Started!","payloadType":"str","x":160,"y":1960,"wires":[["cd29b4313cda695c","f414f764eb323b50","3ecb82b5a770398c","321efe21918907d0","6cee1e5be4a2c287"]]},{"id":"1b9f13eadcccb7a1","type":"comment","z":"d409d0a29f7f44cf","name":"Floorheat","info":"","x":340,"y":1920,"wires":[]},{"id":"5d08bfc77dd3ace3","type":"comment","z":"d409d0a29f7f44cf","name":"Read startup Status","info":"","x":130,"y":1900,"wires":[]},{"id":"aad0501e62a0a971","type":"function","z":"d409d0a29f7f44cf","name":"Read status Floorheat ch2","func":"msg.target = \"1.20\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 2,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":2020,"wires":[["fef4ca11f287479d"]]},{"id":"6cee1e5be4a2c287","type":"function","z":"d409d0a29f7f44cf","name":"Read status Floorheat ch1","func":"msg.target = \"1.20\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 1,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":1960,"wires":[["fef4ca11f287479d"]]},{"id":"4badbe0f81533427","type":"function","z":"d409d0a29f7f44cf","name":"Read status Floorheat ch4","func":"msg.target = \"1.20\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 4,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":2140,"wires":[["fef4ca11f287479d"]]},{"id":"2c18bb88eb859db0","type":"function","z":"d409d0a29f7f44cf","name":"Read status Floorheat ch3","func":"msg.target = \"1.20\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 3,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":2080,"wires":[["fef4ca11f287479d"]]},{"id":"6469fe9aa28db2bc","type":"function","z":"d409d0a29f7f44cf","name":"Read status Floorheat ch5","func":"msg.target = \"1.20\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 5,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":2200,"wires":[["fef4ca11f287479d"]]},{"id":"f414f764eb323b50","type":"delay","z":"d409d0a29f7f44cf","name":"","pauseType":"delay","timeout":"4","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":360,"y":2080,"wires":[["2c18bb88eb859db0"]]},{"id":"cd29b4313cda695c","type":"delay","z":"d409d0a29f7f44cf","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":360,"y":2020,"wires":[["aad0501e62a0a971"]]},{"id":"3ecb82b5a770398c","type":"delay","z":"d409d0a29f7f44cf","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":360,"y":2140,"wires":[["4badbe0f81533427"]]},{"id":"321efe21918907d0","type":"delay","z":"d409d0a29f7f44cf","name":"","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":360,"y":2200,"wires":[["6469fe9aa28db2bc"]]},{"id":"d110fe62.0ec2","type":"mqtt-broker","name":"hassio.local","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"6e986e87.b7a2a","type":"hdl-controller","host":"192.168.10.250","port":"6000","subnetid":"1","deviceid":"98","broadcast":false,"daliId":"92"}]

Did the new inject node work as intended?

When u deploy in nodered does all the channels on the mqtt server change within the 8 sec delay(Should update on the MQTT server as the delay timers on the bottom triggers)?

It is important that this message is recived since it is the message that is modifyed when changing a value from Home Assistant. HDL needs the full command with all parameters but Home assistant only updates what is changed and not the complete msg. It also makes sure that u get the feedback to home assistant when you restart the server or changes are made from other places than Homme assistant.

From my understanding when reading the manual it is used for flushing the pipes.

I see that in the Smart Bus Node.js implementation it seems that the code for 7263 and 7261 is the same but the messages from hdl is not wich could result in some indexing errors or other bugs. The way it is now i think it will change the valve status to true when u update from home assistant if the last message we got was 7263. It could also be that HDL will not accept the msg due to indexing fault. Keep an eye on it when testing and make sure u dont destroy any floors with the relay for the heating cables stuck on.

Did you sett the msg.topic on Floorheat Update/Answer from Heatmodule that way for a reason?
( msg.topic = “hdl/hm/” + msg.sender + msg.payload.channel + “/01”; )
or is this the rigt way?
( msg.topic = “hdl/hm/” + msg.sender + “/” + msg.payload.channel; )

I did switch it to the last one and can read all changes from hdl but cant control it from HA.
Problem is the From mqtt node and the topic ( hdl/+/+/+/set ),
and to controll the hdl heatmodul i use ( “hdl/hm/1.20/3/mode/set” ).
Tryed to add 1 more + in the topic and then i can controll the heat modul but all other lights and stuff dont work then :slight_smile:
I can do ( msg.topic = “hdl/hm/” + msg.sender + msg.payload.channel; )
then i get this topic out: ( “hdl/hm/1.203” ) and saves 1 space :slight_smile:

( msg.topic = “hdl/hm/” + msg.sender + msg.payload.channel; ) did not work.

32

Done some changes, also done some limited testing on MQTT and contex data storage.

Hopefully it will be working now.

Need to change the setup in the config file due to one to mutch / for the channel. Now channel is behind a “.” and not a /. Current temperature still needs to be /

climate:
  - platform: mqtt
    name: "Floorheat channel 2"
    send_if_off: true
    modes:
      - "off"
      - "heat"
    mode_state_topic: "hdl/hm/1.20.2"
    mode_state_template: "{{value_json.status}}"
    mode_command_topic: "hdl/hm/1.20.2/mode/set"
    current_temperature_topic: "hdl/temp/1.20/2"
    temperature_state_topic: "hdl/hm/1.20.2"
    temperature_state_template: "{{value_json.temperature.now}}"
    temperature_command_topic: "hdl/hm/1.20.2/temperature/set"
    hold_modes:
      - "Normal"
      - "Day"
      - "Night"
      - "Away"
      - "Timer"
    hold_state_topic: "hdl/hm/1.20.2"
    hold_state_template: "{{value_json.textmode}}"
    hold_command_topic: "hdl/hm/1.20.2/textmode/set"
    min_temp: 5
    max_temp: 35
    precision: 0.1

New node red config is to big for the forum, will send seperatly.

Let me know how it works out.

Thank you very much. Everything works as it should now.
I just split the “from mqtt” into two earlier.
Have pm HDL tech support to try find out what valve and the watering is.
Did also add “msg.payload.temperature.current = msg.payload.watering.time” in Floorheat Update/Answer from Heatmodule. sins it read the current temp on 7261,
and "if (fhmode === 5){var textmode = “Timer”; var tempnow = “0”} " just to not get old temp from last used mode when on timer.

Hi Linax,
firstly many thanks for your effort on this project!

Since the previous custom component I used for integrating HDL into HA now does not work anymore with the newest version of HA I was also forced to seek out an alternative and luckily I found this NodeRed-based solution here.
I also use the multi-zone FH controllers like @kentwin does.
Could you also share with me the NodeRed config that was too big for the forum so I could also see if I can get this working on my home setup?

Many thanks in advance!

Can not send it on the forum due to size but if you pm me with your email i will send it to you.

Hi

Going over my settings I found out that Lux from my sensors is not being sent to MQTT. Also I am trying to figure out if its possible to get data from my humidity sensor.

image

As you can see, I am not receiving temperature from sensor 71 and 72 either. I figure it has something to do with them being newer models. Any ideas how I can fix this?

Strange i get a value from my 12i1 sensors but have not checked that it is the same as the lux value in HDL tool, will investigate when i get some time. What sensors are you using for LUX?

Should be possible, i dont have a humidity sensor at the moment so not able to check what message it broadcasts.

Can you import this flow to NodeRed and send me screenshots of what you get in the debug window?
You will also have to change the Switch node “sender” to match the address of your subnet and sensor address.

[{"id":"17696afba8056a41","type":"tab","label":"Test humidity","disabled":false,"info":"","env":[]},{"id":"44205029aea32447","type":"switch","z":"17696afba8056a41","name":"sender","property":"sender","propertyType":"msg","rules":[{"t":"eq","v":"1.71","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":270,"y":100,"wires":[["486257b21074c879"]]},{"id":"bf65d5a1a93047c8","type":"hdl-raw-in","z":"17696afba8056a41","controller":"6e986e87.b7a2a","name":"","x":110,"y":100,"wires":[["44205029aea32447","126ec80578615694"]]},{"id":"486257b21074c879","type":"debug","z":"17696afba8056a41","name":"From Sensor","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":100,"wires":[]},{"id":"126ec80578615694","type":"switch","z":"17696afba8056a41","name":"target","property":"target","propertyType":"msg","rules":[{"t":"eq","v":"1.71","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":270,"y":160,"wires":[["c25f2ede0e8bfd63"]]},{"id":"c25f2ede0e8bfd63","type":"debug","z":"17696afba8056a41","name":"To Sensor","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":160,"wires":[]},{"id":"5923fdeea6ba8e27","type":"comment","z":"17696afba8056a41","name":"Test humidity","info":"","x":110,"y":40,"wires":[]},{"id":"6e986e87.b7a2a","type":"hdl-controller","host":"192.168.10.250","port":"6000","subnetid":"1","deviceid":"98","broadcast":false,"daliId":"92"}]

I do not have that sensor so could you send me screenshots of how the message looks with above flow.

Hi

Your little script made me realise a lot. As far as I can tell, it is not possible to broadcast humidity from the sensor. At least not with the firmware I have on it. I can however force it to send me the data by refreshing in the Buspro setup tool as you can see below:

Sensor 73 (Humidity)

4.3.2022, 21:09:09[node: To Sensor](http://192.168.1.216:8123/api/hassio_ingress/DmzJqvmc55mzWjzCjJLhd7ECrUmTsFbMdSRRmroSFU0/)command : msg : Object
*object*
sender: "253.254"
target: "1.73"
code: 5636
payload: *undefined*
topic: "command"
_msgid: "f89661dc69a1f45d"
4.3.2022, 21:09:09[node: From Sensor](http://192.168.1.216:8123/api/hassio_ingress/DmzJqvmc55mzWjzCjJLhd7ECrUmTsFbMdSRRmroSFU0/)command : msg : Object
*object*
sender: "1.73"
target: "253.254"
code: 5637
payload: *object*
success: true
temperature: 22
brightness: 0
humidity: 30
air: 255
gas: 255
movement: true
dryContacts: *array[2]*
0: *object*
1: *object*
topic: "command"
_msgid: "fd5fb74cbd6452b3"
4.3.2022, 21:09:47[node: From Sensor](http://192.168.1.216:8123/api/hassio_ingress/DmzJqvmc55mzWjzCjJLhd7ECrUmTsFbMdSRRmroSFU0/)command : msg : Object
*object*
sender: "1.73"
target: "255.255"
code: 58341
payload: *object*
channel: 1
temperature: 22
topic: "command"
_msgid: "203b75c867db1968"

Sensor 72 and 73 however does not have broadcast capability at all and the checkbox just disappears after loading it in the tool.
image

4.3.2022, 21:19:14node: To Sensor
command : msg : Object
object
sender: "253.254"
target: "1.72"
code: 5636
payload: undefined
topic: "command"
_msgid: "dba9c6caeff8fb1f"
4.3.2022, 21:19:14node: From Sensor
command : msg : Object
object
sender: "1.72"
target: "253.254"
code: 5637
payload: object
success: true
temperature: 21
brightness: 26
humidity: 255
air: 255
gas: 255
movement: false
dryContacts: array[2]
topic: "command"
_msgid: "1d454565cbf34c18"

Hope this is every thing you wanted me to send, and thank you for helping me.

Edit:

I have been able to receive Lux and humidity now, by adding this as a function in Node-Red

var outputMsgs = [];
if (msg.code == 5637) 
{
    {
        outputMsgs.push
        ({
          topic:"hdl/temp/" + msg.sender + "/1",
          payload : msg.payload.temperature
        });

        outputMsgs.push
        ({
          topic:"hdl/lux/" + msg.sender + "/Lux",
           payload : msg.payload.brightness
        });
    
        outputMsgs.push
        ({
          topic:"hdl/Humidity/" + msg.sender + "/Humidity",
           payload : msg.payload.humidity
        });
        
    }
    return [ outputMsgs ];
} 

I still have to manually ask for feedback, but at least I am receiving something.

Nodered is quite powerful if you know how to use it. I find it easyer to program in nodered for logic functions etc rater than on the HDL logic module.

If the sensor is not able to broadcast the easyest is to ask for current status via nodered. You can se that the HDL buspro tool(253.254) sends the message code 5636 to target 1.73. That is the same message you will have to send from nodered.
Try this example:

[{"id":"594debe34a5e564e","type":"function","z":"42a82d310ccadd8b","name":"Read sensor","func":"msg.target = \"1.73\"\nmsg.code = 5636;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":140,"wires":[["f9762d89ae2db0b0","dc6f8f1c5896f21b"]]},{"id":"00f2cfdfe2f47b84","type":"inject","z":"42a82d310ccadd8b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":"7","topic":"","payload":"Started!","payloadType":"str","x":200,"y":140,"wires":[["594debe34a5e564e"]]},{"id":"4507d25b20b9044b","type":"comment","z":"42a82d310ccadd8b","name":"Start 1 time at startup and every 1 minute after","info":"","x":270,"y":100,"wires":[]},{"id":"f9762d89ae2db0b0","type":"hdl-raw-out","z":"42a82d310ccadd8b","controller":"6e986e87.b7a2a","name":"","x":810,"y":140,"wires":[]},{"id":"dc6f8f1c5896f21b","type":"debug","z":"42a82d310ccadd8b","name":"read command","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":100,"wires":[]},{"id":"6e986e87.b7a2a","type":"hdl-controller","host":"192.168.10.250","port":"6000","subnetid":"1","deviceid":"98","broadcast":false,"daliId":"92"}]

Here the inject node will send the request 7 seconds after deployment and every 1 minute after.
Can have a lot of traffic on the bus before it is a problem but i like to have different delays on all my startup request etc. so that it does not all send at once. This could be a issue on the wireless systems.

Thanks that is all i need. But you also figured out how to decode it. I would add code 5637 to the first switch node and then the script you made.
Sensor 72 and 73 use the same code so should work fine to MQTT on the same function.

Nice. Thank you, it looks like it works fine now :slight_smile:

Hi Linax, can you help? I can’t figure out how the HDL-MFH06 warm field module is controlled, the task is as follows I want to control this module With homekit via nodered

with this command I can turn on one channel

msg={
target: “1.3”,
code: 7260,
payload:{“channel”:1,
“work”:{“type”:0,“status”:true},
“temperature”:{“type”:0,“normal”:23,“day”:20,“night”:20,“away”:20},
“mode”:1,“valve”:false,“watering”:{“time”:20}
}
};
return msg

Hi Lexus2020.

It is controlled from home assistant using mqtt and from mqtt to hdl in nodered. I dont have any experience using homekit. So not sure if that can integrate with mqtt or if you would need to use a homekit pallet instead.

Would recomend posting in the nodered forum instead as this forum is related to home assistant. That forum is also more suited for sharing flows etc. If you let me know when you have posted there i might be able to do some assisting.

Also keep in mind that there is a indexing fault on the decoding of the messages from that module. I have made a fix for that and plan to do a pull request on git when i get some time. Might be able to upload a copy to the nodered forum.

thanks for the answer i want not to use MQTT i want to do it via subflow on nodered
I need your help with the HDL commands for the MFH06 module And with Homekit I will figure it out myself

For the message you sendt there is more than on, description on your message in ():

msg={
target: “1.3”, (Subnet and channel of Floorheat module)
code: 7260, (Command for controling the Floor heating module)
payload:{“channel”:1, (Channel on the heatmodule you want to control)
“work”:{“type”:0,“status”:true}, (Type= 0:Heating, 1:Cooling, 2: Heating power output, 3: Cooling power output. Status= True: ON, False: OFF)
“temperature”:{“type”:0,“normal”:23,“day”:20,“night”:20,“away”:20}, (Type= 0: Celsius, 1: Fahrenheit. Normal = temperature for normal mode. ++++)
“mode”:1,“valve”:false,“watering”:{“time”:20} (Mode= 1: Normal, 2: Day, 3: Night, 4: Away, 5 Timer.)

Have made an attempt on a gateway from HDL to Homekit but do not have a Iphone or Ipad nor the HDL heatmodule so have not done any testing but should give you a starting point.

I used the palette “node-red-contrib-homekit-bridged” in nodered.

[{"id":"4ef634328f92511d","type":"tab","label":"Homekit HDL Termostat","disabled":false,"info":"","env":[]},{"id":"c268eb03f88f11c3","type":"homekit-service","z":"4ef634328f92511d","isParent":true,"hostType":"0","bridge":"cf42cb6346cc105a","accessoryId":"","parentService":"","name":"Subnet1 Address3 CH1","serviceName":"Thermostat","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.4.3","serialNo":"Default Serial Number","firmwareRev":"1.4.3","hardwareRev":"1.4.3","softwareRev":"1.4.3","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"TargetHeatingCoolingState\":{\"validValues\":[0,1]},\"CurrentHeatingCoolingState\":{\"validValues\":[0,1]},\"TargetTemperature\":{\"Minimum Value\":11,\"Maximum Value\":32,\"Minimum Step\":1}}","waitForSetupMsg":false,"outputs":2,"x":950,"y":780,"wires":[["7d9d0e7b8d4a6c25"],[]]},{"id":"bf10fe348a05d561","type":"inject","z":"4ef634328f92511d","name":"","props":[{"p":"payload","v":"Started!","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":true,"onceDelay":"","topic":"","payload":"Started!","payloadType":"str","x":120,"y":100,"wires":[["9fb39de4a03cd158","9a6341e1ad1c824f","2cc316caad6c61e1","bf0848e636884c16","3e15f5f684b3206b","2ce81424078c0737"]]},{"id":"cbe3e7320429c062","type":"comment","z":"4ef634328f92511d","name":"Read startup Status","info":"","x":110,"y":40,"wires":[]},{"id":"05afe1694f0c3e62","type":"function","z":"4ef634328f92511d","name":"Read status Floorheat ch2","func":"msg.target = \"1.3\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 2,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":160,"wires":[["fbb36ff4507cfeb0"]]},{"id":"3e15f5f684b3206b","type":"function","z":"4ef634328f92511d","name":"Read status Floorheat ch1","func":"msg.target = \"1.3\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 1,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":100,"wires":[["fbb36ff4507cfeb0"]]},{"id":"3044215bd55ab948","type":"function","z":"4ef634328f92511d","name":"Read status Floorheat ch4","func":"msg.target = \"1.3\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 4,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":280,"wires":[["fbb36ff4507cfeb0"]]},{"id":"f24953c6b7073ef1","type":"function","z":"4ef634328f92511d","name":"Read status Floorheat ch3","func":"msg.target = \"1.14\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 3,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":220,"wires":[["fbb36ff4507cfeb0"]]},{"id":"19a0de1904d2785a","type":"function","z":"4ef634328f92511d","name":"Read status Floorheat ch5","func":"msg.target = \"1.3\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 5,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":340,"wires":[["fbb36ff4507cfeb0"]]},{"id":"9a6341e1ad1c824f","type":"delay","z":"4ef634328f92511d","name":"","pauseType":"delay","timeout":"4","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":340,"y":220,"wires":[["f24953c6b7073ef1"]]},{"id":"9fb39de4a03cd158","type":"delay","z":"4ef634328f92511d","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":340,"y":160,"wires":[["05afe1694f0c3e62"]]},{"id":"2cc316caad6c61e1","type":"delay","z":"4ef634328f92511d","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":340,"y":280,"wires":[["3044215bd55ab948"]]},{"id":"bf0848e636884c16","type":"delay","z":"4ef634328f92511d","name":"","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":340,"y":340,"wires":[["19a0de1904d2785a"]]},{"id":"ed5dd45d147e906e","type":"function","z":"4ef634328f92511d","name":"Read status Floorheat ch6","func":"msg.target = \"1.3\"\nmsg.code = 7262;\nmsg.payload = {\n    channel: 6,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":400,"wires":[["fbb36ff4507cfeb0"]]},{"id":"2ce81424078c0737","type":"delay","z":"4ef634328f92511d","name":"","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":340,"y":400,"wires":[["ed5dd45d147e906e"]]},{"id":"2ca0a25bfda4b0c0","type":"comment","z":"4ef634328f92511d","name":"HDL feedback to Homekit","info":"","x":130,"y":480,"wires":[]},{"id":"6d9045e042eb2f19","type":"hdl-raw-in","z":"4ef634328f92511d","controller":"","name":"From HDL","x":80,"y":560,"wires":[["574b813084033448"]]},{"id":"574b813084033448","type":"switch","z":"4ef634328f92511d","name":"Code","property":"code","propertyType":"msg","rules":[{"t":"eq","v":"7263","vt":"str"},{"t":"eq","v":"7261","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":210,"y":560,"wires":[["1a1c9867a0dc6915","8a92000e68f47b35"],["8a92000e68f47b35","1a1c9867a0dc6915"]]},{"id":"1a1c9867a0dc6915","type":"function","z":"4ef634328f92511d","name":"Save msg to flow variable","func":"//Save to flow variable for later use\nflow.set(\"hdl/hm/\" + msg.sender + \"/\" + msg.payload.channel +\"/hdlstate\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":540,"wires":[[]]},{"id":"8a92000e68f47b35","type":"function","z":"4ef634328f92511d","name":"Floorheat Update/Answer from Heatmodule","func":"//Insert MQTT Topic\nmsg.topic = \"hdl/hm/\" + msg.sender + \".\" + msg.payload.channel;\n\n//Power Change true/false to ON/OFF\nvar power = msg.payload.work.status;\nif (power === true){newpower = \"heat\"}\nif (power === false){newpower = \"off\"}\nmsg.payload.status = newpower\n\n//Mode Change from nr to mode 1:Normal 2:Day 3:Night 4:Away 5:Timer. And add current temprature\nvar fhmode= msg.payload.mode \nif (fhmode === 1){var textmode = \"Normal\"; var tempnow = msg.payload.temperature.normal}\nif (fhmode === 2){var textmode = \"Day\"; var tempnow = msg.payload.temperature.day}\nif (fhmode === 3){var textmode = \"Night\"; var tempnow = msg.payload.temperature.night}\nif (fhmode === 4){var textmode = \"Away\"; var tempnow = msg.payload.temperature.away}\nif (fhmode === 5){var textmode = \"Timer\"}\nmsg.payload.textmode= textmode\nmsg.payload.temperature.now = tempnow\n\n//Awaymode\n//if (textmode ==\"Away\"){msg.payload.awaymode = \"On\"}\n//    else{msg.payload.awaymode = \"Off\"}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":580,"wires":[["fd8179d24076cfa0"]]},{"id":"47c9bd4694a5e6fa","type":"switch","z":"4ef634328f92511d","name":"Channel","property":"payload.channel","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":100,"y":640,"wires":[["d1b2be92addc53fd"],["7037212fd03b8bec"]]},{"id":"4a2d130433ed3902","type":"switch","z":"4ef634328f92511d","name":"Mode","property":"payload.TargetHeatingCoolingState","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":1270,"y":760,"wires":[["1e367a58fcbc4c8f"]]},{"id":"d6e53f2b46e552ca","type":"switch","z":"4ef634328f92511d","name":"Temp","property":"payload.TargetTemperature","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":1270,"y":800,"wires":[["edf1c4b83457df93"]]},{"id":"fd8179d24076cfa0","type":"switch","z":"4ef634328f92511d","name":"Sender","property":"sender","propertyType":"msg","rules":[{"t":"eq","v":"1.3","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":580,"wires":[["47c9bd4694a5e6fa"]]},{"id":"25816f1c9d276a48","type":"switch","z":"4ef634328f92511d","name":"ON OFF","property":"payload.work.status","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":680,"wires":[["66b396789b3deed0"],["e36ec3e906984131"]]},{"id":"d1b2be92addc53fd","type":"switch","z":"4ef634328f92511d","name":"Heat / Cool","property":"payload.work.type","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":740,"wires":[["25816f1c9d276a48","a7d7d41e39d3681a","01538d95eec834be"],[]]},{"id":"328826d0e4d80f00","type":"comment","z":"4ef634328f92511d","name":"CH 1","info":"","x":270,"y":640,"wires":[]},{"id":"66b396789b3deed0","type":"change","z":"4ef634328f92511d","name":"Feedback to ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetHeatingCoolingState\":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":660,"wires":[["fcd84f5cd960a882"]]},{"id":"e36ec3e906984131","type":"change","z":"4ef634328f92511d","name":"Feedback to OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetHeatingCoolingState\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":700,"wires":[["1dfc696c6b898b3c"]]},{"id":"7d9d0e7b8d4a6c25","type":"function","z":"4ef634328f92511d","name":"Flow get","func":"//Get Old status from flow variable for complete message\nmsg.oldhdlstate =flow.get(\"hdl/hm/\" + \"1.3\" + \"/\" + 1 + \"/hdlstate\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1140,"y":780,"wires":[["4a2d130433ed3902","d6e53f2b46e552ca"]]},{"id":"1e367a58fcbc4c8f","type":"function","z":"4ef634328f92511d","name":"New Mode","func":"// Change from Off or heat to true/false\nif (msg.payload == 0) {msg.oldhdlstate.work.status = false}\nif (msg.payload == 1) {msg.oldhdlstate.work.status = true}\n//Build new HDL message\nmsg.code = 7260\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1410,"y":760,"wires":[["fbb36ff4507cfeb0"]]},{"id":"fbb36ff4507cfeb0","type":"hdl-raw-out","z":"4ef634328f92511d","controller":"","name":"To HDL","x":1640,"y":480,"wires":[]},{"id":"fcd84f5cd960a882","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":660,"wires":[["c268eb03f88f11c3"]]},{"id":"1dfc696c6b898b3c","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":700,"wires":[["c268eb03f88f11c3"]]},{"id":"4e8e3f77aba16cca","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":760,"wires":[["c268eb03f88f11c3"]]},{"id":"a7d7d41e39d3681a","type":"function","z":"4ef634328f92511d","name":"Update Current Temperature","func":"var currenttemp = msg.payload.temperature.current\nmsg.payload = {\"CurrentTemperature\": currenttemp}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":760,"wires":[["4e8e3f77aba16cca"]]},{"id":"62af807636879be4","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":820,"wires":[["c268eb03f88f11c3"]]},{"id":"01538d95eec834be","type":"function","z":"4ef634328f92511d","name":"Update Setpoint Temperature","func":"var settemp = msg.payload.temperature.normal\nmsg.payload = {\"TargetTemperature\": settemp}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":820,"wires":[["62af807636879be4"]]},{"id":"f4e2b570dd126f38","type":"function","z":"4ef634328f92511d","name":"Update Setpoint Temperature","func":"//Mode Change from nr to mode 1:Normal 2:Day 3:Night 4:Away 5:Timer. And add current temprature\nvar fhmode= msg.payload.mode \nif (fhmode === 1){var textmode = \"Normal\"; var tempnow = msg.payload.temperature.normal}\nif (fhmode === 2){var textmode = \"Day\"; var tempnow = msg.payload.temperature.day}\nif (fhmode === 3){var textmode = \"Night\"; var tempnow = msg.payload.temperature.night}\nif (fhmode === 4){var textmode = \"Away\"; var tempnow = msg.payload.temperature.away}\nif (fhmode === 5){var textmode = \"Timer\"}\n\nmsg.payload = {\"TargetTemperature\": tempnow}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":880,"wires":[["a883de037fff9d6c"]]},{"id":"a883de037fff9d6c","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":880,"wires":[["c268eb03f88f11c3"]]},{"id":"edf1c4b83457df93","type":"function","z":"4ef634328f92511d","name":"New Temp","func":"// Check witch mode active and save new temperature to that mode\nnormal = msg.oldhdlstate.temperature.normal \nday = msg.oldhdlstate.temperature.day\nnight = msg.oldhdlstate.temperature.night\naway = msg.oldhdlstate.temperature.away\n\nif (msg.oldhdlstate.mode === 1){normal = msg.payload}\nif (msg.oldhdlstate.mode === 2){day = msg.payload}\nif (msg.oldhdlstate.mode === 3){night = msg.payload}\nif (msg.oldhdlstate.mode === 4){away = msg.payload}\n\nmsg.oldhdlstate.temperature.normal = Number(normal)\nmsg.oldhdlstate.temperature.day = Number(day)\nmsg.oldhdlstate.temperature.night = Number(night)\nmsg.oldhdlstate.temperature.away = Number(away)\n\n//Build new HDL message\nmsg.code = 7260\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1410,"y":800,"wires":[["fbb36ff4507cfeb0"]]},{"id":"980e8da61728d19c","type":"homekit-service","z":"4ef634328f92511d","isParent":true,"hostType":"0","bridge":"cf42cb6346cc105a","accessoryId":"","parentService":"","name":"Subnet1 Address3 CH1","serviceName":"Thermostat","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.4.3","serialNo":"Default Serial Number","firmwareRev":"1.4.3","hardwareRev":"1.4.3","softwareRev":"1.4.3","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"TargetHeatingCoolingState\":{\"validValues\":[0,1]},\"CurrentHeatingCoolingState\":{\"validValues\":[0,1]},\"TargetTemperature\":{\"Minimum Value\":11,\"Maximum Value\":32,\"Minimum Step\":1}}","waitForSetupMsg":false,"outputs":2,"x":950,"y":1080,"wires":[["1705fe2048b6fb1b"],[]]},{"id":"029dbe4f1010b4c6","type":"switch","z":"4ef634328f92511d","name":"Mode","property":"payload.TargetHeatingCoolingState","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":1270,"y":1060,"wires":[["abf834d94c659dab"]]},{"id":"c81abd53631448e0","type":"switch","z":"4ef634328f92511d","name":"Temp","property":"payload.TargetTemperature","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":1270,"y":1100,"wires":[["29b2849db145b6ca"]]},{"id":"132410ca6ec3a556","type":"switch","z":"4ef634328f92511d","name":"ON OFF","property":"payload.work.status","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":980,"wires":[["9bb1e2bed344ef7c"],["c64e343b01341329"]]},{"id":"7037212fd03b8bec","type":"switch","z":"4ef634328f92511d","name":"Heat / Cool","property":"payload.work.type","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":1040,"wires":[["132410ca6ec3a556","497d458698d49b5a","8b260894a9086eef"],[]]},{"id":"dc86934b17616e6a","type":"comment","z":"4ef634328f92511d","name":"CH 2","info":"","x":270,"y":940,"wires":[]},{"id":"9bb1e2bed344ef7c","type":"change","z":"4ef634328f92511d","name":"Feedback to ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetHeatingCoolingState\":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":960,"wires":[["116feee5a4ace1bd"]]},{"id":"c64e343b01341329","type":"change","z":"4ef634328f92511d","name":"Feedback to OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetHeatingCoolingState\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":1000,"wires":[["0165bb6f24660509"]]},{"id":"1705fe2048b6fb1b","type":"function","z":"4ef634328f92511d","name":"Flow get","func":"//Get Old status from flow variable for complete message\nmsg.oldhdlstate =flow.get(\"hdl/hm/\" + \"1.3\" + \"/\" + 2 + \"/hdlstate\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1140,"y":1080,"wires":[["029dbe4f1010b4c6","c81abd53631448e0"]]},{"id":"abf834d94c659dab","type":"function","z":"4ef634328f92511d","name":"New Mode","func":"// Change from Off or heat to true/false\nif (msg.payload == 0) {msg.oldhdlstate.work.status = false}\nif (msg.payload == 1) {msg.oldhdlstate.work.status = true}\n//Build new HDL message\nmsg.code = 7260\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1410,"y":1060,"wires":[["fbb36ff4507cfeb0"]]},{"id":"116feee5a4ace1bd","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":960,"wires":[["980e8da61728d19c"]]},{"id":"0165bb6f24660509","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":1000,"wires":[["980e8da61728d19c"]]},{"id":"664cbdd402af508f","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":1060,"wires":[["980e8da61728d19c"]]},{"id":"497d458698d49b5a","type":"function","z":"4ef634328f92511d","name":"Update Current Temperature","func":"var currenttemp = msg.payload.temperature.current\nmsg.payload = {\"CurrentTemperature\": currenttemp}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":1060,"wires":[["664cbdd402af508f"]]},{"id":"881ebea675c16e22","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":1120,"wires":[["980e8da61728d19c"]]},{"id":"8b260894a9086eef","type":"function","z":"4ef634328f92511d","name":"Update Setpoint Temperature","func":"var settemp = msg.payload.temperature.normal\nmsg.payload = {\"TargetTemperature\": settemp}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":1120,"wires":[["881ebea675c16e22"]]},{"id":"3ddef043713eca8c","type":"function","z":"4ef634328f92511d","name":"Update Setpoint Temperature","func":"//Mode Change from nr to mode 1:Normal 2:Day 3:Night 4:Away 5:Timer. And add current temprature\nvar fhmode= msg.payload.mode \nif (fhmode === 1){var textmode = \"Normal\"; var tempnow = msg.payload.temperature.normal}\nif (fhmode === 2){var textmode = \"Day\"; var tempnow = msg.payload.temperature.day}\nif (fhmode === 3){var textmode = \"Night\"; var tempnow = msg.payload.temperature.night}\nif (fhmode === 4){var textmode = \"Away\"; var tempnow = msg.payload.temperature.away}\nif (fhmode === 5){var textmode = \"Timer\"}\n\nmsg.payload = {\"TargetTemperature\": tempnow}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":1180,"wires":[["8c152cd0e13797c9"]]},{"id":"8c152cd0e13797c9","type":"rbe","z":"4ef634328f92511d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":750,"y":1180,"wires":[["980e8da61728d19c"]]},{"id":"29b2849db145b6ca","type":"function","z":"4ef634328f92511d","name":"New Temp","func":"// Check witch mode active and save new temperature to that mode\nnormal = msg.oldhdlstate.temperature.normal \nday = msg.oldhdlstate.temperature.day\nnight = msg.oldhdlstate.temperature.night\naway = msg.oldhdlstate.temperature.away\n\nif (msg.oldhdlstate.mode === 1){normal = msg.payload}\nif (msg.oldhdlstate.mode === 2){day = msg.payload}\nif (msg.oldhdlstate.mode === 3){night = msg.payload}\nif (msg.oldhdlstate.mode === 4){away = msg.payload}\n\nmsg.oldhdlstate.temperature.normal = Number(normal)\nmsg.oldhdlstate.temperature.day = Number(day)\nmsg.oldhdlstate.temperature.night = Number(night)\nmsg.oldhdlstate.temperature.away = Number(away)\n\n//Build new HDL message\nmsg.code = 7260\nmsg.payload = msg.oldhdlstate\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1410,"y":1100,"wires":[["fbb36ff4507cfeb0"]]},{"id":"cf42cb6346cc105a","type":"homekit-bridge","bridgeName":"Nodered Virtual Bridge","pinCode":"283-81-078","port":"","advertiser":"bonjour-hap","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.4.3","serialNo":"Default Serial Number","firmwareRev":"1.4.3","hardwareRev":"1.4.3","softwareRev":"1.4.3","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]

Thank you very much, I will test, I will write the result