Integration Solar inverter huawei 2000L

You will need to have a power meter installed if you want to know the net power delivered to the grid (production of the inverter - consumption of your house). If you only want the power generated by the inverter, that’s the state value of the sensor.

You have two options:

The second one is easier to set up and looks better integrated but you database will get ~3x as big (if you’re using the current default of 10 days) which might become an issue. If you want to look at longer trends, let’s say months or years then can only go with InfluxDB or Prometheus.

I hope HA will move one day to Prometheus so that long term data and graphs can be first class citizens in Home Assistant.

How to set [Energy storage unit] Working mode (47004) on home-assistant.

Right now this is not possible with the huawei-solar package. I didn’t implement writing values because I did not need it and because it seemed safer to (start with) read-only. You could use the modbus switch, if you’re not afraid of messing things up.

1 Like

Where did you find such beautiful icons for inverter, smart meter, panels. ?

It’s from fusionsolar app for android.

Thanks, I have found icons in apk file in good quality and with transparency :slight_smile:

1 Like

Did you also have had the problem that you can’t connect your inverter in Python? I’m having a SUN2000-6KTL-MO but it’s giving me this ‘false’ reaction. Even why I try to scan on open ports on my invert, it giving null open ports.

>>> import pymodbus
>>> import time
>>> from pymodbus.client.sync import ModbusTcpClient
>>> client = ModbusTcpClient('192.168.2.14', '502')
>>> client.connect()
False

Are you connecting to internal Wifi? It will not work with smart dongle.

No I am using the ethernet SmartDongle so I wasn’t expecting this error.

Thanks for advising. As I didn’t have a spare (or old) router which I could flash, I used an Raspberry PI which I connected on wlan0 to the internal WiFi of the inverter (SUN2000-XXXXXX) and than connected the eth0 with an UTP cable to one of my switches. Before I did this, I managed to get into the inverter its program and changed the ip-address of the inverter to having the same subnet of my network. I now can ping the ip-address the inverter gave to my Raspberry PI wlan0. But when I try to use this in the below mentioned python script, it gave me a “false” reply. Do you have any clue?

>>> import pymodbus
>>> import time
>>> from pymodbus.client.sync import ModbusTcpClient
>>> client = ModbusTcpClient('192.168.2.100', '502')
>>> client.connect()
False

So you have two networks cards on Rasbery (lan and wifi) with the same subnet?

Yes that’s correct. I copied the ifconfig results in:

pi@Solar-server:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.35  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 2a02:a442:469b:1:6449:29e:d0cb:2379  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::8996:9b28:a759:40ab  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:34:30:8c  txqueuelen 1000  (Ethernet)
        RX packets 70531  bytes 73506297 (70.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15404  bytes 1438164 (1.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.100  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::a985:38a9:c312:f108  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:61:65:d9  txqueuelen 1000  (Ethernet)
        RX packets 2  bytes 952 (952.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 26  bytes 4415 (4.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

By the way it need to be said that I appreciate it big time that you are helping me!!

I don’t think this is correct. I’m not network guru but there will be problems with that configuration. You should have two different networks and routing between them. Are yo running python script on Raspberry? You can try change one subnet and try this python script on raspberry.

Thanks for the hint @ligeza. I now set the inverter back to internal ip-address: 192.168.8.1. My Raspberry Pi gets an wlan0 ip: 192.168.8.0 and now it’s possible to ping my inverter from my raspberry pi. Als I can connect to the inverter from the raspberry pi.

pi@Solar-server:~ $ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymodbus
>>> import time
>>> from pymodbus.client.sync import ModbusTcpClient
>>> client = ModbusTcpClient('192.168.8.1', '502')
>>> client.connect()
True

Next I need my main server get ready to reach the inverter (192.168.8.1) via the RPI. Since I’m not a network guru too I might be a challenge but I’ll give it shot :slight_smile:

Managed to work it out. I set up the network correct, but now I get an error like you @ligeza previous got:

ERROR (SyncWorker_16) [huawei_solar.huawei_solar] could not read register value, is an other device already connected?

How did you solve this problem?

I’m not sure, but this error is when there is problem with connection to inverter.

Strangely enough I can get all the data from the inverter, although de result take about 5 seconds to show up in Python. Is this normal? Or might this be the problem? Do you have any clue how I can make this work? Feels like I’m so close now…

Below some of the data I fetched

>>> inverter.get('model_name').value
'SUN2000-6KTL-M0'
>>> inverter.get('day_active_power_peak')
Result(value=0, unit='W')
>>> inverter.get('power_meter_active_power')
Result(value=0, unit='W')
>>> inverter.get('daily_yield_energy').value
5.71

Did you tried to change log level in HA to debug if there will be some more information about the problem?

It’s not giving very much of a clue, except it takes some time to setup:

2020-11-12 20:43:54 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.huawei_solar
2020-11-12 20:44:01 INFO (SyncWorker_12) [homeassistant.loader] Loaded huawei_lte from homeassistant.components.huawei_lte
2020-11-12 20:44:04 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform huawei_solar is taking over 10 seconds.
2020-11-12 20:44:07 ERROR (SyncWorker_3) [huawei_solar.huawei_solar] could not read register value, is an other device already connected?