First of all, thanks to @Emilv2 for the great script he has made and to everyone who has contributed to this forum thread. It works perfectly for me and everything is great in home assistant.
The only problem I have is that some attributes are not clear to me and I would like to know which attributes correspond to those shown in the following image (from the Huawei solar fusion application).
On the other hand, I would like to know if it is possible to configure home assisant to perform it as a service and have several entities (instead of a service with attributes). In other words, to be able to have the values āāthat are in the attributes independently.
Thank you very much again. THANK YOU, THANK YOU and THANK YOU.
2 is the state of the device - 3 and 4 are unfortunately not accessible as far as I know. I donāt have this meter but others have tried and could not get it. Same thing for 5, 6, 8 and 9.
7 is daily yield
Separate sensors is a good idea and should be done to make it officially into HA.
EDIT: Seems like I remembered wrong about the power meter values.
You can use template sensor. I think it is better option then independent sensors because I can chose which sensors I want, instead of having over 50 sensors.
- platform: template
sensors:
m_grid_exporterd_energy:
friendly_name: "PrÄ d oddany do sieci"
unit_of_measurement: 'kWh'
icon_template: mdi:transmission-tower
value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_exporterd_energy') }}"
I want to integrate a Huawei SUN2000 inverter - 5KTL-M1, using HA on an Rpy3.
Rpi is connected to the router via LAN. Router and Rpy IP is 192.168.16.xxx
The inverter is connected to the router via wifi dongle. (without battery and optimizer)
I read the previous posts, and I canāt make this integration. Thatās what Iāve done so far:
I found out the address of the inverter, I checked it:
>>> import huawei_solar
>>> inverter = huawei_solar.HuaweiSolar ('192.168.200.1')
>>> inverter.get ("model_name")
Result (value = 'SUN2000-5KTL-M1', unit = None)
I created the folder and put the necessary files in it, and wrote in configuration.yaml:
Do you see any errors in HA logs? I see that connection from python works, so is rpi connected to inverter internal wifi (you canāt connect this integration to smart dongle)? Did you try move rpi closer to inverter to test it with better wifi signal?
Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:124
Integration: Senzor (documentation, issues)
First occurred: 10:57:11 (1 occurrences)
Last logged: 10:57:11
Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 169, 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 107, in execute
raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]
During handling of the above exception, another exception occurred:
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 172, in read_register
raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]
Rpy is not connected via dongle, I think it is connected via wifi (nmcli shows Sun2000 ā¦). Maybe I donāt know how to connect Rpy to the inverterās internal wifi ā¦
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:171
First occurred: 10:57:09 (1 occurrences)
Last logged: 10:57:09
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 169, 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 107, in execute
raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:171
First occurred: 10:57:09 (1 occurrences)
Last logged: 10:57:09
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 169, 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 107, in execute
raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]
Logger: pymodbus.client.sync
Source: /usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py:214
First occurred: 10:57:02 (2 occurrences)
Last logged: 10:57:09
Connection to (192.168.200.1, 502) failed: timed out
Is it still working? Was it from rpi? Can you show network configuration from rpi? On rpi you shoul have 2 IP, one from home network (LAN) and one from Inverter (wifi)
Yes, as I understand it if you do this you will stay connected to the router via LAN and connected to the inverter via Wifi. If it works you should see an ip address behind IPv4 addresses from wlan0 in the System information.