I modified the flow to use JSON HTTP instead of MQTT. Now i only use MQTT for setpoint changes. Please note you have to edit the Build HTTP Request function to your Domoticz settings.
Code: Select all
[{"id":"2070e95a.a9555a","type":"nefit-easy-config","z":"b83a61b3.47c5a","serialNumber":"","accessKey":"","password":"","timeout":"60"},{"id":"86f0c28c.790f4","type":"mqtt-broker","z":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"f0310caa.577e2","type":"inject","z":"b83a61b3.47c5a","name":"","topic":"nefit-status","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"x":124,"y":75.35716247558594,"wires":[["c36e75f0.089e4"]]},{"id":"9fa51e6d.4853c","type":"debug","z":"b83a61b3.47c5a","name":"","active":true,"console":"true","complete":"true","x":1626.7540283203125,"y":217.60714721679688,"wires":[]},{"id":"e21d13d7.54d608","type":"mqtt in","z":"b83a61b3.47c5a","name":"domoticz/out/#","topic":"domoticz/out/#","broker":"86f0c28c.790f4","x":88.07138061523438,"y":617,"wires":[["be46893b.ec1a7"]]},{"id":"be46893b.ec1a7","type":"function","z":"b83a61b3.47c5a","name":"de-jsonify","func":"var payload = JSON.parse(msg.payload);\nreturn payload;","outputs":1,"noerr":0,"x":254.07138061523438,"y":617,"wires":[["82aa37b1.26f148"]]},{"id":"8f458b60.6c998","type":"debug","z":"b83a61b3.47c5a","name":"","active":false,"console":"false","complete":"true","x":965.3214111328125,"y":615.7500019073486,"wires":[]},{"id":"10471660.16b0ca","type":"function","z":"b83a61b3.47c5a","name":"Get SetPoint Value","func":"msg.payload = msg.svalue1\nreturn msg;","outputs":1,"noerr":0,"x":633.2658462524414,"y":616.0833168029785,"wires":[["de4fda49.b134f"]]},{"id":"82aa37b1.26f148","type":"switch","z":"b83a61b3.47c5a","name":"filter Setpoint IDX","property":"idx","rules":[{"t":"eq","v":"160"}],"checkall":"true","outputs":1,"x":432.51580810546875,"y":616.5555419921875,"wires":[["10471660.16b0ca"]]},{"id":"71ac80f8.677704","type":"comment","z":"b83a61b3.47c5a","name":"Read changes from Domoticz and send to Easy","info":"","x":189.07138061523438,"y":580,"wires":[]},{"id":"a47fff4f.db6778","type":"function","z":"b83a61b3.47c5a","name":"Domoticz MQTT","func":"// Configuration , set to -1 if you dont want to use the sensor\nvar IDX = {};\nIDX['nefit-setpoint'] = 160;\nIDX['nefit-roomtemp'] = 161;\nIDX['nefit-outdoortemp'] = 167;\nIDX['nefit-pressure'] = 162;\nIDX['nefit-boilerindicator'] = 168;\nIDX['nefit-statuscode'] = 163;\nIDX['nefit-flow-temperature'] =164;\n\n// Create message\nvar domoticz_msg = {};\ndomoticz_msg.topic = \"domoticz/in\";\ndomoticz_msg.payload = {};\n\nswitch (msg.topic) {\n // Topics from nefit-status\n case 'nefit-roomtemp' :\n case 'nefit-outdoortemp' :\n case 'nefit-boilerindicator':\n case 'nefit-setpoint' :\n case 'nefit-statuscode' :\n if (IDX[msg.topic] != -1) {\n domoticz_msg.payload.idx = IDX[msg.topic];\n domoticz_msg.payload.nvalue = 0;\n domoticz_msg.payload.svalue = \"\" + msg.payload;\n if (msg.topic == 'nefit-setpoint') {\n domoticz_msg.output = 'mqtt'\n domoticz_msg.payload.parse = false;\n }\n }\n\n break;\n case 'nefit-pressure' :\n if (IDX[msg.topic] != -1) {\n var NefitJSON = JSON.parse(msg.payload);\n domoticz_msg.payload.idx = IDX[msg.topic];\n domoticz_msg.payload.nvalue = 0;\n domoticz_msg.payload.svalue = \"\" + NefitJSON['pressure'];\n }\n break;\n case 'nefit-flow-temperature' :\n if (IDX[msg.topic]) {\n var NefitJSON = JSON.parse(msg.payload);\n domoticz_msg.payload.idx = IDX[msg.topic];\n domoticz_msg.payload.nvalue = 0;\n domoticz_msg.payload.svalue = \"\" + NefitJSON['temperature'];\n }\n break;\n default:\n return;\n}\n\nreturn domoticz_msg;\n","outputs":1,"noerr":0,"x":1063,"y":215.21429443359375,"wires":[["3a68092b.2a46ee"]]},{"id":"e232a850.baa2c","type":"mqtt out","z":"b83a61b3.47c5a","name":"Domoticz MQTT","topic":"","qos":"","retain":"","broker":"86f0c28c.790f4","x":1441.75,"y":314.96429443359375,"wires":[]},{"id":"2b74b537.2f9dc6","type":"inject","z":"b83a61b3.47c5a","name":"","topic":"nefit-pressure","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"x":125,"y":305.357177734375,"wires":[["6d1aa742.8cfab8"]]},{"id":"e182c879.f16fd8","type":"comment","z":"b83a61b3.47c5a","name":"Publish data from Nefit Easy Client to Domoticz","info":"","x":187.07138061523438,"y":22,"wires":[]},{"id":"f506871a.acbe7","type":"rbe","z":"b83a61b3.47c5a","name":"","func":"rbe","gap":"","x":826.0714111328125,"y":56,"wires":[["a47fff4f.db6778"]]},{"id":"6ee39037.bb5c4c","type":"function","z":"b83a61b3.47c5a","name":"Parse JSON","func":"var NefitJSON = JSON.parse(msg.payload);\nmsg1 = {};\nmsg2 = {};\nmsg3 = {};\nmsg4 = {};\nmsg1.topic = 'nefit-setpoint';\nmsg1.payload = NefitJSON['temp setpoint'];\nmsg2.topic = 'nefit-roomtemp';\nmsg2.payload = NefitJSON['in house temp'];\nmsg3.topic = 'nefit-outdoortemp';\nmsg3.payload = NefitJSON['outdoor temp'];\nmsg4.topic = 'nefit-boilerindicator';\nmsg4.payload = NefitJSON['boiler indicator'];\nreturn [msg1,msg2,msg3,msg4];","outputs":"4","noerr":0,"x":622.5714111328125,"y":75.00001525878906,"wires":[["f506871a.acbe7"],["a47fff4f.db6778"],["a47fff4f.db6778"],["d369a91.8270318"]]},{"id":"fb1d1576.db6fb","type":"inject","z":"b83a61b3.47c5a","name":"","topic":"nefit-statuscode","payload":"","payloadType":"date","repeat":"60","crontab":"","once":false,"x":121.142822265625,"y":241.10716247558594,"wires":[["a4070a6c.adf5c"]]},{"id":"b169b9e6.8e827","type":"rbe","z":"b83a61b3.47c5a","name":"","func":"rbe","gap":"","x":798.142822265625,"y":251.57144165039062,"wires":[["a47fff4f.db6778"]]},{"id":"c36e75f0.089e4","type":"nefit-easy","z":"b83a61b3.47c5a","easyconfig":"2070e95a.a9555a","name":"","topic":"nefit-status","command":"status","x":300.5,"y":75.35716247558594,"wires":[["85ad8d13.d10d2"]]},{"id":"a4070a6c.adf5c","type":"nefit-easy","z":"b83a61b3.47c5a","easyconfig":"2070e95a.a9555a","name":"","topic":"nefit-statuscode","command":"display-code","x":296.5,"y":241.85716247558594,"wires":[["7e8c3906.0149c8"]]},{"id":"6d1aa742.8cfab8","type":"nefit-easy","z":"b83a61b3.47c5a","easyconfig":"2070e95a.a9555a","name":"","topic":"nefit-pressure","command":"pressure","x":297.5,"y":305.357177734375,"wires":[["147e4cc.4f491b3"]]},{"id":"de4fda49.b134f","type":"nefit-easy","z":"b83a61b3.47c5a","easyconfig":"2070e95a.a9555a","name":"","topic":"nefit-set","command":"set-temperature","x":810.0714111328125,"y":616.0000019073486,"wires":[["8f458b60.6c998"]]},{"id":"7e8c3906.0149c8","type":"json","z":"b83a61b3.47c5a","name":"","x":467.5,"y":241.85716247558594,"wires":[["389ea7b4.e23c38"]]},{"id":"85ad8d13.d10d2","type":"json","z":"b83a61b3.47c5a","name":"","x":455,"y":75.35716247558594,"wires":[["6ee39037.bb5c4c"]]},{"id":"d369a91.8270318","type":"rbe","z":"b83a61b3.47c5a","name":"","func":"rbe","gap":"","x":799.0714111328125,"y":201,"wires":[["a47fff4f.db6778"]]},{"id":"efab4bc5.94d228","type":"inject","z":"b83a61b3.47c5a","name":"","topic":"nefit-flow-temperature","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"x":122,"y":382.00001525878906,"wires":[["2cb0fac.7081c06"]]},{"id":"2cb0fac.7081c06","type":"nefit-easy","z":"b83a61b3.47c5a","easyconfig":"2070e95a.a9555a","name":"","topic":"nefit-flow-temperature","command":"flow-temperature","x":443,"y":383.00001525878906,"wires":[["f797913b.e0a45"]]},{"id":"f797913b.e0a45","type":"json","z":"b83a61b3.47c5a","name":"","x":799,"y":382.00001525878906,"wires":[["a47fff4f.db6778"]]},{"id":"389ea7b4.e23c38","type":"function","z":"b83a61b3.47c5a","name":"Get Status Code","func":"var NefitJSON = JSON.parse(msg.payload);\nmsg.topic = 'nefit-statuscode';\nmsg.payload = \"\"+\"[ \"+NefitJSON['code']+\" ] \"+NefitJSON['description'];\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":241.35714721679688,"wires":[["b169b9e6.8e827"]]},{"id":"147e4cc.4f491b3","type":"json","z":"b83a61b3.47c5a","name":"","x":799,"y":304,"wires":[["a47fff4f.db6778"]]},{"id":"61364b6f.65f384","type":"function","z":"b83a61b3.47c5a","name":"Build HTTP Request","func":"msg.url = 'http://172.30.0.10/json.htm?type=command¶m=udevice&idx='+msg.payload.idx+'&nvalue='+msg.payload.nvalue+'&svalue='+msg.payload.svalue\nreturn msg;","outputs":1,"noerr":0,"x":1447,"y":120,"wires":[["10163004.9a9628","9fa51e6d.4853c"]]},{"id":"10163004.9a9628","type":"http request","z":"b83a61b3.47c5a","name":"Domoticz HTTP","method":"GET","ret":"txt","url":"","x":1682,"y":123,"wires":[["9fa51e6d.4853c"]]},{"id":"3a68092b.2a46ee","type":"switch","z":"b83a61b3.47c5a","name":"Output Method","property":"output","rules":[{"t":"else"},{"t":"eq","v":"mqtt"}],"checkall":"true","outputs":2,"x":1246,"y":218,"wires":[["61364b6f.65f384"],["e232a850.baa2c","9fa51e6d.4853c"]]}]