SunSynk / Pylontech RS485

Read this

Humour me and check that it is infact devtty0 and not devama0 on the pi

On Linux, /dev/tty0 is the current virtual console. /dev/ttyAMA0 is the serial port on the header pins of the Pi (often used by a virtual console in linux distros). And of course /dev/ttyUSB0 is the first usb-connected tty. /dev/ttyS0 is the first serially-connected tty, although I’ve only seen two platforms use this, actual old 90s computers with real RS232 ports (typically 16550 UARTS), and the Einstein platform also used for the cerbo-GX also uses that schema.

According to the bash script at the end of that thread on stackexchange…

pi@raspberrypi:~/Documents $ ./checkDev.sh
/dev/ttyUSB0 - FTDI_FT232R_USB_UART_AB0M9Y6K

And, yes, that’s the ONLY device. (nothing else)

Sorry. Been awol for a while.

I created a guide for myself some time ago. Let me try to find it and attach here.

I got help from bloubul on the other forum. There’s actually a thread about it and the guys have created an update where nodered basically pushes the data automatically to HA.

You can follow this guide that I created.

So first thing i got was this
https://www.robotics.org.za/W14882?search=rs485%20pi

This also works
https://www.robotics.org.za/RS485-3P?search=RS485-3P

I used a Pi 3B with this Hat and it’s connected to the inverter over RS485 port. The table in the manual is not correct. Use the below pinouts so pin 2 and 7 connects to A on the HAT and 1 and 8 connects to B on the HAT. I don’t use the ground.

I then install Pi OS on the PI. Good to enable remote access.

Make the following config changes on the Pi configuration

Install Node Red on this PI using following from terminal window
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

Set it to autostart at startup
sudo systemctl enable nodered.service

Open the editor by
http://:1880
You can find the IP address by running hostname -I on the Pi

Once Node Red has been installed you need to activate the Serial Port Hardware. You can do this by following this link: Using the serial port on Raspberry Pi
Make sure the Bluetooth is disabled otherwise the serial port will not work.
/boot/config.txt. comment out dtoverlay=pi3-miniuart-bt

#dtoverlay=pi3-miniuart-bt
Then I added the following 2 lines in the config.txt to enable the HAT.
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=8000000,interupt=25,spimaxfrequency=1000000

then on Node Red,
Under the menu in the right hand corner, go to “Manage palette”. Then install the following nodes:
• node-red-contrib-modbus
• node-red-contrib-queue-gate
• node-red-contrib-simple-gate

I installed a whole lot of other nodes as well. So if something is still not found, just search for it from the palette and install
Next you can import the attached flows into Nodered. This is done by using the import function:

Once the flows have been imported and you don’t get any errors about missing components, you would need to change the MQTT server settings:
On the monitoring flow, double click on the one of the MQTT nodes. This should open a screen like below:

Change the server address to point to your Home assistant IP

Change the username & password to align with the security details of your HA MQTT broker

Then you can deploy and is should hopefully work.

Then add the following lines to your configuration.yaml file.

SunSynk Integration

Solar Sensors

sensor:

  • platform: mqtt
    name: “SS_Solar_Day”
    state_topic: “SunSynk/Solar_PV_Day”
    unit_of_measurement: ‘kWh’
    device_class: energy

  • platform: mqtt
    name: “SS_PV1_Power”
    state_topic: “SunSynk/Solar_PV1_Power”
    unit_of_measurement: ‘W’
    device_class: power

  • platform: mqtt
    name: “SS_PV1_Volts”
    state_topic: “SunSynk/Solar_PV1_Volts”
    unit_of_measurement: ‘V’
    device_class: voltage

  • platform: mqtt
    name: “SS_PV2_Power”
    state_topic: “SunSynk/Solar_PV2_Power”
    unit_of_measurement: ‘W’
    device_class: power

  • platform: mqtt
    name: “Micro_Inv_Power”
    state_topic: “SunSynk/Micro_Inv_Power”
    unit_of_measurement: ‘W’
    device_class: power

  • platform: mqtt
    name: “SS_PV2_Volts”
    state_topic: “SunSynk/Solar_PV2_Volts”
    unit_of_measurement: ‘V’
    device_class: voltage

Grid Sensors

Power imported from grid

  • platform: mqtt
    name: “SS_grid_gridbuy_day”
    state_topic: “SunSynk/grid_gridbuy_day”
    unit_of_measurement: ‘kWh’
    device_class: energy

