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)?