Kostal Piko inverter - reader and data parser

## For Kostal Piko inverters ##

You need to set the ip, username and password in the request node.

The flow reads data every 5 seconds (changable in first node) and then parses the data into msg.payload. A global variable is also set to the name "kostal" that contains an object with all data.

The following data is read and returned to msg.payload:

  • acPowerCurrent // Current power ex. "596" (= 596 W)
  • totalEnergy // Totalt energy from start, ex. "10596" (= 10596 kWh)
  • dailyEnergy // Totalt energy generated today, ex. "3415" (= 3.415 kWh)
  • status // Status of inverter ex. "off", "standby"...
  • string1voltage // Current voltage on string 1, ex. "695" (= 695 V)
  • string1current // Current current on string 1, ex. "5.12" (= 5.12 A)
  • string2voltage // Current voltage on string 2, ex. "755" (= 755 V)
  • string2current // Current current on string 2, ex. "2.42" (= 2.42 A)
  • line1voltage // Current voltage of L1, ex. "231" (= 231 V)
  • line1power // Current energy on L1, ex. "1354" (= 1.354 kW)
  • line2voltage // Current voltage of L2, ex. "235" (= 235 V)
  • line2power // Current energy on L2, ex. "854" (= 0.854 kW)
  • line3voltage // Current voltage of L3, ex. "230" (= 230 V)
  • line3power // Current energy on L3, ex. "2198" (= 2.198 kW)

You can also read the data from any node/flow by reading the global variable: "kostal" msg.payload = global.get("kostal")

[{"id":"4ad0e46.7796d1c","type":"function","z":"298e6055.ffac3","name":"parse http","func":"acPowerCurrent = parseInt(msg.payload[14].replace(/([^a-z0-9]+)/gi, ''));\ntotalEnergy = parseInt(msg.payload[17].replace(/([^A-Z0-9]+)/gi, ''));\ndailyEnergy = parseInt(msg.payload[26].replace(/([^a-z0-9]+)/gi, ''))/100;\nstring1voltage = parseInt(msg.payload[56].replace(/([^a-z0-9]+)/gi, ''));\nstring1current = parseInt(msg.payload[65].replace(/([^a-z0-9]+)/gi, ''))/100;\nstring2voltage = parseInt(msg.payload[82].replace(/([^a-z0-9]+)/gi, ''));\nstring2current = parseInt(msg.payload[91].replace(/([^a-z0-9]+)/gi, ''))/100;\nline1voltage = parseInt(msg.payload[59].replace(/([^a-z0-9]+)/gi, ''));\nline1power = parseInt(msg.payload[68].replace(/([^a-z0-9]+)/gi, ''));\nline2voltage = parseInt(msg.payload[85].replace(/([^a-z0-9]+)/gi, ''));\nline2power = parseInt(msg.payload[94].replace(/([^a-z0-9]+)/gi, ''));\nline3voltage = parseInt(msg.payload[111].replace(/([^a-z0-9]+)/gi, ''));\nline3power = parseInt(msg.payload[120].replace(/([^a-z0-9]+)/gi, ''));\nstatus = msg.payload[32].replace(/\\r?\\n|\\r/g, '').replace(/\\s/g, \"\");\n\n\nif (Number.isNaN(acPowerCurrent) === true){\n    acPowerCurrent = 0;\n}\nif (Number.isNaN(totalEnergy) === true){\n    totalEnergy = -1;\n}\nif (Number.isNaN(dailyEnergy) === true){\n    dailyEnergy = 0;\n}\nif (Number.isNaN(string1voltage) === true){\n    string1voltage = 0;\n}\nif (Number.isNaN(string1current) === true){\n    string1current = 0;\n}\nif (Number.isNaN(string2voltage) === true){\n    string2voltage = 0;\n}\nif (Number.isNaN(string2current) === true){\n    string2current = 0;\n}\nif (Number.isNaN(line1voltage) === true){\n    line1voltage = 0;\n}\nif (Number.isNaN(line1power) === true){\n    line1power = 0;\n}\nif (Number.isNaN(line2voltage) === true){\n    line2voltage = 0;\n}\nif (Number.isNaN(line2power) === true){\n    line2power = 0;\n}\nif (Number.isNaN(line3voltage) === true){\n    line3voltage = 0;\n}\nif (Number.isNaN(line3power) === true){\n    line3power = 0;\n}\n\nmsg.payload = {\n    \"acPowerCurrent\" : acPowerCurrent,\n    \"totalEnergy\" : totalEnergy,\n    \"dailyEnergy\" : dailyEnergy,\n    \"status\" : status,\n    \"string1voltage\" : string1voltage,\n    \"string1current\" : string1current,\n    \"string2voltage\" : string2voltage,\n    \"string2current\" : string2current,\n    \"line1voltage\" : line1voltage,\n    \"line1power\" : line1power,\n    \"line2voltage\" : line2voltage,\n    \"line2power\" : line2power,\n    \"line3voltage\" : line3voltage,\n    \"line3power\" : line3power\n}\n\nglobal.set(\"kostal\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":860,"y":70,"wires":[["c4a0537.01675b"]]},{"id":"fd1711f2.7e7b4","type":"http request","z":"298e6055.ffac3","name":"kostal","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.1.99/index.fhtml","tls":"","persist":false,"proxy":"","authType":"basic","x":550,"y":70,"wires":[["3f445786.6a93b8"]]},{"id":"3f445786.6a93b8","type":"html","z":"298e6055.ffac3","name":"","property":"payload","outproperty":"payload","tag":"td","ret":"text","as":"single","x":700,"y":70,"wires":[["4ad0e46.7796d1c"]]},{"id":"b32e7821.c1dc78","type":"inject","z":"298e6055.ffac3","name":"5 sec","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":400,"y":70,"wires":[["fd1711f2.7e7b4"]]}]

Flow Info

Created 9 months, 2 weeks ago
Rating: not yet rated

Owner

Node Types

Core
  • function (x1)
  • html (x1)
  • http request (x1)
  • inject (x1)

Tags

  • kostal
  • piko
  • inverter
  • reader
  • parser
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option