Power export to grid

  • platform: mqtt
    name: “SS_grid_gridsell_day”
    state_topic: “SunSynk/grid_export_day”
    unit_of_measurement: ‘kWh’
    device_class: energy

    Inverter Voltage

  • platform: mqtt
    name: “ss_voltage_inverter”
    state_topic: “SunSynk/grid_voltage_inverter”
    unit_of_measurement: ‘V’
    device_class: voltage

    Grid Voltage

  • platform: mqtt
    name: “ss_voltage_grid”
    state_topic: “SunSynk/grid_voltage_grid”
    unit_of_measurement: ‘V’
    device_class: voltage

  • platform: mqtt
    name: “ss_load_total”
    state_topic: “SunSynk/grid_inverter_load”
    unit_of_measurement: ‘W’
    device_class: power

  • platform: mqtt
    name: “ss_grid_total”
    state_topic: “SunSynk/grid_grid_load”
    unit_of_measurement: ‘W’
    device_class: power

  • platform: mqtt
    name: “ss_grid_CT”
    state_topic: “SunSynk/grid_grid_ct”
    unit_of_measurement: ‘W’
    device_class: power

  • platform: mqtt
    name: “ss_grid_total_load”
    state_topic: “SunSynk/grid_total_load”
    unit_of_measurement: ‘W’
    device_class: power

  • platform: integration
    name: ss_grid_ct_khw
    source: sensor.ss_grid_ct
    method: trapezoidal
    unit_prefix: k
    round: 2

Battery

Battery Voltage

  • platform: mqtt
    name: “ss_battery_volts”
    state_topic: “SunSynk/battery_volts”
    unit_of_measurement: ‘V’
    device_class: voltage

Battery State of Charge

  • platform: mqtt
    name: “ss_battery_soc”
    state_topic: “SunSynk/battery_soc”
    unit_of_measurement: “%”
    device_class: battery

Battery Output Power

  • platform: mqtt
    name: “ss_battery_output_power”
    state_topic: “SunSynk/battery_output_power”
    unit_of_measurement: ‘W’
    device_class: power

Battery Output Current

  • platform: mqtt
    name: “ss_battery_output_current”
    state_topic: “SunSynk/battery_output_current”
    unit_of_measurement: ‘A’
    device_class: current

  • platform: mqtt
    name: “ss_battery_charge_day”
    state_topic: “SunSynk/battery_charge_day”
    unit_of_measurement: ‘kWh’
    device_class: energy

  • platform: mqtt
    name: “ss_battery_discharge_day”
    state_topic: “SunSynk/battery_discharge_day”
    unit_of_measurement: ‘kWh’
    device_class: energy

    Temperature Sensors

    AC Radiator Temperature

  • platform: mqtt
    name: “ss_AC_Radiator_Temp”
    state_topic: “SunSynk/ac_radiator_temp”
    unit_of_measurement: ‘°C’
    device_class: temperature

    IGBT Temperature

  • platform: mqtt
    name: “ss_IGBT_Temp”
    state_topic: “SunSynk/igbt_temp”
    unit_of_measurement: ‘°C’
    device_class: temperature

IGBT Temperature

  • platform: mqtt
    name: “ss_Battery_Temp”
    state_topic: “SunSynk/battery_temp”
    unit_of_measurement: ‘°C’
    device_class: temperature

Settings

Time Of Use

  • platform: mqtt
    name: “ss_Time_Of_Use”
    state_topic: “SunSynk/time_of_use”
    unit_of_measurement: ‘’

device_class: none

That’s it. You should be able to then add the entities into home assistant.

okay. So its not possible to attach a word document or the node red flows.

Maybe drop me PM with your mobile number and will see how i can assist. I’m just starting off with NodeRed / HA so don’t expect super support. I can just share what i have done thus far.

So there is a sunsynk modbus spec that has all the registers on the inverter (well, not all… most )

Your Nodered basically polls the various registers at different time intervals and the inverter responds with the data in the register. The node red flows that i have basicaly do all of that for you and sends it out on mqqt. HA then reads these topics and that’s about it.

image
You need to use this diagram for the wiring .

The table in the manual is not correct. So pin 2 and 7 connects to A on the HAT and 1 and 8 connects to B on the HAT. I don’t use the ground.

@Vassen Cool, thanks - this is a lot of info. I’ll try give it a bash today and see if this works.

Below is the flow that you can import into the node red.

