[{"id":"35b24b20.e53a34","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"a969ece1.106bd","type":"mbus-out","z":"35b24b20.e53a34","name":"Kamstrup","client":"b8af9f24.8bce","x":460,"y":60,"wires":[["22f0e97d.331106"]]},{"id":"22f0e97d.331106","type":"debug","z":"35b24b20.e53a34","name":"","active":false,"console":false,"complete":"false","x":670,"y":60,"wires":[]},{"id":"da70b0d9.e686e","type":"debug","z":"35b24b20.e53a34","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":120,"wires":[]},{"id":"bde8a2d2.64514","type":"inject","z":"35b24b20.e53a34","name":"Get Devices","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"","topic":"getDevices","payload":"","payloadType":"str","x":170,"y":160,"wires":[["d3b3374a.93ade8"]]},{"id":"184cb18f.1b906e","type":"mqtt out","z":"35b24b20.e53a34","name":"","topic":"kamstrup","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f935c11c.41462","x":980,"y":180,"wires":[]},{"id":"ecc32f4.84ea2d","type":"inject","z":"35b24b20.e53a34","name":"Read ID 1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"120","crontab":"","once":false,"onceDelay":"","topic":"getDevice","payload":"{\"address\": \"827235452D2C4004\"}","payloadType":"json","x":150,"y":60,"wires":[["d3b3374a.93ade8"]]},{"id":"f55ed55a.826ba8","type":"function","z":"35b24b20.e53a34","name":"Extract + Format Kamstrup 302","func":"\nvar TotalHeatEnergy = msg.payload.DataRecord[0].Value; \nvar TotalCoolEnergy = msg.payload.DataRecord[14].Value;\nvar FlowTemperature = msg.payload.DataRecord[6].Value /100;\nvar ReturnTemperature = msg.payload.DataRecord[7].Value /100;\nvar DiffTemperature = Math.abs(msg.payload.DataRecord[8].Value /100);\nvar PowerInstValue = Math.abs(msg.payload.DataRecord[9].Value *100);\nvar FlowValue = msg.payload.DataRecord[11].Value;\nvar FlowValuelm = Number((FlowValue/60).toFixed(2));\n\n\nlet _msg = {\n payload: []\n};\n\n_msg.payload=\n {\n measurement: \"kamstrup\",\n\t\tfields: {\n totalheatenergy : TotalHeatEnergy, \n totalcoolenergy : TotalCoolEnergy,\n flowtemperature : FlowTemperature, \n returntemperature : ReturnTemperature,\n difftemperature : DiffTemperature,\n powerinstvalue : PowerInstValue,\n flowvalue : FlowValue, \n flowvaluelm : FlowValuelm, \n\n\t\t },\n\t\ttags:{\n\t\t device: \"heatmeter\",\n\t\t },\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":180,"wires":[["471ea00.c27556","184cb18f.1b906e"]]},{"id":"471ea00.c27556","type":"debug","z":"35b24b20.e53a34","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":240,"wires":[]},{"id":"d3b3374a.93ade8","type":"mbus-controller","z":"35b24b20.e53a34","name":"M-Bus Controller","client":"b8af9f24.8bce","x":410,"y":120,"wires":[["f55ed55a.826ba8","da70b0d9.e686e"]]},{"id":"b8af9f24.8bce","type":"mbus-client","name":"Kamstrup","clienttype":"serial","tcpHost":"127.0.0.1","tcpPort":"10001","tcpTimeout":"4000","serialPort":"/dev/serial/by-id/usb-Silicon_Labs_Relay_M-Bus_Micro-Master_USB_9040-if00-port0","serialBaudrate":"2400","reconnectTimeout":"30000","autoScan":false,"storeDevices":true,"disableLogs":false},{"id":"f935c11c.41462","type":"mqtt-broker","name":"MQTT","broker":"core-mosquitto","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]