Integration Solar inverter huawei 2000L

Hi,

I have a Huawei sun2000-6ktl-m1 with a wifi dongle. It has two wireless networks and I used another router to link the internal wifi (192.168.200.1 in my case) with the local network. In the end I managed to get HA to see it, but I get now this error in the log :

2021-04-22 14:15:13 ERROR (SyncWorker_0) [huawei_solar.huawei_solar] could not read register value, is an other device already connected?

2021-04-22 14:15:13 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up huawei_solar platform for sensor

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 198, in _async_setup_platform

await asyncio.shield(task)

File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run

result = self.fn(*self.args, **self.kwargs)

File "/config/custom_components/huawei_solar/sensor.py", line 109, in setup_platform

HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])

File "/config/custom_components/huawei_solar/sensor.py", line 124, in __init__

self._name = self._inverter.get("model_name").value

File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 40, in get

response = self.read_register(reg.register, reg.length)

File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 189, in read_register

raise ReadException(message)

huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?

I can ping it and I can run

curl -v 192.168.200.1:502 and it connects.

I use hass.io on a Raspberry so no python3 access.

Any suggestions ?

Thank you

Do you have optimizers or battery connected to inverter?
If not use

sensor:
  - platform: huawei_solar   
    host: '192.168.200.1'

or set

optimizers: false
battery: false

No optimizers and I had already both set to falseā€¦

Also the wifi connection is really weird, it disconnects a lot. I have the inverter outside and the router about 3 meters away. I need to get it closer and see if it makes a difference.

Did you try:

I know person that after adding this integration also huawei_solar started working. I think it might be related to dependencies.
If modbus integration will work, that mean that there is everything OK with network connection.

I tried both the huawei_solar integration from @Emilv2 and modbus.
The huawei_solar integration is really good but some problems occurs with lasts home assistant/OS releases and further problems appears when the battery data are enabled. I hope in a new release of the integration.
With modbus all seems ok but some data like battery SOC (state of charge) and SOH (state of healt) are not available via modbus.
I experienced big problems if both the systems runs together.

The register 37001 is actually readable with your configuration, thank you.

Chciałem tylko podziękować, ogarnięte :slight_smile: pooling co ~20s.
Dopisałem tylko kawałek kodu do parsowania i pchania wynikĆ³w danych do infliuxdb i jest super :slight_smile: Użyłem Rpi jako klient wifi i obsługi Pythona, a wyniki pcha na osobny serwer z InfluxDB oraz Grafana.

1 Like

Hi, I have a problem :slight_smile:

My environment is: HA ver. 2021.4.6 on Raspberry Pi 4B (WAN over Ethernet), SUN2000-5KTL-M0 inverter, huawei_solar integration (great job @Emilv2 )

I have a long running problem with AP (192.168.200.1) of this Huawei inverter. My Raspberry is less than 1m from inverter, and SUN2000* WIFI is still unstable.

My history is as below:

  1. I couldnā€™t connect to the SUN2000* WIFI from Raspberry (it was possible from the smartphone, but sometimes network on smartphone disappeared even when I was very close). Iā€™ve checked that connection with my home WIFI is possible and it looks stable, so I think that WIFI chip in Raspberry is OK.
  2. I have tried all suggested solutions in HA: using Supervisor GUI method to establish that WIFI connection, using ā€œSSH and Terminalā€ add-on and ā€œnmcliā€ tool. Result was the same: network SUN2000* appeared and disappeared sometimes for 5-10 minutes, without possibilty to connect.
  3. I bought Xiomi WIFI repater (distance to inverter is minimal, but Iā€™ve thought that maybe it will help). Finally first success - HA (Supervisor from GUI) connected to my inverter. But after 2 days of testing I can say, that problem still exists.
    Every couple of minutes connection with that network is broken. Testing from ā€œSSH Web Terminalā€ add-on shows the same - the network is unavailable.

Any suggestions?
pings from Raspberry to 192.168.200.1 look sadā€¦ sometimes 30ms, sometimes 2s, sometimes 15sec.

Hi! Is it possible to get SOC with huawei_solar?

Currently not. Maybe later, if @EmilV2 will be so kind to work furterly to find the cause of the problems.

Try to use TL-WN422G card for rpi. I have this configuration installed a meter from the inverter but behind a thick wall. -65dbi signal and stable ping 2-15ms. If this does not help, the card or the antenna in the inverter is damaged. I tried with a different router before and had a very similar problem to yours.

