Integration Solar inverter huawei 2000L

Thanks… already downgraded…

I had made a custom component from this core/homeassistant/components/modbus at 2021.4.6 · home-assistant/core · GitHub
So you can stay on 2021.5.x

Hello,
could you please tell me, where you were able to download firmware SPC120 for the Smart Dongle?
My environment doesn’t offer v120 - only v118 - therefore Modbus TCP is not working via FE?
With Huawei ‘Device Upgrade’ I can only choose btw. v116 and v118… :man_shrugging:
Would be great to share a link or the upgrade package itself!!!
Many Thanks!

Hello
7 posts up

1 Like

I have a Sun2000 5KTL L1 (1 phase) inverter. The integration works perfectly, but I noticed that the following parameters are always 0:

grid_exported_energy
energy_used

Is this normal, or do I need to change to configuration to see those values?

I think those properties are available only when power meter is connected to the inverter. Mine shows some big values :), but i ignore them.

Grid exported energy 21474836.47
Grid accumulated energy 21474836.47

1 Like

@Emilv2 any fix for this? I have set temporarly battery = false so that it works without battery info.
Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:321
Integration: Sensor (documentation, issues)
First occurred: 4:17:01 (1 occurrences)
Last logged: 4:17:01

huawei_solar: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 358, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 466, in async_device_update
await 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 321, in update
self._storage_charge_current_day_charge_capacity = self._inverter.get(
File “/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py”, line 39, in get
reg = REGISTERS[name]
KeyError: ‘storage_charge_current_day_charge_capacity’
Thanks!

I had requested the new firmware, and I had received a zip file.
But the only way to update the firmware seem to be with an android phone.
So now I’m searching a phone to borrow from friends…

Do you have the latest version from Github? That error should have been fixed already.

For all the other questions/issues:
You can keep posting them here or on Github. I have seen a few things I can quickly fix and I’ll do that. Starting from June/July I should have some more time again and I’ll try to get all the other issues fixed then.

1 Like

Ciao @Emilv2
Just redownloaded to be sure it was the last one, but I’m afraid error is still there:

Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:343
Integration: Sensor (documentation, issues)
First occurred: 3:03:08 PM (1 occurrences)
Last logged: 3:03:08 PM

huawei_solar: Error on device update!

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 365, in _async_add_entity await entity.async_device_update(warning=False) File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 482, in async_device_update await 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 343, in update self._storage_power_charging_cutoff_capacity = self._inverter.get( File “/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py”, line 39, in get reg = REGISTERS[name] KeyError: ‘storage_power_charging_cutoff_capacity’

Thanks in advance!

Oops, two more copy paste mistakes :sweat_smile: I fixed them, does it work now with the latest version from Github?

@Emilv2 Just updated sensor.py, but still same error :frowning:
huawei_solar: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 365, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 482, in async_device_update
await 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 343, in update
self._storage_power_charging_cutoff_capacity = self._inverter.get(
File “/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py”, line 39, in get
reg = REGISTERS[name]
KeyError: ‘storage_power_charging_cutoff_capacity’

What about now?

@Emilv2 No error, but no battery outputs :frowning:

@gfpinto

I have updated my sDongle to the latest firmware. But I can’t get modbus working over Ethernet. I’ve tried with and without slave: 1

I’m not sure, but could this relate to Modbus that fetch data with some delay?

I am currently trying to set this up for my inverter (Huawei SUN2000-3KTL-L1, connected via WiFi dongle), however I seem to be getting the following problem. I can connect to that host and port via telnet, so that [wrong ip] does not seem to be the issue. Is this inverter unsupported or am I doing something wrong?

For completeness sake, the config (I do not have batteries, but I do have optimizers):

sensor:
  - platform: huawei_solar
    host: '192.168.178.173'
    optimizers: true
#    battery: false

Logs:

2021-05-20 13:19:40 ERROR (SyncWorker_2) [huawei_solar.huawei_solar] failed to connect to device, is the host correct?
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 172, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 109, in execute
    return self.transaction.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 173, in execute
    response, last_exception = self._transact(
  File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 290, in _transact
    result = self._recv(response_length, full)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 321, in _recv
    read_min = self.client.framer.recvPacket(min_size)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
    return self.client.recv(size)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 89, in recv
    return self._recv(size)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 298, in _recv
    return self._handle_abrupt_socket_close(
  File "/usr/local/lib/python3.8/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.178.173:502): Connection unexpectedly closed 0.000129 seconds into read of 8 bytes without response from unit before it closed connection
2021-05-20 13:19:40 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.sun2000_3ktl_l1 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 172, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 109, in execute
    return self.transaction.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 173, in execute
    response, last_exception = self._transact(
  File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 290, in _transact
    result = self._recv(response_length, full)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 321, in _recv
    read_min = self.client.framer.recvPacket(min_size)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
    return self.client.recv(size)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 89, in recv
    return self._recv(size)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 298, in _recv
    return self._handle_abrupt_socket_close(
  File "/usr/local/lib/python3.8/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.178.173:502): Connection unexpectedly closed 0.000129 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.py", line 316, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 524, in async_device_update
    raise exc
  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 257, in update
    self._state = self._inverter.get("active_power").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 175, in read_register
    raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.178.173:502): Connection unexpectedly closed 0.000129 seconds into read of 8 bytes without response from unit before it closed connection

I have already solved the connection problems, in my case the inverter was defective, after several tests with the huawei support they indicated that some internal memories of the inverter did not work well, they have changed the inverter and everything has been solved. Thankyou for your help.

Ciao @Emilv2 any progress on battery sensors? There must be an issue in the IF check or similar, as i tried to update sensors.py to include STORAGE_STATUS independently of the Battery_Installed IF and I was able to get value in HA.

Thanks!

Ciao Valentino, posso chiederti come hai fatto a fare questo tipo di visualizzazione?Grazie