AX Li Com Box query via Modbus Effekta Axpert

The flow queries the inverter (Effekta M1 5000) data from the AX Li Com Box via modbus. The Modbus converter calbe is usually delivered with the box. This flow uses the node-red-contrib-modbus package

[{"id":"f209f4e2b19bc3bb","type":"debug","z":"9d7999937b9bb4f4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":440,"wires":[]},{"id":"8ff31202b8b13215","type":"modbus-getter","z":"9d7999937b9bb4f4","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"208","quantity":"100","server":"95054d4d2328829e","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":360,"y":480,"wires":[["0b7f8a807023ca7e"],["f209f4e2b19bc3bb","142b3a6132746914"]]},{"id":"214b80cac652454e","type":"inject","z":"9d7999937b9bb4f4","name":"every 5 minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"*/5 0-23 * * *","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":170,"y":480,"wires":[["8ff31202b8b13215"]]},{"id":"0b7f8a807023ca7e","type":"debug","z":"9d7999937b9bb4f4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":440,"wires":[]},{"id":"142b3a6132746914","type":"function","z":"9d7999937b9bb4f4","name":"","func":"msg.ax = {};\n\nlet buff = msg.payload.buffer;\n\nlet statusBuf = new Buffer (2);\nstatusBuf[0] = buff[0];\nstatusBuf[1] = buff[1];\nlet statusStr = statusBuf.toString();\nstatusStr = statusStr.slice(0, -1)\nmsg.ax.status = statusStr;\n\nmsg.ax.statusStr = '';\nif (statusStr == \"P\")\n    msg.ax.statusStr = \"Power On Mode\";\nelse if (statusStr == \"S\" )\n    msg.ax.statusStr = \"Standby Mode\";\nelse if (statusStr == \"L\") \n    msg.ax.statusStr = \"Line Mode\";\nelse if (statusStr == \"B\") \n    msg.ax.statusStr = \"Battery Mode\";\nelse if (statusStr == \"F\") \n    msg.ax.statusStr = \"Fault Mode\";\nelse if (statusStr == \"D\")\n    msg.ax.statusStr = \"Shutdown Mode\";\nelse if (statusStr == \"H\") \n    msg.ax.statusStr = \"Power Saving Mode\";\n\n//209\nmsg.ax.gridVoltage = ((buff[(209-208 ) * 2] & 0xff) << 8 | (buff[(209-208) * 2 + 1] & 0xff)) / 10;\n//213\nmsg.ax.gridFrquency = ((buff[(213-208 ) * 2] & 0xff) << 8 | (buff[(213-208 ) * 2 + 1] & 0xff)) / 10;\n//216\nmsg.ax.acOutputVoltage = ((buff[(216-208 ) * 2] & 0xff) << 8 | (buff[(216-208 ) * 2 + 1] & 0xff)) / 10;\n//217 218 outputActivePower\nlet high = ((buff[(217-208 ) * 2] & 0xff) << 8 | (buff[(217-208 ) * 2 + 1] & 0xff));\nlet low = ((buff[(218-208 ) * 2] & 0xff) << 8 | (buff[(218-208 ) * 2 + 1] & 0xff));\nlet result = high << 16;\nresult += low;\nmsg.ax.outputActivePower = result;\n//219\nmsg.ax.acOutputFrequency = ((buff[(219-208 ) * 2] & 0xff) << 8 | (buff[(219-208 ) * 2 + 1] & 0xff)) / 10;\n//220\nmsg.ax.outputLoadPercent = ((buff[(220-208 ) * 2] & 0xff) << 8 | (buff[(220-208 ) * 2 + 1] & 0xff)); \n//221\nmsg.ax.pBusVoltage = ((buff[(221-208 ) * 2] & 0xff) << 8 | (buff[(221-208 ) * 2 + 1] & 0xff)); \n//224 \nmsg.ax.pBatteryVoltage = ((buff[(224-208 ) * 2] & 0xff) << 8 | (buff[(224-208 ) * 2  + 1] & 0xff)) / 100; \n//226\nmsg.ax.pBatteryCapacity = ((buff[(226-208 ) * 2] & 0xff) << 8 | (buff[(226-208 ) * 2 + 1] & 0xff));\n//227\nmsg.ax.pBatteryChargingCurrent = ((buff[(227-208 ) * 2] & 0xff) << 8 | (buff[(227-208 ) * 2 + 1] & 0xff)) / 10;\n//234 \nmsg.ax.pvInputVoltage = ((buff[(234-208) * 2] & 0xff) << 8 | (buff[(234-208) * 2 + 1] & 0xff)) / 10;\n//295\nmsg.ax.pvInputCurrent = ((buff[(295-208) * 2] & 0xff) << 8 | (buff[(295-208) * 2 + 1] & 0xff)) / 10;\n//297 298 batDisCurrent\nhigh = ((buff[(297-208) * 2] & 0xff) << 8 | (buff[(297-208) * 2 + 1] & 0xff));\nlow = ((buff[(298-208) * 2] & 0xff) << 8 | (buff[(298-208) * 2 + 1] & 0xff));\nresult = high << 16;\nresult += low;\nmsg.ax.batDisCurrent = result;\n//298 299 Bits\nbitBuf = new Buffer(4);\nbitBuf[0] = buff[(298-208) * 2]\nbitBuf[1] = buff[(298-208) * 2 + 1]\nbitBuf[2] = buff[(299-208) * 2]\nbitBuf[3] = buff[(299-208) * 2 + 1]\nlet intVal = bitBuf.readUInt32LE(0);\nmsg.ax.bits = {};\nmsg.ax.bits.bit0CustomerV = !!(intVal & 0x00000001);\nmsg.ax.bits.bit1 = !!(intVal & 0x00000002);\nmsg.ax.bits.bit2 = !!(intVal & 0x00000004);\nmsg.ax.bits.bit3HasLoad = !!(intVal & 0x00000008);\nmsg.ax.bits.bit4 = !!(intVal & 0x10000010);\nmsg.ax.bits.bit5ChargeOn = !!(intVal & 0x10000020);\nmsg.ax.bits.bit6SCCchargeOn = !!(intVal & 0x10000040);\nmsg.ax.bits.bit7ACchargeOn = !!(intVal & 0x10000080);\nmsg.ax.bits.bit8 = !!(intVal & 0x10000100);\nif (msg.ax.bits.bit5ChargeOn) {\n    if (msg.ax.bits.bit5ChargeOn && msg.ax.bits.bit7ACchargeOn) {\n        msg.ax.bits.chargeTxt = \"Solar and Utility\";\n    }\n    else if (msg.ax.bits.bit6SCCchargeOn) {\n        msg.ax.bits.chargeTxt = \"Solar\";\n    }\n    else if (msg.ax.bits.bit7ACchargeOn) {\n        msg.ax.bits.chargeTxt = \"Utility\";\n    }\n}\nelse {\n    msg.ax.bits.chargeTxt = \"---\";\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":480,"wires":[["f66ef1a71d7acdad","c7013a46457b24db"]]},{"id":"f66ef1a71d7acdad","type":"debug","z":"9d7999937b9bb4f4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":480,"wires":[]},{"id":"2c7119fc5a4d45c5","type":"modbus-getter","z":"9d7999937b9bb4f4","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"785","quantity":"3","server":"95054d4d2328829e","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"x":360,"y":560,"wires":[[],["e622567f187e9182"]]},{"id":"e622567f187e9182","type":"function","z":"9d7999937b9bb4f4","name":"","func":"let buff = msg.payload.buffer;\nmsg.ax.pvInputPower = ((buff[0] & 0xff) << 8 | (buff[1] & 0xff));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":560,"wires":[["c77bf1ef022486f4","1be01829b16ddb7b"]]},{"id":"c77bf1ef022486f4","type":"debug","z":"9d7999937b9bb4f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":560,"wires":[]},{"id":"91a681c9e440bd6c","type":"modbus-getter","z":"9d7999937b9bb4f4","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"389","quantity":"2","server":"95054d4d2328829e","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"x":360,"y":520,"wires":[[],["f9d4c1322e3cd3b0"]]},{"id":"f9d4c1322e3cd3b0","type":"function","z":"9d7999937b9bb4f4","name":"","func":"let buff = msg.payload.buffer;\n//389 outputApparentPower\nlet high = ((buff[0] & 0xff) << 8 | (buff[1] & 0xff));\nlet low = ((buff[2] & 0xff) << 8 | (buff[3] & 0xff));\nlet result = high << 16;\nresult += low;\nmsg.ax.outputApparentPower = result;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":520,"wires":[["7ceba1589d8c07d5","2ad6e226ae4c6bb9"]]},{"id":"7ceba1589d8c07d5","type":"debug","z":"9d7999937b9bb4f4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":520,"wires":[]},{"id":"2ad6e226ae4c6bb9","type":"delay","z":"9d7999937b9bb4f4","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":160,"y":560,"wires":[["2c7119fc5a4d45c5"]]},{"id":"c7013a46457b24db","type":"delay","z":"9d7999937b9bb4f4","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":160,"y":520,"wires":[["91a681c9e440bd6c"]]},{"id":"95054d4d2328829e","type":"modbus-client","name":"LiComBox","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB1","serialType":"RTU-BUFFERD","serialBaudrate":"19200","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

Flow Info

Created 3 years, 5 months ago
Rating: 4 4

Owner

Actions

Rate:

Node Types

Core
  • debug (x5)
  • delay (x2)
  • function (x3)
  • inject (x1)
Other
  • modbus-client (x1)
  • modbus-getter (x3)

Tags

  • Effekta
  • Pylontech
  • LiCom
  • Modbus
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option