Integration Solar inverter huawei 2000L

My two cents.

After upgrading my SUN2000-4KTL-L1 to SPC117, I lost access to inverter via ModBus. Same reply from Huawei support for closing modbus port from wifi (but not from SDongle) alleging security issues.
I’ve checked that internal wifi (SUN2000-XXXXXXXX) has port 6607 opened. So, I’ve created a raspberry pi bridge. Wifi is connected to SUN2000-XXXXX network while cable is connected to my internal network.

A small iptables script did the magic and now I’m able to connect again.

#!/bin/bash
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables --flush
iptables --flush -t nat
iptables --flush -t mangle
iptables -P INPUT DROP
iptables -P FORWARD DROP

iptables -A INPUT -i wlan0 -p tcp -m state --state NEW -j DROP
iptables -A INPUT -i wlan0 -p udp -m state --state NEW -j DROP
iptables -A INPUT -i wlan0 -p tcp -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i wlan0 -p udp -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT

iptables -A FORWARD -i eth0 -p tcp -o wlan0 --dport 502 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -p tcp -o wlan0 --dport 6607 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -p tcp -m state --state ESTABLISHED -j ACCEPT

iptables -A PREROUTING -t nat -p tcp --dport 502 -i eth0 -j DNAT --to 192.168.200.1:502
iptables -A PREROUTING -t nat -p tcp --dport 6607 -i eth0 -j DNAT --to 192.168.200.1:6607


iptables -A POSTROUTING -t nat -o wlan0 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward

Of course, you will have to point huawei_solar integration to Raspberry Pi cable IP address, port 6607. I left 502 also opened.

Thank to those who discovered port 6607 is opened and also to @Emilv2 for his fantastic integration.

2 Likes

Hola íñigo,

Por favor, podrías explicarme como un guíaburros tu solución ??. En comunicaciones estoy muy pez… y no llego a entenderla.

Tengo un 5KTL-L1 con el firmware SpC117 conectado a mi Red vía WiFi ( el router oe ha asignado una IP, que ra la que usaba como Host en la integracion de Ha )y la Raspberri la tengo por cable al router principal.

Muchas Gracias !!.

Hi Thijs,
I actually tried the integration that showed up as a new integration in HACS. But good to know that this isn’t the one yet that will incorporate the ability to read from multiple inverters. Just let me know when I should test a newer version. I’m really happy to help here!

hello, same problem … can you provide some dummy instructions :frowning:

1- Get a Raspberry Pi.
2- Install RaspBian (Linux for RaspBerry Pi). There are plenty tutorials and tools in internet. Very easy. For noobs, use Raspberry Pi Imager.
3- Configure your wifi network in RaspBerry Pi for using SUN20000-XXXXXX wifi (it’s printed at your inverter side). There is also a Huawei tutorial for it at Huawei Support Site but trust me, it’s pretty simple: Wifi name and wifi password. It can be done from Raspberri Pi Imager.
4- Configure your ethernet network in Raspberry Pi. By default, it’s DHCP assigned so just plug into your ethernet connection.
5- Power on your Raspberry Pi, login into console (or XWindows), open and editor (vim, or any graphical text editor) and create a new script, lets say, firewall.sh. Inside this, just paste my script and save.
6- From a terminal (command prompt), just execute my script “sudo sh firewall.sh”.
7- Reconfigure your home assistant huawei_solar integration to point your DHCP address at Raspberry Pi (many ways to get this IP… looking at your router DHCP table, executing “ifconfig” at Terminal Command prompt, etc… it’s linux!). Port must be 6607 (this is a must).
8- Restart Home Assistant.

And that’s all.

All of this tasks are basic for any Linux user. Since you have installed Home Assistant, I assume you have basic Linux knowledge.

2 Likes

Just look at my previous post.
Mira mi post anterior.

In your case, easy way should be enable Raspi wifi interface (available in Raspi3 or Raspi4) by using command “raspi-config” and link it to inverter wifi. Reconfigure Home Assistant to point inverter IP (192.168.200.1, port 6607). No need to use any script in this case.

En tu caso, Manuel, tal vez lo más sencillo sea activar la wifi de la RaspBerry y enlazarla a la red del inversor. De esta forma tendrás dos interfaces, una con la IP de tu red local y otra con la IP de la red de tu inverstor. Tienes que tener una Raspberry Pi 3 o 4 y activar la wifi con el comando “raspi-config” ejecutado como root (sudo raspi-config). Luego reconfigura tu Home Asssistant para que apunte a la IP y puerto del inversor (192.168.200.1, puerto 6607). No hace falta script en ese caso. :wink:

1 Like

Thank you and I do have a raspebeey pi 4 with home assistant. The wifi od the PI is connected to the inversor and the lan to the home network. In the past this was enought but since update it lost connection …

Hey, Any help on how to fix these errors???

Update of sensor.sun2000_5ktl_m0_hv19b0111087 is taking over 10 seconds
6:20:08 PM – (WARNING) helpers/entity.py - message first occurred at January 26, 2022, 3:17:06 PM and shows up 1622 times

022-01-27 18:10:08 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.sun2000_5ktl_m0_hv19b0111087 is taking over 10 seconds

Downgrade to SPC114 (it’s available at huawei website for download) or insert a USB wifi dongle in your Raspi.

thanks but the PI already has a wilress connection … do I need another ?

It works with this one V200R001C00SPC115

Unfortunately SPC115 is not available for download. On the other side, there is a SPC119 but also not available for download!
Do you have SPC115 package?

Yes the spc115 is on the Huawei system to downgrade.

The only way for me is donwgrade the firmware. Does anybody have the SPC115 package and share by email , Pls ?. I can’t download from huawei website…

Thanks in advance.

Hi, can anyone advise what the downside is of connecting to the dongle wifi instead of the internal AP? Do you miss out on certain types of data or are there other disadvantages?

Thanks!

I currently don’t have a dongle, and Huawei Support says I cannot write to registers via the ModbusTCP interface of the built in WiFi. You need a dongle for that.

A little context: I have been working on adding write-support to the library. While testing I noticed I always got an 0x80 exception, which means “Permission denied” :frowning:

I’ve updated the custom component to the integration that I’m trying to get approved as an official integration. I’m very interested in hearing any feedback!

I used your integration and for me it is missing:

Hi. This is good news. Thank you! Does it already include the ability to read from multiple inverters?