Integration Solar inverter huawei 2000L

Hey, guys. Tried as I could read this thread but I couldn’t find a clear answer.
I’m a new owner of the:

  • Huawei SUN2000-3KTL-M1 (firmware: V100R001-02, software: V100R001C00SPC133, MBUS: V100R001C00B021)

with the WiFi dongle:

  • SDongleA-05 (WLAN-FE) (I’m not sure how to check the dongle software/firmware)

Setup

sensor:
  - platform: huawei_solar
    host: "192.168.0.106"
    optimizers: false 
    battery: false
    slave: 1 # I have tried from 0 - 3 just in case :)

I can do with success:

❯ curl -v 192.168.0.106:502
*   Trying 192.168.0.106...
* TCP_NODELAY set
* Connected to 192.168.0.106 (192.168.0.106) port 502 (#0)
> GET / HTTP/1.1
> Host: 192.168.0.106:502
> User-Agent: curl/7.64.1
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host 192.168.0.106 left intact

curl: (52) Empty reply from server
* Closing connection 0

❯ nc -vz 192.168.0.106 502
Connection to 192.168.0.106 port 502 [tcp/asa-appl-proto] succeeded!

both from my mac and rasberry pi

Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:135
Integration: Sensor (documentation, issues)
First occurred: 9:47:40 (1 occurrences)
Last logged: 9:47:40

Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 293, in read_register
    response = self.client.read_holding_registers(
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 109, in execute
    return self.transaction.execute(request)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 174, in execute
    response, last_exception = self._transact(
  File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 293, in _transact
    result = self._recv(response_length, full)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 325, in _recv
    read_min = self.client.framer.recvPacket(min_size)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
    return self.client.recv(size)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 89, in recv
    return self._recv(size)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 298, in _recv
    return self._handle_abrupt_socket_close(
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 343, in _handle_abrupt_socket_close
    raise ConnectionException(msg)
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.0.106:502): Connection unexpectedly closed 0.002069 seconds into read of 8 bytes without response from unit before it closed connection

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/huawei_solar/sensor.py", line 120, in setup_platform
    HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])
  File "/config/custom_components/huawei_solar/sensor.py", line 135, in __init__
    self._name = self._inverter.get("model_name").value
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 265, in get
    response = self.read_register(reg.register, reg.length)
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 298, in read_register
    raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.0.106:502): Connection unexpectedly closed 0.002069 seconds into read of 8 bytes without response from unit before it closed connection

I found a topic on Huawei’s forum that bigger wait after connection can help, so I tried to modify HuaweiSolar initialization with bigger timeout=60 and wait=10 in the source code of the component /config/custom_components/huawei_solar/sensor.py but without success.

I have also found this thread but I’m not sure if this is related to my issue Can't get your component to work · Issue #6 · Emilv2/huawei_solar · GitHub

