Skip to main content

Sunways NT4000

The Sunways NT4000 is a solar inverter. It stores data locally, which can be retrieved via eighter a RS485 or a RS232 interface. When using multiple Sunways inverters, you can connect them to each other via the RS485 interface, so that one acts as master and handles the communication. 

RS485 Interface

This serial interface is used for communication with the inverters. With the help of for example the HALJIA USB zu RS485 Konverter you can connect the inverters to your computer or Raspberry Pi. For me I could only communicate via RS485 when the inverters where actually receiving solar power.

USB_to_RS485.png

Settings for the Interface

Baud rate 9600
Data bits 8
Parity

None

Stop bits 1
Handshake none

Software

There are multiple different software solutions to read and write data via software. The software from the manufacturer is called Sunways Monitor 2.0, but it is not available for download anymore. 

FHEM

Another software to communicate with the inverters is the house automation software FHEM. It support many different modules and Prof. Dr. Peter A. Henning created a module for Sunways NT inverters called NT5000 (seems to be moved to 70_SolarView). Targeted actually at the NT5000, the inverters NT1800, NT2600, NT4000 and NT6000 have the same protocol. Further information can be found in the wiki. To use the module you firstly need to get your FHEM installation up and running, for example as docker container. There you need to mount a volume for the configuration to be persistent and also pass the USB device to the container.

docker run -d -p 8083:8083 --device=/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0:/dev/ttyUSB0 -v /home/pi/fhem:/opt/fhem fhem/fhem

After that you need to copy the 70_NT5000.pm (fhem.txt) file from contrib to the FHEM folder so that the module can be loaded. Test if the module can be loaded by running the command reload NT5000 on the FHEM web interface. If it succeeds, you can then create the solar module object by running define solar NT5000 /dev/ttyUSB0. Then you should see the values of the inverter on the website. Sadly I could not find any option to get support for multiple inverters. So the only way to use this software with multiple inverters would be to wire each inverter to the computer on its own. Publishing the received data can be done for example via MQTT.

define mosquitto MQTT <IP>:<PORT>
define mqttGeneric MQTT_GENERIC_BRIDGE
attr mqttGeneric IODev mosquitto
attr mqttGeneric globalPublish *:topic={"<MQTTTOPIC>/$device/$reading"}

Example config: config.txt

SolarView aka SolarMax-Proxy

Another software to read and write the data is SolarView, a data logger for various solar inverters. While it doesn't support Sunways support out of the gate, a community member of this forum created a proxy for the inverters. The software  proxies the Sunways inverter to act like a SolarMax inverter, which the software supports. The solarmax-proxy is available on SourceForge, but no longer maintained by the the original creator. In this thread the evolution and usage of the proxy is discussed and also multiple different binary files where shared. Here are multiple files saved for preservation:

The requirement for smp to work are:

  • RS485 from the inverter connected to a serial to network adapter (or connected to the raspberry pi and forwarded via ser2net software via network)
  • SMP connected to the adapter
  • SolarView configured to use SMP as SolarMax inverter

Example calls:

  • ./smp -c 1 -l 11200 -f /var/log/smp.log
  • ./smp -c 2 -l 11200
  • ./smp -t 5 -c 1 -f smp.log -l 5000
  • ./smp.rpi -h 192.168.178.74 -p 6000 -d 2 -c 3 -f smp.log

As all these step dont seem like a stable solution for me, I did not try this route, but the source code gained from this proxy was more than helpful. 

Python Script

Which leads to the last software, a little python script written by myself. As it still is a work in progress, here is the current version of the software.

test-2.py

Backup: SMP.zip and SUNWAYS.zip

Example output:

stats.png

Working Software

 

File collection backup: Multiusb.zip