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