Could that be the case that my inverter does not support Modbus connection via dongle (like @kyxzhi answered here Integration Solar inverter huawei 2000L - #356 by garret) and only via SUN2000 AP wifi that is present all time (I didn’t try to get data via AP yet)?

for me it only work when i poll data from 200.1 IP address, the one it has when you connect to the network it broadcasts for inital config (SSID SUN2000…) not sure if you can get data over way around when you connect it to you home wifi…

That’s a shame. So one solution might be merging this SUN2000 network to the home network via AP router?

or plug a wifi dongle in you HA for that , i prefer it that way, keep all in house no access to you Wlan/lan/internet for not really trustworthy device

Soft w smartdongle musi mieć wersję z końcówką SPC120 lub wyżej bo jest nowsza wersja SPC122. Wersję najprościej sprawdzisz na https://eu5.fusionsolar.huawei.com/ Jeśli masz starszą wersję to jedynie pobieranie danych poprzez połączenie do wbudowanego AP. Oczywiście przy połączeniu do wifi dongle z firmware >=SPC120 musi być to połączenie kablem sieciowym.
Czyli jeśli bezprzewodowo to połączenie musi być do wbudowanego AP, a jeśli kablem to firmware z odpowiednią końcówką. Nie ma możliwości pobierania danych bezprzewodowo przy połączeniu do smart dongle.

1 Like

Yup, that’s sound like a valuable solution to, but my rasberry pi is far enough from the inverter and also inverter’s AP doesn’t seem to have a strong singnal. I will have to consider how to tacle this.

translation for those how dont speak that language…

The soft in the smartdongle must have a version with the SPC120 tip or higher because there is a newer version of SPC122. The easiest version to check is https://eu5.fusionsolar.huawei.com/ If you have an older version, only download data by connecting to the built-in AP. Of course, when connecting to a wifi dongle with firmware> = SPC120, it must be a network cable connection.
So if wireless, then the connection must be to the built-in AP, and if the cable is the firmware with the appropriate tip. It is not possible to download data wirelessly when connected to a smart dongle.

–0–
To be honest, it is not clear but look like he meant to say: hotspot or cable, no other way to get it from the inverter

Aha, myślałem, że niektórzy mają takie wersje inwerterów, gdzie dane można pobierać poprzez WiFi podpiętego do swojej sieci domowej bez większych kombinacji.

Czyli podsumowując:

  1. WiFi dongle z wersją >=SPC120, ale i tak trzeba się do niego podpiąć kablem LAN, bo przez WiFi nie da się pobrać danych (dziwne ograniczenie BTW)
  2. Podpięcie się do AP SUN2000.

In English:
Ok, I thought that some of you have such versions of the inverters that allow getting the data without any other tricks when the inverter is just connected to the home network.

To summarize, there are two options:

  1. WiFi dongle with version >=SPC120, but you still have to connect via LAN cable, because for some weird reason you cannot get the data via wireless.
  2. Connect to the AP SUN2000 network

@ligeza correct?

1 Like

Dokładnie tak. Oczywiście niektórzy mają takie wersje że da się przez podpięcie do WiFi w sieci domowej, ale z tego co się orientuje są to starsze wersje chyba jednofazowe w których nie ma smart dongle. Taką wersję falownika posiada autor tej integracji.

1 Like

@ligeza @Boroda Thank you very much for the quick response. Everything is clear now.
My dongle is:

Model:
SDongleA-05 
Software version:
V100R001C00SPC117 

Sadly it’s <SPC120

So I have only one option with the AP.

Niekoniecznie, bo jeśli chcesz nowszą wersję, możesz napisać do supportu huawei Integration Solar inverter huawei 2000L - #387 by gfpinto
Mi przysłali w ciągu 1-2 godzin firmware łącznie z instrukcją aktualizacji.
Jeśli się ma konto instalatora to można też podobno ręcznie zaktualizować poprzez stronę www na portalu fusionsolar.

1 Like

Aha, myślałem, że wymagana jest sprzętowa wymiana dongla. Jestem w stanie zalogować się jako instalator falownika z aplikacji mobilnej. Zerknę na tą opcję. Dzięki za info.

Musi być konto instalatora na platformie fusionsolar, z aplikacji mobilnej jedynie aktualizacja z pliku z firmware.
Chociaż widzę że dwa dni temu ktoś wspominał na forum huawei że usunięto tą wersję firmware:

Now I checked the fusionsolar portal for updates and SPC122 is no more available. No problem for me, I have already installed it. Does anybody know if SPC122 has been removed as SPC120 already was? And when yes, why?

what does that mean? wifi via lan cable, my inverter does not have ethernet(LAN) port just Wifi antenna, does it mean I need to buy some sort of adapter to connect a cable to it?

I didn’t check, but I assume that guys connect the cable to the dongle by putting off the bottom part. You check the details in the manual SDongleA-05 Quick Guide (WLAN-FE)- Huawei

yeah that is a FE dongle need to buy it separately wifi is integrated

Hello,

Ive tried to install this plugin but get following error:

Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):

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

await asyncio.shield(task)

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

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

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

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

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

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

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

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

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

raise ReadException(message)

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

However when I ssh onto the machine and try it with python, it works:

>>> inverter.get ("model_name")
Result(value='SUN2000L-4.6KTL', unit=None)

Anyone else has ideas on what I could try?

Thanks

Po niedawnej aktualizacji 2021.07.01 i aktualizacji modbusa integracja zaczela mi wariowac.
Czesc sensorow jest “unavailable” czasem sie pojawiaja jak zresetuje itp.

Czy ktos sie spotkal z czyms takim ?
Mam zintegrowane przez modbusa i wbudowany AP a do tego podlaczylem jeszcze kablem dongla i na razie odczytalo wszystkie wazne sensory ale chwile temu polowy nie bylo.

Pozdrawiam
Wojtek

Hi, I face the same error message… but i am connected with direct wifi AP (which is easy as my raspberry pi wlan is otherwise out of duty)…
you can check the dongle firmware also in the FusionSolar app, Tap devices at the bottom and there the dongle should apear and your inverter.
If you want to use the dongle, you have to be connected wired (attached in the dongle at the bottom).

Interesting wise for me: my connection was working the day before perfectly… and suddenly it stops working… when i enable the modbus plugin in FHEM again, it works out of the box - so seems that the python implementation is doing something differently - maybe timing, idk.

update: error gone, connection established… strange :slight_smile:

U mnie działa bez problemów z donglem zaktualizowanym do wersji V100R001C00SPC122 w węwnętrznej sieci. HA w najnowszej wersji 2021.08.02