[{“id”:“384889e.31c6d76”,“type”:“tab”,“label”:“Inverter Monitoring”,“disabled”:false,“info”:""},{“id”:“5307b848.bbd128”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV_Day”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 108, \n ‘quantity’: 1 }; \nmsg.topic = “Solar_PV_Day”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1060,“y”:1060,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“3ccfdd24.a8d272”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV1_Power”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 186, \n ‘quantity’: 1 }; \nmsg.topic = “Solar_PV1_Power”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1070,“y”:200,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“4cc43446.cc094c”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Solar_PV_Day”,“topic”:“SunSynk/Solar_PV_Day”,“qos”:"",“retain”:“true”,“broker”:“f35ad748.1790a8”,“x”:2080,“y”:180,“wires”:[]},{“id”:“1e3efcdd.4c1c53”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV_Day”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 10;\n}\nif (msg.topic === “Solar_PV_Day”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1840,“y”:180,“wires”:[[“4cc43446.cc094c”]]},{“id”:“ca124d32.07475”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV1_Power”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 1;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “Solar_PV1_Power”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1850,“y”:220,“wires”:[[“63c9d253.18cfec”,“791e3acf.7a98d4”]]},{“id”:“66e5cbb4.ea8da4”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV1_Voltage”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 109, \n ‘quantity’: 1 }; \nmsg.topic = “Solar_PV1_volts”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1070,“y”:260,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“e1ff25e3.a90ef8”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Solar_PV1_Voltage”,“topic”:“SunSynk/Solar_PV1_Volts”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2090,“y”:260,“wires”:[]},{“id”:“20ed4f50.ced8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV1_Voltage”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 10;\n}\nif (msg.topic === “Solar_PV1_volts”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:1850,“y”:260,“wires”:[[“e1ff25e3.a90ef8”]]},{“id”:“55f48d2a.771974”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Import_day”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 76, \n ‘quantity’: 1 }; \nmsg.topic = “grid_gridbuy_day”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:1070,“y”:1120,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“f8e3b31b.fbb41”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Import_day”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 10;\n}\nif (msg.topic === “grid_gridbuy_day”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:1850,“y”:300,“wires”:[[“59b433e9.ed029c”]]},{“id”:“59b433e9.ed029c”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Import_day”,“topic”:“SunSynk/grid_gridbuy_day”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2091,“y”:300,“wires”:[]},{“id”:“1beb1576.5d9f5b”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Export_Day”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 77, \n ‘quantity’: 1 }; \nmsg.topic = “grid_export_day”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:1070,“y”:1180,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“4d31561f.8f71f8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Export_Day”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 10;\n}\nif (msg.topic === “grid_export_day”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1850,“y”:360,“wires”:[[“ce9dd330.c0d87”]]},{“id”:“ce9dd330.c0d87”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Export_Grid”,“topic”:“SunSynk/grid_export_day”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2091,“y”:360,“wires”:[]},{“id”:“e0d3a6c7.1df068”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Inverter_Voltage”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 154, \n ‘quantity’: 1 }; \nmsg.topic = “voltage_inverter”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:1080,“y”:320,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“8c037545.0e2bd8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Inverter_Voltage”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 10;\n}\nif (msg.topic === “voltage_inverter”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1860,“y”:420,“wires”:[[“2e8b4c85.88c744”]]},{“id”:“2e8b4c85.88c744”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Inverter_Voltage”,“topic”:“SunSynk/grid_voltage_inverter”,“qos”:"",“retain”:“true”,“broker”:“f35ad748.1790a8”,“x”:2101,“y”:420,“wires”:[]},{“id”:“aa441c11.eea51”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_Voltage”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 150, \n ‘quantity’: 1 }; \nmsg.topic = “voltage_grid”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:1070,“y”:380,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“c6f63a84.ab5a78”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_Voltage”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 10;\n}\nif (msg.topic === “voltage_grid”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:1850,“y”:480,“wires”:[[“7080f438.f5488c”]]},{“id”:“7080f438.f5488c”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_Voltage”,“topic”:“SunSynk/grid_voltage_grid”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2090,“y”:480,“wires”:[]},{“id”:“1b5ce15b.398c9f”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Inverter_Load”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 178, \n ‘quantity’: 1 }; \nmsg.topic = “load_inverter”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1070,“y”:440,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“67c04e18.d11cd”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Inverter_Load”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 1;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “load_inverter”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1850,“y”:540,“wires”:[[“a65bfd70.ad2f5”,“cdfc3331.80599”]]},{“id”:“807db0c6.dd139”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_Load”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 167, \n ‘quantity’: 1 }; \nmsg.topic = “load_grid”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1060,“y”:500,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“bd704573.7fefd8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_Load”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 1;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “load_grid”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1840,“y”:660,“wires”:[[“659bf297.4627fc”]]},{“id”:“270b1c34.e6e334”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_Load”,“topic”:“SunSynk/grid_grid_load”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2240,“y”:660,“wires”:[]},{“id”:“92e6ec11.a909d”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_CT”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 172, \n ‘quantity’: 1 }; \nmsg.topic = “grid_ct”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1060,“y”:560,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“414b05ea.0c132c”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_CT”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 1;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “grid_ct”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1840,“y”:720,“wires”:[[“f0ef7846.950178”,“659bf297.4627fc”]]},{“id”:“f0ef7846.950178”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Grid_CT”,“topic”:“SunSynk/grid_grid_ct”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2240,“y”:720,“wires”:[]},{“id”:“1a3d8d58.191293”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Volts”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 183, \n ‘quantity’: 1 }; \nmsg.topic = “battery_volt”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:1050,“y”:660,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“f8fb7e24.5b013”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Volts”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 100;\n} else {\n msg.payload = (a) / 100;\n}\nif (msg.topic === “battery_volt”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1830,“y”:900,“wires”:[[“f21cf021.c2c72”]]},{“id”:“f21cf021.c2c72”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_Volts”,“topic”:“SunSynk/battery_volts”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2070,“y”:900,“wires”:[]},{“id”:“d3decbb2.9ea328”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_SoC”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 184, \n ‘quantity’: 1 }; \nmsg.topic = “battery_soc”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:1050,“y”:720,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“86c7d14e.852c4”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_SoC”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 1;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “battery_soc”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:1830,“y”:940,“wires”:[[“3b38a4dd.07f06c”]]},{“id”:“3b38a4dd.07f06c”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_SoC”,“topic”:“SunSynk/battery_soc”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2070,“y”:940,“wires”:[]},{“id”:“614409ba.1501a8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Output_Power”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 190, \n ‘quantity’: 1 }; \nmsg.topic = “battery_output_power”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1080,“y”:780,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“af4b67ea.c083e8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Output_Power”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (0 - a + 65535) / 1;\n} else {\n msg.payload = (0 - a) / 1;\n}\nif (msg.topic === “battery_output_power”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1860,“y”:982,“wires”:[[“5f64ff23.7887b”]]},{“id”:“5f64ff23.7887b”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_Output_Power”,“topic”:“SunSynk/battery_output_power”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2100,“y”:982,“wires”:[]},{“id”:“8e0cdcfc.b86b8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Output_Current”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 191, \n ‘quantity’: 1 }; \nmsg.topic = “battery_output_current”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“x”:1090,“y”:840,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“a870c8f2.8896a8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Output_Current”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (0 - a + 65535) / 100;\n} else {\n msg.payload = (0 - a) / 100;\n}\nif (msg.topic === “battery_output_current”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1870,“y”:1042,“wires”:[[“ae9be712.212428”]]},{“id”:“ae9be712.212428”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_Output_Current”,“topic”:“SunSynk/battery_output_current”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2110,“y”:1042,“wires”:[]},{“id”:“488c5c9d.8653e4”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Overall_State”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 59, \n ‘quantity’: 1 }; \nmsg.topic = “overall_state”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1060,“y”:1240,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“e824761c.7f5898”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Overall_State”,“func”:“if (msg.topic === “overall_state”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:1840,“y”:1180,“wires”:[[“314ec124.9c28ce”]]},{“id”:“314ec124.9c28ce”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Overall_State”,“topic”:“SunSynk/overall_runstate”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2080,“y”:1180,“wires”:[]},{“id”:“786be742.8a0d98”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Charge_Day”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 70, \n ‘quantity’: 1 }; \nmsg.topic = “overall_battery_charge_day”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1080,“y”:1300,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“65dc025a.8c255c”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Charge_Day”,“func”:“var a\na = (msg.payload.data / 10)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “overall_battery_charge_day”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1860,“y”:1240,“wires”:[[“c2db61bf.16396”]]},{“id”:“c2db61bf.16396”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_Charge_Day”,“topic”:“SunSynk/battery_charge_day”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2100,“y”:1240,“wires”:[]},{“id”:“854eeda8.6c5c9”,“type”:“inject”,“z”:“384889e.31c6d76”,“name”:“timestamp”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“0.5”,“crontab”:"",“once”:true,“onceDelay”:“1”,“topic”:"",“payload”:"",“payloadType”:“date”,“x”:370,“y”:520,“wires”:[[“e6f6c699.828598”]]},{“id”:“705e1875.51b678”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Discharge_Day”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 71, \n ‘quantity’: 1 }; \nmsg.topic = “overall_battery_discharge_day”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1090,“y”:1360,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“f9d20219.8b48b”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Discharge_Day”,“func”:“var a\na = (msg.payload.data / 10)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “overall_battery_discharge_day”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1870,“y”:1300,“wires”:[[“c93ffc81.9e042”]]},{“id”:“c93ffc81.9e042”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_Discharge_Day”,“topic”:“SunSynk/battery_discharge_day”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2110,“y”:1300,“wires”:[]},{“id”:“659bf297.4627fc”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Load_Calc”,“func”:“var v1value = flow.get(“v1value”);\nvar v2value = flow.get(“v2value”);\nvar total;\n\nif (msg.topic == “grid_ct”) {\n v1value = msg.payload;\n flow.set(“v1value”,msg.payload);\n}else if (msg.topic == “load_grid”){\n v2value = msg.payload;\n flow.set(“v2value”,msg.payload);\n}\nif (v1value !== undefined && v2value !== undefined) {\n total = v1value - v2value;\n msg.payload = total;\n msg.topic = ‘Grid_Load_Calc’;\n return msg;\n}”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:2040,“y”:660,“wires”:[[“270b1c34.e6e334”,“a65bfd70.ad2f5”]]},{“id”:“6b6e908.d22da7”,“type”:“inject”,“z”:“384889e.31c6d76”,“name”:“timestamp”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“30”,“crontab”:"",“once”:true,“onceDelay”:“1”,“topic”:"",“payload”:"",“payloadType”:“date”,“x”:390,“y”:1060,“wires”:[[“25013476.5bc3ec”]]},{“id”:“a65bfd70.ad2f5”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Grid_Total_Load_Calc”,“func”:“var v3value = flow.get(“v3value”);\nvar v4value = flow.get(“v4value”);\nvar total;\nvar v1value;\nvar v2value;\n\nif (msg.topic == “Grid_Load_Calc”) {\n v1value = msg.payload;\n flow.set(“v3value”,msg.payload);\n}else if (msg.topic == “load_inverter”){\n v2value = msg.payload;\n flow.set(“v4value”,msg.payload);\n}\nif (v1value !== undefined && v2value !== undefined) {\n total = v3value + v4value;\n msg.payload = total;\n msg.topic = ‘Total_Load_Calc’;\n return msg;\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:2310,“y”:600,“wires”:[[“91b77bab.7295e8”]]},{“id”:“91b77bab.7295e8”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Total_Load”,“topic”:“SunSynk/grid_total_load”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2540,“y”:600,“wires”:[]},{“id”:“5fed0396.69f04c”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Charge_Volts”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 312, \n ‘quantity’: 1 }; \nmsg.topic = “battery_charge_volts”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1080,“y”:900,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“aa864331.30eb5”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Charge_Volts”,“func”:“var a\na = (msg.payload.data / -1)\nif (a > 32767) {\n msg.payload = (0 - a + 65535) / 10;\n} else {\n msg.payload = (0 - a) / 10;\n}\nif (msg.topic === “battery_charge_volts”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1860,“y”:1100,“wires”:[[“7116d62.8f28728”]]},{“id”:“7116d62.8f28728”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_Charge_Volts”,“topic”:“SunSynk/battery_charge_volts”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2100,“y”:1100,“wires”:[]},{“id”:“95c375ea.b1aa48”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV2_Power”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 187, \n ‘quantity’: 1 }; \nmsg.topic = “Solar_PV2_Power”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1070,“y”:80,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“5bf690ae.5764a”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV2_Voltage”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 111, \n ‘quantity’: 1 }; \nmsg.topic = “Solar_PV2_volts”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1070,“y”:140,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“d1dd24e7.c2ba38”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV2_Power”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 1;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “Solar_PV2_Power”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1850,“y”:100,“wires”:[[“23907ec2.eb4502”,“791e3acf.7a98d4”]]},{“id”:“2538570a.06ac18”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Solar_PV2_Voltage”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 10;\n} else {\n msg.payload = (a) / 10;\n}\nif (msg.topic === “Solar_PV2_volts”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1850,“y”:140,“wires”:[[“b3614a95.af2a68”]]},{“id”:“23907ec2.eb4502”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Solar_PV2_Power”,“topic”:“SunSynk/Solar_PV2_Power”,“qos”:"",“retain”:“true”,“broker”:“f35ad748.1790a8”,“x”:2090,“y”:100,“wires”:[]},{“id”:“b3614a95.af2a68”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Solar_PV2_Voltage”,“topic”:“SunSynk/Solar_PV2_Volts”,“qos”:"",“retain”:“true”,“broker”:“f35ad748.1790a8”,“x”:2090,“y”:140,“wires”:[]},{“id”:“71592e32.0aad9”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Micro_Inv_Power”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 166, \n ‘quantity’: 1 }; \nmsg.topic = “Micro_Inv_Power”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1070,“y”:40,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“603e901b.32f9c”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Micro_Inv_Power”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = (a - 65535) / 1;\n} else {\n msg.payload = (a) / 1;\n}\nif (msg.topic === “Micro_Inv_Power”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1850,“y”:60,“wires”:[[“9db8715e.e1d11”,“791e3acf.7a98d4”]]},{“id”:“9db8715e.e1d11”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Micro_Inv_Power”,“topic”:“SunSynk/Micro_Inv_Power”,“qos”:"",“retain”:“true”,“broker”:“f35ad748.1790a8”,“x”:2090,“y”:60,“wires”:[]},{“id”:“64b4cf07.d16c2”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“IGBT_Temp”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 91, \n ‘quantity’: 1 }; \nmsg.topic = “igbt_temp”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1050,“y”:980,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“3c2ea7c.b482758”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“AC_Radiator_Temp”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 90, \n ‘quantity’: 1 }; \nmsg.topic = “ac_radiator_temp”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1070,“y”:940,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“d25a8f6e.f40d9”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“AC_Radiator_Temp”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = ((a - 65535)-1000) / 10;\n} else {\n msg.payload = (a-1000) / 10;\n}\nif (msg.topic === “ac_radiator_temp”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1850,“y”:760,“wires”:[[“cc9e9e9a.1f66c”]]},{“id”:“ec110708.4eb238”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“IGBT_Temp”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = ((a - 65535)-1000) / 10;\n} else {\n msg.payload = (a-1000) / 10;\n}\nif (msg.topic === “igbt_temp”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1830,“y”:800,“wires”:[[“ea26afa.0e2315”]]},{“id”:“cc9e9e9a.1f66c”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“AC_Radiator_Temp”,“topic”:“SunSynk/ac_radiator_temp”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2050,“y”:760,“wires”:[]},{“id”:“ea26afa.0e2315”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“IGBT_Temp”,“topic”:“SunSynk/igbt_temp”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2030,“y”:800,“wires”:[]},{“id”:“1e7552c5.8df12d”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Temp”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 182, \n ‘quantity’: 1 }; \nmsg.topic = “battery_temp”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1060,“y”:1020,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“bb6206fb.6cbcc8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Battery_Temp”,“func”:“var a\na = (msg.payload.data / 1)\nif (a > 32767) {\n msg.payload = ((a - 65535)-1000) / 10;\n} else {\n msg.payload = (a-1000) / 10;\n}\nif (msg.topic === “battery_temp”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1840,“y”:840,“wires”:[[“fe914af8.aa7618”]]},{“id”:“fe914af8.aa7618”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Battery_Temp”,“topic”:“SunSynk/battery_temp”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2040,“y”:840,“wires”:[]},{“id”:“860ef458.5f81e8”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Time_of_Use”,“func”:“msg.payload = { \n ‘fc’: 3, \n ‘unitid’: 1, \n ‘address’: 248, \n ‘quantity’: 1 }; \nmsg.topic = “time_of_use”\nreturn msg;\n”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1050,“y”:1420,“wires”:[[“75eebf1a.6b04a”]]},{“id”:“77a48712.a0c688”,“type”:“function”,“z”:“384889e.31c6d76”,“name”:“Time_Of_Use”,“func”:“var a\na = (msg.payload.data / 1)\nif (a == 255) {\n msg.payload = “ON”;\n} else {\n msg.payload = “Off”;\n}\nif (msg.topic === “time_of_use”) {\n return [ msg, null ];\n} else {\n return [ null, msg ];\n}\nreturn msg;”,“outputs”:1,“noerr”:0,“initialize”:"",“finalize”:"",“x”:1840,“y”:1360,“wires”:[[“319ff621.8db54a”]]},{“id”:“319ff621.8db54a”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Time_Of_Use”,“topic”:“SunSynk/time_of_use”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2060,“y”:1360,“wires”:[]},{“id”:“75eebf1a.6b04a”,“type”:“modbus-flex-getter”,“z”:“384889e.31c6d76”,“name”:“Inverter”,“showStatusActivities”:true,“showErrors”:true,“logIOActivities”:false,“server”:“e58adf35.07bda”,“useIOFile”:false,“ioFile”:"",“useIOForPayload”:false,“emptyMsgOnFail”:true,“keepMsgProperties”:true,“x”:1520,“y”:380,“wires”:[[],[“77a48712.a0c688”,“f9d20219.8b48b”,“65dc025a.8c255c”,“e824761c.7f5898”,“aa864331.30eb5”,“a870c8f2.8896a8”,“af4b67ea.c083e8”,“86c7d14e.852c4”,“f8fb7e24.5b013”,“bb6206fb.6cbcc8”,“ec110708.4eb238”,“d25a8f6e.f40d9”,“414b05ea.0c132c”,“bd704573.7fefd8”,“67c04e18.d11cd”,“c6f63a84.ab5a78”,“8c037545.0e2bd8”,“4d31561f.8f71f8”,“f8e3b31b.fbb41”,“20ed4f50.ced8”,“ca124d32.07475”,“1e3efcdd.4c1c53”,“2538570a.06ac18”,“d1dd24e7.c2ba38”,“603e901b.32f9c”]]},{“id”:“e6f6c699.828598”,“type”:“gate”,“z”:“384889e.31c6d76”,“name”:“Monitor_Gate”,“controlTopic”:“monitor_gate”,“defaultState”:“open”,“openCmd”:“open”,“closeCmd”:“close”,“toggleCmd”:“toggle”,“defaultCmd”:“default”,“statusCmd”:“status”,“persist”:false,“x”:660,“y”:520,“wires”:[[“71592e32.0aad9”,“95c375ea.b1aa48”,“5bf690ae.5764a”,“3ccfdd24.a8d272”,“66e5cbb4.ea8da4”,“e0d3a6c7.1df068”,“aa441c11.eea51”,“1b5ce15b.398c9f”,“807db0c6.dd139”,“92e6ec11.a909d”,“1a3d8d58.191293”,“d3decbb2.9ea328”,“614409ba.1501a8”,“8e0cdcfc.b86b8”,“5fed0396.69f04c”,“3c2ea7c.b482758”,“64b4cf07.d16c2”,“1e7552c5.8df12d”]]},{“id”:“25013476.5bc3ec”,“type”:“gate”,“z”:“384889e.31c6d76”,“name”:“Monitor_Gate”,“controlTopic”:“monitor_gate”,“defaultState”:“open”,“openCmd”:“open”,“closeCmd”:“close”,“toggleCmd”:“toggle”,“defaultCmd”:“default”,“statusCmd”:“status”,“persist”:false,“x”:700,“y”:1060,“wires”:[[“5307b848.bbd128”,“55f48d2a.771974”,“1beb1576.5d9f5b”,“488c5c9d.8653e4”,“786be742.8a0d98”,“705e1875.51b678”,“860ef458.5f81e8”]]},{“id”:“cdfc3331.80599”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Grid_Inverter_Load”,“topic”:“SunSynk/grid_inverter_load”,“qos”:"",“retain”:“false”,“broker”:“f35ad748.1790a8”,“x”:2270,“y”:540,“wires”:[]},{“id”:“63c9d253.18cfec”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Solar_PV1_Power”,“topic”:“SunSynk/Solar_PV1_Power”,“qos”:"",“retain”:“true”,“broker”:“f35ad748.1790a8”,“x”:2090,“y”:220,“wires”:[]},{“id”:“722fe285.1f072c”,“type”:“mqtt out”,“z”:“384889e.31c6d76”,“name”:“Total_PV_Power”,“topic”:“SunSynk/Total_PV_Power”,“qos”:"",“retain”:“true”,“broker”:“f35ad748.1790a8”,“x”:2570,“y”:100,“wires”:[]},{“id”:“791e3acf.7a98d4”,“type”:“sum”,“z”:“384889e.31c6d76”,“name”:“Total_PV_Power”,“topic”:“Total_PV_Power”,“x”:2400,“y”:180,“wires”:[[“722fe285.1f072c”]]},{“id”:“f35ad748.1790a8”,“type”:“mqtt-broker”,“name”:“SunSynk”,“broker”:“192.168.0.21”,“port”:“1883”,“clientid”:"",“usetls”:false,“compatmode”:false,“keepalive”:“15”,“cleansession”:true,“birthTopic”:"",“birthQos”:“0”,“birthRetain”:“true”,“birthPayload”:"",“closeTopic”:"Micro_Inv_Power ",“closeQos”:“0”,“closeRetain”:“true”,“closePayload”:“number”,“willTopic”:“Micro_Inv_Power “,“willQos”:“0”,“willRetain”:“true”,“willPayload”:“number”},{“id”:“e58adf35.07bda”,“type”:“modbus-client”,“name”:“Inverter”,“clienttype”:“simpleser”,“bufferCommands”:true,“stateLogEnabled”:false,“queueLogEnabled”:false,“tcpHost”:“192.168.1.111”,“tcpPort”:“8899”,“tcpType”:“DEFAULT”,“serialPort”:”/dev/ttyS0”,“serialType”:“RTU-BUFFERD”,“serialBaudrate”:“9600”,“serialDatabits”:“8”,“serialStopbits”:“1”,“serialParity”:“none”,“serialConnectionDelay”:“100”,“unit_id”:1,“commandDelay”:20,“clientTimeout”:2000,“reconnectOnTimeout”:true,“reconnectTimeout”:1000,“parallelUnitIdsAllowed”:false}]

