SDM630 Modbus Gateway - Starter Kit

start to read from your SDM630 Modbus with the RS-485 Gateway and the node-red-contrib-modbus package ...

[{"id":"8ca660a0.79874","type":"tab","label":"SDM630 Modbus Gateway","disabled":false,"info":""},{"id":"6bf7fb6a.5138a4","type":"modbus-read","z":"8ca660a0.79874","name":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"InputRegister","adr":"0","quantity":"50","rate":"30","rateUnit":"s","server":"8d22bae7.f4d3e8","x":120,"y":370,"wires":[[],["299d530a.352f5c","734cef5c.fe7ee"]]},{"id":"299d530a.352f5c","type":"modbus-response","z":"8ca660a0.79874","name":"","registerShowMax":"1","x":340,"y":320,"wires":[]},{"id":"734cef5c.fe7ee","type":"function","z":"8ca660a0.79874","name":"extract buffer data","func":"let voltageL1 = msg.payload.buffer.readFloatBE(0,4) // 1,2\nlet voltageL2 = msg.payload.buffer.readFloatBE(4,4) // 3,4\nlet voltageL3 = msg.payload.buffer.readFloatBE(8,4) // 5,6\n\nlet powerL1 = msg.payload.buffer.readFloatBE(12,4) // 7,8\nlet powerL2 = msg.payload.buffer.readFloatBE(16,4) // 9,10\nlet powerL3 = msg.payload.buffer.readFloatBE(20,4) // 11,12\n\nlet demandL1 = msg.payload.buffer.readFloatBE(24,4) // 13,14\nlet demandL2 = msg.payload.buffer.readFloatBE(28,4) // 15,16\nlet demandL3 = msg.payload.buffer.readFloatBE(32,4) // 17,18\n\nlet voltageAVG = msg.payload.buffer.readFloatBE(84,8) // 43-46\nlet powerAVG = msg.payload.buffer.readFloatBE(92,4) // 47,48\n\nreturn [\n    {\n        payload: {\n            L1: {\n                voltage: voltageL1,\n                power: powerL1,\n                demand: demandL1\n            },\n            L2: {\n                voltage: voltageL2,\n                power: powerL2,\n                demand: demandL2\n            },\n            L3: {\n                voltage: voltageL3,\n                power: powerL3,\n                demand: demandL3\n            },\n            voltageAVG: voltageAVG,\n            powerAVG: powerAVG,            \n        }\n    }\n];","outputs":"1","noerr":0,"x":340,"y":380,"wires":[["dba524a3.c77f88","918466c0.50f1d8","3d1526a4.354d8a","860485c2.e44a38"]]},{"id":"dba524a3.c77f88","type":"debug","z":"8ca660a0.79874","name":"","active":false,"console":"false","complete":"false","x":570,"y":370,"wires":[]},{"id":"71e583af.54825c","type":"ui_chart","z":"8ca660a0.79874","name":"","group":"6429f300.b7d22c","order":2,"width":0,"height":0,"label":"power","chartType":"line","legend":"true","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":820,"y":300,"wires":[[],[]]},{"id":"a59da086.56709","type":"ui_gauge","z":"8ca660a0.79874","name":"","group":"a5837c25.7d146","order":1,"width":0,"height":0,"gtype":"gage","title":"Frequency","label":"Hz","format":"{{value | number:2}}","min":0,"max":"100","colors":["#e2e310","#28cd22","#d93d3f"],"seg1":"","seg2":"","x":640,"y":650,"wires":[]},{"id":"918466c0.50f1d8","type":"function","z":"8ca660a0.79874","name":"power","func":"return [\n    {payload: msg.payload.L1.power, topic:'L1'}, \n    {payload: msg.payload.L2.power, topic:'L2'}, \n    {payload: msg.payload.L3.power, topic:'L3'},\n    {payload: msg.payload.powerAVG, topic:'AVG'}\n];","outputs":"4","noerr":0,"x":570,"y":110,"wires":[["71e583af.54825c"],["71e583af.54825c"],["71e583af.54825c"],["71e583af.54825c"]]},{"id":"3d1526a4.354d8a","type":"function","z":"8ca660a0.79874","name":"voltage","func":"return [\n    {payload: msg.payload.L1.voltage, topic:'L1'}, \n    {payload: msg.payload.L2.voltage, topic:'L2'}, \n    {payload: msg.payload.L3.voltage, topic:'L3'},\n    {payload: msg.payload.voltageAVG, topic:'AVG'}\n];","outputs":"4","noerr":0,"x":580,"y":200,"wires":[["e83a3962.d0ecc8"],["e83a3962.d0ecc8"],["e83a3962.d0ecc8"],["e83a3962.d0ecc8"]]},{"id":"e83a3962.d0ecc8","type":"ui_chart","z":"8ca660a0.79874","name":"","group":"6429f300.b7d22c","order":3,"width":0,"height":0,"label":"voltage","chartType":"line","legend":"true","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":830,"y":340,"wires":[[],[]]},{"id":"860485c2.e44a38","type":"function","z":"8ca660a0.79874","name":"demand","func":"return [\n    {payload: msg.payload.L1.demand, topic:'L1'}, \n    {payload: msg.payload.L2.demand, topic:'L2'}, \n    {payload: msg.payload.L3.demand, topic:'L3'}\n];","outputs":"3","noerr":0,"x":580,"y":280,"wires":[["1022dc8a.2c83a3"],["1022dc8a.2c83a3"],["1022dc8a.2c83a3"]]},{"id":"1022dc8a.2c83a3","type":"ui_chart","z":"8ca660a0.79874","name":"","group":"6429f300.b7d22c","order":1,"width":0,"height":0,"label":"demand","chartType":"line","legend":"true","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":830,"y":380,"wires":[[],[]]},{"id":"a8f8bd8.e13f74","type":"ui_gauge","z":"8ca660a0.79874","name":"","group":"a5837c25.7d146","order":1,"width":0,"height":0,"gtype":"gage","title":"Sum demand ","label":"kW","format":"{{value | number:3}}","min":0,"max":"5000","colors":["#e2e310","#28cd22","#d93d3f"],"seg1":"","seg2":"","x":650,"y":730,"wires":[]},{"id":"db827506.88e2d8","type":"ui_gauge","z":"8ca660a0.79874","name":"","group":"a5837c25.7d146","order":1,"width":0,"height":0,"gtype":"gage","title":"Max. demand ","label":"kW","format":"{{value | number:3}}","min":0,"max":"5000","colors":["#e2e310","#28cd22","#d93d3f"],"seg1":"","seg2":"","x":650,"y":770,"wires":[]},{"id":"1d9c76a1.2cc3c9","type":"ui_gauge","z":"8ca660a0.79874","name":"","group":"a5837c25.7d146","order":1,"width":0,"height":0,"gtype":"gage","title":"Ampere hour","label":"kAh","format":"{{value | number:2}}","min":0,"max":"2000","colors":["#e2e310","#28cd22","#d93d3f"],"seg1":"","seg2":"","x":640,"y":690,"wires":[]},{"id":"5d8df7c7.440328","type":"modbus-read","z":"8ca660a0.79874","name":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"InputRegister","adr":"48","quantity":"8","rate":"30","rateUnit":"s","server":"8d22bae7.f4d3e8","x":120,"y":520,"wires":[[],["dc55b7c4.702c08","80e27205.f0f36"]]},{"id":"dc55b7c4.702c08","type":"function","z":"8ca660a0.79874","name":"extract buffer data","func":"let powerSum = msg.payload.buffer.readFloatBE(0,8)\nlet demandSum = msg.payload.buffer.readFloatBE(8,8)\n\nreturn [\n    {\n        payload: {\n            powerSum: powerSum,\n            demandSum: demandSum\n        }\n    }\n];","outputs":"1","noerr":0,"x":340,"y":540,"wires":[["d7ddea46.f219b8","fc998056.2fe91","bef38df4.b658"]]},{"id":"d7ddea46.f219b8","type":"function","z":"8ca660a0.79874","name":"power","func":"return [\n    {payload: msg.payload.powerSum, topic:'SUM'}\n];","outputs":"1","noerr":0,"x":610,"y":470,"wires":[["71e583af.54825c"]]},{"id":"fc998056.2fe91","type":"function","z":"8ca660a0.79874","name":"demand","func":"return [\n    {payload: msg.payload.demandSum, topic:'SUM'},\n    {payload: msg.payload.demandRunningSum, topic:'rSUM'}\n];","outputs":"2","noerr":0,"x":620,"y":520,"wires":[["1022dc8a.2c83a3"],["1022dc8a.2c83a3"]]},{"id":"ed8fe441.278278","type":"modbus-read","z":"8ca660a0.79874","name":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"InputRegister","adr":"70","quantity":"42","rate":"30","rateUnit":"s","server":"8d22bae7.f4d3e8","x":120,"y":740,"wires":[[],["60304f44.972e9","a9fdcb40.b3fb18"]]},{"id":"60304f44.972e9","type":"function","z":"8ca660a0.79874","name":"extract buffer data","func":"let frequency = msg.payload.buffer.readFloatBE(0,4) // 71,72\n\nlet ampHourSinceLastReset = msg.payload.buffer.readFloatBE(24,4) // 83,84\nlet totalSystemPowerDemand = msg.payload.buffer.readFloatBE(28,4) // 85,86\nlet maxTotalSystemPowerDemand = msg.payload.buffer.readFloatBE(32,4) // 87,88\n\nreturn [\n    { \n        payload: frequency\n    },\n    {\n        payload: ampHourSinceLastReset / 1000.0\n    },    \n    {\n        payload: totalSystemPowerDemand / 1000.0\n    },\n    {\n        payload: maxTotalSystemPowerDemand / 1000.0\n    }\n];","outputs":"4","noerr":0,"x":340,"y":770,"wires":[["a59da086.56709","15d2aeba.7a45b1"],["1d9c76a1.2cc3c9","15d2aeba.7a45b1"],["a8f8bd8.e13f74","15d2aeba.7a45b1"],["db827506.88e2d8","15d2aeba.7a45b1"]]},{"id":"bef38df4.b658","type":"debug","z":"8ca660a0.79874","name":"","active":false,"console":"false","complete":"false","x":630,"y":560,"wires":[]},{"id":"15d2aeba.7a45b1","type":"debug","z":"8ca660a0.79874","name":"","active":false,"console":"false","complete":"false","x":640,"y":820,"wires":[]},{"id":"80e27205.f0f36","type":"modbus-response","z":"8ca660a0.79874","name":"","registerShowMax":"1","x":340,"y":480,"wires":[]},{"id":"a9fdcb40.b3fb18","type":"modbus-response","z":"8ca660a0.79874","name":"","registerShowMax":"1","x":340,"y":700,"wires":[]},{"id":"8d22bae7.f4d3e8","type":"modbus-client","z":"8ca660a0.79874","name":"SDM630 Modbus Gateway","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"192.168.178.16","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"},{"id":"6429f300.b7d22c","type":"ui_group","z":"8ca660a0.79874","name":"Energy","tab":"31467436.2d3dcc","disp":true,"width":"14"},{"id":"a5837c25.7d146","type":"ui_group","z":"8ca660a0.79874","name":"Fix","tab":"31467436.2d3dcc","order":2,"disp":true,"width":"6"},{"id":"31467436.2d3dcc","type":"ui_tab","z":"8ca660a0.79874","name":"smartHouse","icon":"dashboard"}]

Flow Info

Created 2 years, 10 months ago
Rating: 5 1

Owner

Node Types

Core
  • debug (x3)
  • function (x8)
  • tab (x1)
Other

Tags

  • modbus
  • SDM630
  • gateway
  • voltage
  • power
  • demand
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option