Thanks for advice, Iā€™ll check it.

I managed to connect with modbus, I wasnā€™t able to get in using huawei_solar. I have a tri-phase inverter and a smart meter also from Huawei DTSU666-H. I see that the meter has more information available than the inverter. I am mostly interested in power generated and used (both from the solar panels and the grid) on each one of the 3 phases. Any chance I can get that info ?

You should find the document with the ā€œModbus Interface Definitionsā€ referred to your inverter/datalogger to see what data is available. Here an example: https://support.huawei.com/view/PdfRead/EDOC1100050690/SUPE_DOC/6001/document.pdf
On the System Requirements chapter you can check the compliance to your system.

Thatā€™s a Huawei logger, I donā€™t think it applies to the smart meter, I didnā€™t get any readings from those. I already checked the inverter modbus values but it doesnā€™t show the actual power produced and consumed on each phase, I think only the smart meter is aware of those numbers.

You can find this values in src/huawei_solar/huawei_solar.py Ā· master Ā· Emil Vanherp / HuaweiSolar Ā· GitLab

    "power_meter_active_power": RegisterDefinitions("i32", "W", 1, 37113, 2),
    "grid_A_voltage": RegisterDefinitions("i32", "V", 10, 37101, 2),
    "grid_B_voltage": RegisterDefinitions("i32", "V", 10, 37103, 2),
    "grid_C_voltage": RegisterDefinitions("i32", "V", 10, 37105, 2),
    "active_grid_A_current": RegisterDefinitions("i32", "I", 100, 37107, 2),
    "active_grid_B_current": RegisterDefinitions("i32", "I", 100, 37109, 2),
    "active_grid_C_current": RegisterDefinitions("i32", "I", 100, 37111, 2),
    "active_grid_power_factor": RegisterDefinitions("i16", None, 1000, 37117, 1),
    "active_grid_frequency": RegisterDefinitions("i16", "Hz", 100, 37118, 1),
    "grid_exporterd_energy": RegisterDefinitions("i32", "kWh", 100, 37119, 2),
    "grid_accumulated_energy": RegisterDefinitions("u32", "kWh", 100, 37121, 2),
    "active_grid_A_B_voltage": RegisterDefinitions("i32", "V", 10, 37126, 2),
    "active_grid_B_C_voltage": RegisterDefinitions("i32", "V", 10, 37128, 2),
    "active_grid_C_A_voltage": RegisterDefinitions("i32", "V", 10, 37130, 2),
    "active_grid_A_power": RegisterDefinitions("i32", "W", 1, 37132, 2),
    "active_grid_B_power": RegisterDefinitions("i32", "W", 1, 37134, 2),
    "active_grid_C_power": RegisterDefinitions("i32", "W", 1, 37136, 2),

Frans1 after yesterday huawei update i change a kiosk adress but i cant see more data in HA.

any help ??? thanks

regards

Yes it seems that due to the website upgrade the URL for kiosk has changed. I tried a few combinations but didnā€™t manage to find the right one. @Frans1 may be able to help if / when he has some time to look at itā€¦

I have talk with Frans and seems that JSON file is hard (wrong) coded and it will be difficult to fix.
I try with python to read the data but like I said no success because of the " 's in the file. instead to be
"
there is

"

Like Frans said the JSON file is at:

https://eu5.fusionsolar.huawei.com/rest/pvms/web/kiosk/v1/station-kiosk-file?kk=

If anyone know how to parse the " in the file?
I have try with python like this:

curl -s https://eu5.fusionsolar.huawei.com/rest/pvms/web/kiosk/v1/station-kiosk-file?kk=YOURKIOSKTOKEN | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["'data'"])'

but I can get only:

  • data
  • success
  • failCode

The one that we need realTimePower, cumulativeEnergy, monthEnergy, dailyEnergy, yearEnergy are in data treeā€¦

so if I try:

curl -s https://eu5.fusionsolar.huawei.com/rest/pvms/web/kiosk/v1/station-kiosk-file?kk=YOURKIOSKTOKEN | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["'data'"]["'realTimePower'"])'

I got error.

Anyone?

1 Like

I get the same using several platforms to grab the JSON file. It seems indeed like a codepage issue. We will probably have to wait until they fix it, or try to get the info in a different way (scraping the native Kiosk page? not every elegantā€¦)