-
-
Notifications
You must be signed in to change notification settings - Fork 91
Connecting to the inverter
This integration supports two connection modes to SUN2000 inverters:
- direct serial connection to the RS485A1 and RS485B1 pins of the COM port
- network connection
⚠Warnings for installations with SDongleA⚠:
- If your installation contains multiple inverters and a battery, the SDongle seems to regulate a part of how the inverters and battery interact. Removing the SDongle will degrade your installations performance.
- The SDongleA-05 and SDongleA-FE dongles interfere with devices connected to the RS485A1 and RS485B1 pins on the inverter.
If your inverter has such a dongle installed you cannot use a serial connection option. We recommend connecting to the Modbus-TCP port exposed by that dongle instead.
To use the direct serial connection, you need an "USB to RS485 converter". These can be obtained relatively inexpensively, for example on AliExpress or Amazon.de.
Connect the RS485A1 and RS485B1 pins from the COM-port of your inverter via a twisted pair cable to the two screw terminals of the USB-adapter. A possible cable is a CAT5e cable where you use a pair of wires that is twisted together (for example blue and blue/white).
In the case of SUN2000L-(2KTL-6KTL)-L1 inverters, these are pins 1 and 2 of the COM-port:
Consult the manual of your inverter to verify where these pins are located.
Your Power meter and battery - if present - are normally connected to the RS485A2 and RS485B2 pins of the COM-port:
In the case of SUN2000L-(3KTL-10KTL)-M1 inverters, these are pins 2 and 4 of the COM-port:
As per the following table:
- pins 1 & 3 are used to connect to 'downstream' devices in the chain, such as other inverters, whilst;
- pins 2 & 4 are used to connect to an 'upstream' device in the RS485 chain, such as a Huawei SmartLogger or Elfin EW/EE-11.
This is illustrated in the following Huawei Smart Dongle wiring diagram, if an Elfin EW-11 type device was to be used instead of the USB Dongle, this would be connected to pins 2 & 4 of the 'Master Inverter' in the diagram.
Use the 'Device Commissioning' function of the FusionSolar app to login on your inverter (default password for the installer
account is either 00000a
or 000000a
). Go to Settings → Communication configuration → RS485_1 and make sure that the parameters are set as follows:
- Baud rate:
9600
- Protocol type:
MODBUS
- Com address:
1
- RS485 Bus Frame capture:
1
If you are experiencing trouble with setting up the integration, you can test your serial connection by plugging the USB adapter in your laptop and using some software like QModbus to verify that you can read some registers.
Some combinations to try:
- register 30000, length 15
- register 40000, length 2
- register 43006, length 1
If your inverter is too far away from your Home Assistant server, you can opt for a Modbus RTU-to-TCP bridge to convert the Modbus RTU signal on the RS485A1 and RS485B1 pins of your inverter to a Modbus TCP signal which can be sent over your home network. Some options:
- Via WiFi: the Elfin-EW11 (available via AliExpress and Amazon.de)
- Via Ethernet: the Elfin-EE11 (available via AliExpress and Amazon.de)
- Via Ethernet on DIN-rail: the Protoss-PE11 (available via AliExpress and Amazon.de)
- Via 2.4Ghz WiFi on DIN-rail: the Protoss-PW11 (available via AliExpress and Amazon.de)
- Via 2.4Ghz and 5Ghz WiFi on DIN-rail: the Protos-PW31B (available via AliExpress)
The instructions in these section are specific for the Elfin EW11 and the PIN 1 & 2 refer to those on the SUN2000L-(2KTL-6KTL)-L1 inverters, PIN 2 & 4 should be used for SUN2000L-(3KTL-10KTL)-M1 inverters. Refer to the manual of the Protoss devices for analog instructions.
The EW11 green connector has four screw terminals:
- A/B for RS485 communication (the two side inputs of the connector)
- +/- for power input (DC, the two central inputs of the connector)
Wire the A
/B
screw terminals to the RS485A1/RS485B1 terminals of your inverter.
For the power, you can leverage the USB-port on the inverter which is normally reserved for the optional SDongle. Take a spare USB-cable that you have lying around and cut it. Remove the shield protection (aluminium foil + braided copper wires + plastic film) over a length of 2-3 cm to reveal 4 wires: red, black, green and white. The black wire is the ground, the red wire is the +5V. Connect these to respectively the -
(minus) and +
(plus) screw terminals of the EW11. The green and white are for USB communication, which you do not need: you can cut these away, but make sure that no stray ends can contact each other (for example by not cutting them at the same position, but a few millimeters apart). To improve reliability and stability, it is advised to use solder/crimped terminal/thermoretractable protection on the cable ends that you feed into the screw terminals.
Unscrew the dongle protection on the inverter, plug the USB A and this is it for the “wiring” side. The EW11A should boot (takes a few seconds) and advert an “EW11-xxxx” hotspot.
Affix the EW11 dongle somewhere to create a nice end result:
For WiFi devices: Connect to the hotspot with the device of your choice and go to http://10.10.100.254 on a web browser. For Ethernet devices: retrieve the IP address assigned to your device from your router.
Login and password are both admin
.
Go to the Serial port settings and change the baud rate to 9600† (leave the rest unchanged: 8 bits, 1 stop bit, no parity). Change the protocol to Modbus
. Press Submit.
Go to the Communication settings and check that you are using a Tcp server
Protocol with a Uart
Route (at the bottom). Submit.
Go to the System settings, change the password to a password of your choice. On the same page, for WiFi-devices: change the WiFi mode to STA, type the SSID of your WiFi router in STA SSID and the WiFi password as the STA KEY. For Ehternet-devices: set a fixed IP for your device in the WAN settings. Under Network Information you can switch of the DHCP to set a fixed IP-address to the device. Optionally change the WAN DNS to 1.1.1.1 to stop the device from using it's Chinese default DNS server (1.1.1.1 is CloudFlare DNS, 8.8.8.8 if you prefer Google). Press Submit.
Go to Others to reboot (reset) the device, so that it connects to your home WiFi. If you didn't set the IP-address to something static, you'll need to retrieve the IP-address assigned to the device from your network router. The device announces itself very clearly as “EW11” from “Shanghai High-Flying Electronics Technology Ltd”.
When installing the integration:
- Select Network
- Give the IP address you set (or found) above. The default port for the device is 8899, use 1 for the Slave ID (note: this is only true if one inverter is present and the ID hasn't been changed. For me I had to use 6,2,3 as that is my IDs -- see the "connecting to daisy chained" document in the wiki for details).
This method allows you to use "Elevated Permissions" without needing to login.
Depending on your inverter model, the presence of a dongle and the firmware version, there are one or more possible ways on which the Modbus-TCP port can be exposed by your inverter.
With firmware versions released in Q4 of 2022 for the SUN2000L it is once again possible to connect to the inverter on the IP with which your inverter is connected to your home network. This feature is seemingly not available for the SUN2000MA.
You need to enable "Local O&M" in "Settings" -> "Router connection settings" in the "Device Commissioning" part of the FusionSolar App. This needs to be done using an Installer account. (Note that this toggle is somewhat buggy, and possibly needs multiple tries to effectively enable it. Make sure to use the latest version of the app). This will open port 6607 (for firmware versions starting from December 2021) or port 502 (for older firmware versions). Detailed 'Modbus TCP Guide'
Please make sure to assign your inverter a static IP in your router, as changing the IP is not supported in the integration.
Activate Unrestricted Modbus TCP mode in the settings for Dongle communication in the Inverter (cfr. manual for SDongleA-05‡ or SDongle FE
⚠Warning⚠: connections via a Huawei Dongle are noticeably more unreliable than other options. We therefore recommend AGAINST this option if possible.
⚠Note⚠: when the dongle is unable to connect to the Huawei FusionSolar cloud (for example due to a service or network outage), it will periodically restart in an attempt to restore connectivity. This will also interrupt the connection to this integration.
On 192.168.200.1 port 6607 (for firmware versions starting from December 2021) or port 502 (for older firmware versions). This is the way the "Device Commissioning" part of the FusionSolar app connects to the inverter and is the most reliable.
To get connectivity between your Home Assistant server on your home network and the 192.168.200.1
IP exposed via the SUN2000-<serial_no>
wifi you need to setup a wireless network bridge to the inverter AP. This requires sufficient network knowledge with regards to routing, firewalling, etc!
The most straightforward approach is to use an USB WiFi stick, or use the built-in WiFi or your Home Assistant server (for instance: the WiFi functionality of your Raspberry Pi 4). This must be a dedicated WiFi device: it is not possible to connect the same WiFi interface to both your home network and the invertwer WiFi at the same time (*).
You can configure this device in Hass.io via Configuration
-> Add-ons, Backups & Supervisor
-> System
-> Change
(next to IP address) -> WLAN<x>
.
Before you scan for Access Points and establish a connection to your inverter's built-in WiFi, make sure that you enabled DHCP in the IPv4 section or else the inverter cannot assign an IP-address to your HA server.
(*) Some WiFi dongles might support multiple connections by separating it into multiple VLAN's. This is considered an advanced use-case, and is not covered in this README.
This approach is recommended when your Home Assistant server is positioned too far from the inverter to connect to it's WiFi. It requires a good understanding of IP routing and suitable hardware.
Some devices marketed as WLAN Repeaters can also be configured in 'client mode', which creates a bridge between your home netwerk and inverter WiFi.
For example: TP-link TL-WR802N: Configure the Router in Client Mode
After setting up your WLAN device in 'client mode', you need to either add a DNAT firewall rule on the WLAN bridge to direct all incoming traffic on port 6607 to the inverter IP (192.168.200.1) on port 6607, or add a static route on your home network router to 192.168.200.0/24
via that WLAN bridge. Otherwise the devices in your network won't know how to reach the inverter subnet.
Note: Not every home router allows you to add static routes. For example: the router provided by your ISP might not expose this advanced feature. Use the DNAT approach in this case.
Below you can find the relevant parts of some config files that create a bridge between your home network and the inverter AP. The latter is put into a separate sun
firewall zone. We add a DNAT firewall rule that forwards all incoming traffic on the WLAN bridge to the Modbus TCP-port on the inverter.
This config can be achieved through the LUCI Web-GUI, but is spread across multiple pages and tabs.
/etc/config/network
:
config interface 'wlan'
option proto 'dhcp'
option defaultroute '0'
Note that failing to set 'defaultroute' to 0 will result in loss of internet connectivity as the OpenWRT router will try to route all internet traffic over the inverter instead of your ISP!
/etc/config/wireless
:
config wifi-iface 'wifinet0'
option key 'Changeme'
option ssid 'SUN2000-HV0123456789'
option device 'radio0'
option mode 'sta'
option bssid '94:25:33:12:34:56'
option encryption 'psk2'
option network 'wlan'
/etc/config/firewall
:
config zone
option input 'ACCEPT'
option name 'sun'
option output 'ACCEPT'
option forward 'ACCEPT'
option masq '1'
option network 'wlan'
config redirect
option name 'SUN2000'
option target 'DNAT'
option src 'lan'
option src_dport '6607'
option dest 'sun'
option dest_ip '192.168.200.1'
option dest_port '6607'
list proto 'tcp'
The following guide explains how you can setup a network bridge and iptables-rules in DD-WRT: How to connect to SUN2000 from DD-WRT
Before continuing with the setup of the integration, you should test whether you can ping the inverter on 192.168.200.1
. You can use one of the SSH/Terminal add-ons of HA, or use a terminal in the VSCode add-on.
A successful test looks like this:
If you are connecing to the inverter via the Dongle connected to your home network (option B) and have the problem of sporadic but somewhat regular disconnects of about 30 minutes: the solution is to completely restarting the inverter by first turning off DC power and then AC power.
†: It is possible to use a different baud-rate, but this needs to be set both via the FusionSolar Device Commissioning settings and in the Elfin EW11 settings.
‡: When the setting in step 8 is not available, your installer needs to login onto FusionSolar Web and enable this in the settings (screenshot of how to do this)