You can also check this guys github for a newer version.

Good luck

Sigh…
No progress. So it seems like its some kind of hardware / communications issue.

After getting all of this stuff up and running, I’m still not able to see any data, and node red is showing on the ModBus Read flow, there is a setting “inverter” in the middle.
This just keeps flipping between "active’ “initialise” “init” and “reconnecting”
Also, if I check the MQTT topic, I can see no data being generated.
So, something like this:

mosquitto_sub -d -u "mosquitto" -P "mosquitto" -t SunSynk/#  --insecure -h 10.0.0.200

Just returns:
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending SUBSCRIBE (Mid: 1, Topic: SunSynk/#, QoS: 0, Options: 0x00)
Client (null) received SUBACK

Nothing more.
I’ve tried this by changing the settings in NodeRed to both direct ttyUSB0 serial 9600 as well as compiling the and running mbusd which then attaches to localhost port 502 and changing node red to use TCP


(See attached images)

So, anyone got any ideas how I can perhaps diagnose this?
I’ll try and use another usb-rs485 adapter and see if I can run a modbus server.

Again it seems like there is a hardware / comms issue here, nothing more.

In the ‘good old days’ RS232 and RS485 had quite high signal levels (>10V)
I see the specs of these USB converters are working at USB voltage (5V)
The technician in me says this could be an issue…
Is there a way to check the signal by a simple command to the slave device that then responds with a known response??
In my day with RS422/232 one could do this hardware test by running Hyperterminal and connecting the Rx and Tx lines so one could then see the keyboard characters being returned on the Rx input.

Yeah, I’m going to have to try various things now and figure out where the problem is.
I suspect its something on the inverter, either a setting I’m not aware of that needs to be enabled / set / changed or its an issue with the connection on the inverter.
I’ll do some experimenting this week.

Even back in the day, the interface chips ran from 5V and they had charge pumps in them to get to the 10V. Just check the spec sheet for a MAX232 :slight_smile:

I don’t think it’s anything on the inverter.

As mentioned, I got it working on the first inverter, then when I added my second inverter, I just added a usb-485 adapter, duplicated the flow to talk to the second inverter and that was it. Didn’t have to set anything on the inverter.

Did you try using my flow I attached above. Manually trigger it and use the debug to check what’s returned from the inverter.

Remember, you need to poll the different registers of the inverter and the inverter just responds with whatever is in that register.

Drop me a message with your email address and I will send you the flow and we can work from there.

The 485 adapter that you have should work for a single register call but doesn’t handle continuous polling at high frequency very well.

Here is a python script (needs pymodbus to be installed) that I use to query registers (on a different kind of hardware, but that should not matter). The slave address is hardcoded to 1 and the baud rate to 9600, so you may want to mess with that, but otherwise it’s a fairly good tool to read and write registers, eg:

python3 modbusrtu.py /dev/ttyUSB0 read 0x01 1

It even has some smarts to convert hex arguments for you, just to make life easier.

The “write” part I sometimes use on Carlo Gavazzi meters to write the reset registers (that resets the energy counters to zero).

import sys
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
from pymodbus.pdu import ExceptionResponse

def main():
    if len(sys.argv) < 5:
        print ("Usage: {} port read|write register count")
        return

    modbus = ModbusClient(method='rtu', port=sys.argv[1], baudrate=9600, timeout=1)

    if not modbus.connect():
        logger.error("Cannot connect to modbus")
        return

    action = sys.argv[2]
    if action not in ("read", "write"):
        print ("Read or Write?")
        return
    register = sys.argv[3]
    if register.startswith('0x'):
        register = int(register, 16)
    else:
        register = int(register)

    count = int(sys.argv[4])
    if action == "read":
        r = modbus.read_holding_registers(register, count, unit=1)
        if isinstance(r, ExceptionResponse):
            print (r)
        else:
            print (r.registers)
            total = 0
            for _ in reversed(r.registers):
                total <<= 16
                total |= _
            print ("{} (0x{:X})".format(total, total))
    elif action == "write":
        v = int(sys.argv[5])
        payload = []
        while v > 0:
             payload.append(v & 0xFFFF)
             v >>=16
        while len(payload) < count:
            payload.append(0)
        print ("Writing {} to register {:X}".format(payload, register))
        if len(payload) > 1:
            r = modbus.write_registers(register, payload, unit=1)
        else:
            r = modbus.write_register(register, payload[0], unit=1)
        print (r)

main()
1 Like

Hmm… Must be missing a library or something ? I’ve installed pymodbus.
If I just get it to print(r)
Then :
Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received)

Traceback (most recent call last):
File “./script.py”, line 54, in
main()
File “./script.py”, line 33, in main
print (r.registers)
AttributeError: ‘ModbusIOException’ object has no attribute ‘registers’

Well, there’s the answer. It’s not receiving an answer. Possible issues could be wrong baud rate or wrong slave id. Or whatever is on the other end is just not talking back.

I’m assuming you have at least some programming background and the required information to fill the gaps. I don’t know the sunsynk and have no intention of getting to know it… that’s just my generic script for poking registers, and it’s helped me a lot. I have a few others for poking the registers of sunspec PV-inverters too :slight_smile:

Yup - exactly what I’ve been saying for a while now, there is a comms / hardware issue here.
I’ll try and do some experimenting today (if I get a chance)