Good morning, after installing the repository and configuring the IP of the inverter (huawei sun2000 5k L1), it keeps reporting this error to me:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 432, in _async_add_entity
await entity.async_device_update (warning = False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 601, in async_device_update
await 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 291, in update
self._grid_exported_energy = self._inverter.get (“grid_exported_energy”). value
File “/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py”, line 39, in get
reg = REGISTERS [name]
KeyError: ‘grid_exported_energy’
I have the optimizers and batteries in “false” since I do not use battery or optimizers.
On the other hand, does anyone have the card code to view the investor’s values? I don’t know how to configure it.
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 432, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 601, in async_device_update
await 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 291, in update
self._grid_exported_energy = self._inverter.get(“grid_exported_energy”).value
File “/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py”, line 39, in get
reg = REGISTERS[name]
KeyError: ‘grid_exported_energy’
Joaquín I’m interested in knowing how you configured so many sensors.
I have an integrated 5kw inverter, but I don’t know the name of the sensors to later create those cards.
Could you tell me the name or the code snippet to read those attributes?
Joaquín me interesa saber como configurastes tantos sensores.
Tengo un inversor de 5kw integrado, pero desconozco el nombre de los sensores para crear luego esas tarjetas.
Podrías indicarme el nombre o el fragmento de código para leer esos atributos?
2021-07-19 16:32:56 ERROR (MainThread) [homeassistant.components.sensor] huawei_solar: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 432, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 601, in async_device_update
await 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 297, in update
self._grid_exported_energy = self._inverter.get(“grid_exported_energy”).value
File “/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py”, line 39, in get
reg = REGISTERS[name]
KeyError: ‘grid_exported_energy’
I already changed to huawei-solar>=0.1.0,<1.0.0, but without sucess
In the last few days I have been trying to put up and running Home Assistant with integration with my Huawei SUN2000-3KTL-M0.
It took time, but today I finally was able to get the first data from the inverter .
For that I must thank Emilv2, Rafal and all others that are supporting the community,
The problem I have is that I can’t reconcile all numbers I read from the inverter through huawei_solar and those I get from Huawei fusion portal.
I am trying to get daily total numbers for production, imported electricity from grid and exported energy to grid. In the post I replying to, I am looking for daily values for #5 (is counted), #6 (grid_exported_energy) and #8 (grid_accumulated_energy).
Looking at all numbers read on the sensor, both grid_exported_energy and grid_accumulated_energy are total counters, adding up all values since the inverter was first connected (like total_yeld). For daily production there is daily_yeld…
I have problems to connect the inverter to Homeassitant.
The inverter is LAN and Wifi connected, and Homeassistant reads data from wifi IP.
Everything works fine, until I lost the internet connection or I reboot the homeassitant.
When that occurs, I have to connect to inverter, reconect the inverter to wifi and reboot the homeassitant, and it sometimes succes…
Now is working again, but is stressful.
Is it possible connect the inverter only by ethernet cable and get data from its to Homeassitant?
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:295
First occurred: 18:18:31 (1 occurrences)
Last logged: 18:18:31
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 291, in read_register
response = self.client.read_holding_registers(
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.50.239:502): Connection unexpectedly closed 0.000247 seconds into read of 8 bytes without response from unit before it closed connection
Hello all,
Thanks everyone for the contribution and insights about this topic. I have the latest firmware on wifi my dongle and I have an 8KTL - M1 3 phase. 502 port is open and via manual modubus connection I get a True response and the library is installed via pip3 and also via hacs.
My question is if somebody encountered the error of always saying that there is “another client connected.” - from hass and terminal as well. (I closed the fusionsolar mobile app and website and waited for some time).
Thanks!
Hi all,
Just got one of these invertors now trying to use this integration, but it just won’t work, whenever I add it and try and restart HA it just kills it. Removing the folder from Custom Integrations resolves it.
Since HA refuses to restart there is nothing in the logs.
I’ve seen some posts on updating the manifest file, but this hasn’t done anything, this is my manifest file for the component:
try in the terminal on your pc to use the python package and see if that works before using it on HA, maybe you have the same problem as me, see above.
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
import time
client = ModbusClient("192.168.1.14", port=502)
client.connect()
if client.connect():
time.sleep(1)
rr = client.read_holding_registers(0x7D50, 0x02, unit=1) #32080 => active_power
activePowerInv=rr.registers[1]
print(activePowerInv)
“The trick is to specify the unit id (equal to 1) on each read_holding call. The dongle doesn’t answer to any request if the unit is not specified.”
This works along the FusionSolar app/website.
@Emilv2 thanks for your HASS plugin. I think that the code above may need to be integrated in the plugin, because as it is now, it didn’t work, at least for my configuration (KTL8-M1, 3P + smart dongle at version 122)
Only since version 120, the WLAN dongle allows the communication via 502 port directly.
For those that need an update for their wlan dongle just login in the fusionsolar web app, https://eu5.fusionsolar.huawei.com/ go to Plants > Device Management > Upgrade Management > Add (top right) select dongle > target xxxSPC122 then your dongle should appear in the next input or search for it
It will take a while (20mins), then check the status of the update, mine stated initially as “Delayed”, then I restarted the inverter (it applies the update when the dongle restarts).