I’m trying to understand how things work, I’m familiar with HE where everything is more …otherwise…the last step was the implementation of Huawei in HA (it doesn’t exist in HE) and I’m totally blocked, I activated Mobus TCP mode from Huawei , installed Huawei Solar via HACS and tried to start the configuration but there is an error, I tried all ports, all variants, I use a Tp link Deco AC1200 router.
after read a lots about this “error” I’m out of … solution, anybody with a little help please
@nickulaie although I am a newbie in the Home Assistant - Huawei integration thing, I will try to help you. First of all, please report your inverter model, your firmware version and if you use the Sdongle or not.
If you read my recent messages, there is way to connect to the modbus interface from local lan, so you don’t really need to connect to the wifi access point of the inverter. And if you use the Sdongle, this is even easier. I use the integration of @wlcrs GitHub - wlcrs/huawei_solar: Home Assistant integration for Huawei Solar inverters via Modbus
@malakudi thk for answer.
I have error when I want to connect to Huawei from HA, try everything and same error.
About my firmware
I have sun2000-3KTL-M1
Hi there!
I have just tried this, because I want to do the same.
My automation just call the service forcible_charge
on the Battery device with a given duration in minutes and the power set to 2000W. Then, it begins to charge No need to change the Battery Excess PV energy use in TOU
or Battery Working Mode
.
I have the Change from grid
always on. In this case, it is needed, so the power is taken from the grid.
In order to stop the charge, although it stops when the requested duration has passed, I also use a timer in order to call the service stop_forcible_charge
on the Battery device. Well, it is not needed, but I use that timer to display in the dashboard how long still remains of the requested charging time.
Thanks for the tip! It is always useful to read the Force Charge/Discharge Battery WIKI.
OK, so you don’t have the Sdongle. Have you tried what I reported at Integration Solar inverter huawei 2000L - #2206 by malakudi ?
@ malakudi I have the Donble, I assume in fussion solar app is under another menu
I will update my software today to next firmware, right now i have SPC 146 and need to update to SPC 147, hope after this to fix the problem, I will come back with news in a few hours.
Me again I can not get this integration to work
I try “network”, “whitout dongle”, “wifi USB stik”, “using a dedicate WLAN bridge”.
I try all port 502, 6607, ID1, ID2
No succes
This is last message from log:
"Logger: pymodbus.client.asynchronous.async_io
Source: runner.py:119
First occurred: 16:13:30 (12 occurrences)
Last logged: 16:20:20
Failed to connect: [Errno 111] Connect call failed (‘192.168.200.1’, 6607)
Failed to connect: Multiple exceptions: [Errno 111] Connect call failed (’::1’, 6607, 0, 0), [Errno 111] Connect call failed (‘127.0.0.1’, 6607)"
some printshoot:
HA is on thin Fujitsu, SO Alpine Linux
Home Assistant 2022.11.3
Supervisor 2022.10.2
Operating System 9.3
Frontend 20221108.0 - latest
invertor Sun2000-5ktl-m1 FW: SPC147 (latest)
@malakudi still same error, update the inverter and SDongle
Failed to connect: Multiple exceptions: [Errno 111] Connect call failed (’::1’, 502, 0, 0), [Errno 111] Connect call failed (‘127.0.0.1’, 502)
6:57:33 PM – (WARNING) runner.py - message first occurred at 5:54:25 PM and shows up 165 times
Aborting client creation due to error.
6:57:28 PM – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py - message first occurred at 5:55:00 PM and shows up 7 times
Modbus client is not connected to the inverter.
6:57:28 PM – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py - message first occurred at 5:55:00 PM and shows up 7 times
Failed to connect: [Errno 111] Connect call failed (‘192.168.68.110’, 6607)
6:57:27 PM – (WARNING) Huawei Solar (custom integration) - message first occurred at 5:54:59 PM and shows up 5 times
Could not read register value, has another device interrupted the connection?
6:57:09 PM – (ERROR) Huawei Solar (custom integration) - message first occurred at 5:54:25 PM and shows up 3 times
Aborting client creation due to error.
6:57:09 PM – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py - message first occurred at 5:54:25 PM and shows up 3 times
Could not read register value, has another device interrupted the connection?
6:57:09 PM – (ERROR) Huawei Solar (custom integration) - message first occurred at 5:54:25 PM and shows up 3 times
@nickulaie You should have ping with the local lan ip that sdongle got and if you have set modbus-tcp option to “Enabled (unrestricted)”, you should have port 502 open. You don’t have ping at all so your network settings are problematic.
You should configure your router to always give same ip to the sdongle, since it might have changed. If router doesn’t offer such feature, you should configure sdongle ip statically.
For my setup, no work anymore
Invertor FW update:
Dongle FW update:
Android version:
No Q&M: (same on Iphone)
In this morning I have some test for communication (AP inverter → Router(extender mode) → HA server (Wifi USB stick)
following this quide:
This is my scenario:
“Network connection”
“Preferred option without a dongle”
“Using a dedicated WLAN Bridge”
some print screen:
router (extender) off:
router (extender) on:
connection with my home router (dongle - wifi):
ping test: (seems ok):
set integration:
no succes:
HELP please!!!
Hi everyone.
Just wanted to share my findings so I maybe can help others.
First I was able to connect succes with TCP modbus, both on internal wifi, and with the dongle. After the inverter and the dongle got the latest updates, this DOESNT work anymore. I have tried all possible settings - no results.
(see this: Page 5 of MODBUS TCP Guide - Huawei Enterprise Support Community)
I have now connected the inverted with seriel RS485 (see this: Connecting to the inverter · wlcrs/huawei_solar Wiki · GitHub) - This ONLY works (BUT IT WORKS!!) when the dongle is disconnected from the inverter.
For me the seriel RS485 solution is for now the only solution that works. We have to wait for Huawei to come up with a new firmware update.
I have exactly the same behaviour with the wired dongle. Before I switched to the dongle I used to connect to the inverter’s wifi AP, and that worked like a charm (I could reliably fetch data from it every second!), but as I have two inverters in master-slave configuration I could only read data from the master inverter. It would be nice if the wired dongle connection could get more stable and even more nice if we could then up the polling frequency.
I switched to RS485 (without the dongle) and now all problems has gone.
But with your setup (master+slave) i think you need the dongle
Hey all,
I am trying to use the wlcrs/huawei_solar integration for home assistant on a raspberry pi.
I have connected to my inverter with the dongle as described in the tutorial, updated everything and enabled Modbus TCP without any restrictions.
I manage to connect to the inverter with Modbus, but then the setup process does not continue and hangs in an endless loop. Does anyone know this error and what I can do? I have already restarted the inverter several times, reinstalled the plugin.
2022-11-22 16:13:35.674 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting to 172.16.42.130:502.
2022-11-22 16:13:35.675 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-11-22 16:13:35.682 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client connected to modbus server
2022-11-22 16:13:35.682 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol made connection.
2022-11-22 16:13:35.683 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Connected to 172.16.42.130:502.
2022-11-22 16:13:36.687 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2022-11-22 16:13:36.688 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x0 0x3 0xa7 0xfe 0x0 0x1
2022-11-22 16:13:36.695 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2022-11-22 16:13:39.701 INFO (MainThread) [backoff] Backing off _do_read(...) for 1.0s (asyncio.exceptions.TimeoutError)
2022-11-22 16:13:39.702 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 1.0 seconds after 1 tries
2022-11-22 16:13:40.705 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x2 0x0 0x0 0x0 0x6 0x0 0x3 0xa7 0xfe 0x0 0x1
2022-11-22 16:13:40.707 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 2
2022-11-22 16:13:43.711 INFO (MainThread) [backoff] Backing off _do_read(...) for 2.0s (asyncio.exceptions.TimeoutError)
2022-11-22 16:13:43.712 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 2.0 seconds after 2 tries
2022-11-22 16:13:45.715 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x3 0x0 0x0 0x0 0x6 0x0 0x3 0xa7 0xfe 0x0 0x1
2022-11-22 16:13:45.717 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 3
2022-11-22 16:13:48.720 INFO (MainThread) [backoff] Backing off _do_read(...) for 4.0s (asyncio.exceptions.TimeoutError)
2022-11-22 16:13:48.720 DEBUG (MainThread) [huawei_solar.huawei_solar] Backing off reading for 4.0 seconds after 3 tries
Hi !
The connection trough the SDongle is a pain, I have one and for me not works so well.
have you already tried with all the possible combinations? Port 502/6607 Slave ID 0/1 , enable/disable ‘elevate permission’
My setup works with “502,1,enable”, but if I try to delete the integration and reinstall it doesn’t work anymore…
My advice is to try every single combination 2 times, and for every try a wipe and a reinstall of the integration.
It’s a bit tricky but for me worked (1 month ago). Unfortunately wlcrs doesn’t have an SDongle, so he can’t fix every SDongle’s related issues.
If you want a stable and reliable setup you have to try without the dongle.
Your the absolut best! Exactly this setup worked even though i have thought i have tried all before. Thank you so much for your help!
Hi,
I’ve the 2000L without dongle, and I’ve not the installation password (the installation do not want to give it to me as he is in charge of the system and he doesn’t feel confident )
So, he enabled the O&M mode and the RTU modbus.
I used a RapberryZero as bridge (wlan0 connected to my network, wlan1 connected to the 2000L wifi), using the following command to forward the port:
sudo iptables -t nat -i wlan0 -I PREROUTING 1 -p tcp --dport 6607 -j DNAT --to-destination 192.168.200.1:6607
Then tried connecting, using as IP the IP of the RapberryZero, but I can’t connect:
2022-11-23 11:14:24.554 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting to 192.168.17.151:6607.
2022-11-23 11:14:24.555 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-11-23 11:16:35.389 WARNING (MainThread) [pymodbus.client.asynchronous.async_io] Failed to connect: [Errno 110] Connect call failed ('192.168.17.151', 6607)
2022-11-23 11:16:35.408 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Waiting 100 ms before next connection attempt.
2022-11-23 11:16:35.509 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-11-23 11:16:36.409 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2022-11-23 11:16:36.413 ERROR (MainThread) [huawei_solar.huawei_solar] Modbus client is not connected to the inverter.
NoneType: None
2022-11-23 11:16:36.414 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 157, in create
await huawei_solar._initialize()
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 120, in _initialize
self.time_zone = (await self.get(rn.TIME_ZONE)).value
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 254, in get
return (await self.get_multiple([name], slave))[0]
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 296, in get_multiple
response = await self._read_registers(
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 389, in _read_registers
result = await _do_read()
File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 151, in retry
ret = await target(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 354, in _do_read
raise ConnectionException(message)
huawei_solar.exceptions.ConnectionException: Modbus client is not connected to the inverter.
Any idea or suggestion? reading previous messages it should work…
@wlcrs Today I tested behaviour when inverters go to off-grid mode (with backup box). The integration fails, and the reason is that during off-grid mode, the grid power meter is offline. So integration fails at:
2022-11-23 17:04:47.207 ERROR (MainThread) [custom_components.huawei_solar] Unexpected error fetching HV2263421911_data_update_coordinator data: bad operand type for abs(): 'NoneType'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/huawei_solar/__init__.py", line 276, in _async_update_data
return await self.bridge.update()
File "/usr/local/lib/python3.10/site-packages/huawei_solar/bridge.py", line 203, in update
result.update(await _get_multiple_to_dict(POWER_METER_REGISTERS))
File "/usr/local/lib/python3.10/site-packages/huawei_solar/bridge.py", line 185, in _get_multiple_to_dict
zip(names, await self.client.get_multiple(names, self.slave_id))
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 312, in get_multiple
result.append(await self._decode_response(registers[idx], decoder))
File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 246, in _decode_response
result = reg.decode(decoder, self)
File "/usr/local/lib/python3.10/site-packages/huawei_solar/registers.py", line 200, in decode
return abs(super().decode(decoder, inverter))
TypeError: bad operand type for abs(): 'NoneType'
What I understand is it fails to read the registers from power meter, which is correct since it is offline.
_get_multiple_to_dict(POWER_METER_REGISTERS)
Can we handle this differently? Consider not reading POWER_METER_REGISTERS as non-critical and continue? It is safe to assume that when power meter is offline, all its readings should be considered as zero (0). Or maybe check and if status of inverter is off-grid, then don’t try to read the power meters? Both would work.
Hi Panagiotis, other owners of a backup box reported that the modbus connection was always being closed. Interesting to see that it behaves differently for you.
Can you please test this again with all logging enabled? cfr. bottom of README on GitHub - wlcrs/huawei_solar: Home Assistant integration for Huawei Solar inverters via Modbus. This will allow me to understand what is exactly happening. My guess is that pyModbus is returning a half-arsed answer that it got back from the inverter, which is impossible to decode correctly. I would like to understand what that half-arsed answer is, so that I can properly detect and reject it.
@wlcrs My installation is a bit complicated. I have three inverters, every one operating separately to one phase of my 3-phase grid connection. When grid is off, there is an automation done by the installer that connects 1/2 of my house installation to the 1st inverter, working in off-grid mode as a single-phase installation and the other 1/2 of my house to the 2nd inverter, also working as a single-phase installation when in off-grid mode. The 3rd inverter which also has battery is not used for backup (battery is only used for maximizing self-consumption).
On 1st inverter I have the s-dongle while on 2nd and 3rd inverters I don’t have the s-dongle. When 1st inverter switches to off-grid mode, modbus is still working (I checked with simple python script). When 2nd inverter (the one without s-dongle) switches to off-grid mode , it doesn’t respond to modbus requests. Port is still open but doesn’t respond. So to get modbus information when in off-grid mode, you need to have the s-dongle. My s-dongle now uses firmware V100R001C00SPC130.
I took a log but I think it will not help you because of the three inverters, the messages from the three integration sessions cannot be separated and you will get confused. But if you still want to check it, I can send it in your email. I plan to take a log with only the integration of 1st inverter enabled, I think this will help you better.
PS: In case anyone is wondering why I have this complicated setup and not bought a 3-phase inverter, the reason is that I wanted more power when in off-grid (backup) mode. With a 3-phase inverter, when you run in off-grid mode, you only have one phase of 3300 VA. Huawei’s backup box does not deliver 3-phase backup with a 3-phase inverter. With my setup, when going in off-grid mode, I have 1/2 of house with 5000 VA from 1st inverter and the rest of the house with another 5000 VA from the second inverter.