Sorry but i can’t understand how the connection to the inverter AP is managed by Homeassistant… Do you have to connect Raspberry with wifi to the inverter AP and with LAN to the home router atthe same time? This point is not clear to me…
Thanks .all works like charm.regards
Connect rasbbery PI to internal inverter AP, add integration and that should work.
@ligeza Rafał czy to o czym piszesz pozwala wreszcie połączyć się z inwerterem przez podpięcie kabla do dongla w inwerterze?
a jeśli tak, to tę konfigurację modbus trzeba wrzucić do configuration.yaml?
Dokładnie tak, to pozwala podłączyć się poprzez kabel LAN wpięty do dongla. W powyższym przykładzie podane są dwie możliwości takiego połączenia używając integracji huawei_solar lub używając modbus. Sama konfiguracja w przypadku integracji huawei_solar się nie zmienia i jest już opisana, jedynie trzeba dodać unit=1 wodpowiednim pliku czyli huawei_solar.py. W drugim przpadku czyli używając integracji modbus należy dodać slave:1 tak jak jest to podane powyżej. Oczywiście tak jak było już wspominane należy mieć w dongle firmware z końcówką 120, ale podobno wykryte zostały w nim jakieś bugi i go nie udostępniają, a poprawiona wersja nie wiadomo kiedy będzie.
Hello, I have it like this and it works for me.
# Inversor 1
- platform: huawei_solar
host: '192.168.0.185'
optimizers: false
battery: false
# Inversor 2
- platform: huawei_solar
host: '192.168.0.187'
optimizers: false
battery: false
Being the same model, they appear as “sensor.sun2000l_4ktl” and “sensor.sun2000l_4ktl_2”
The only problem is that when I restart HA, the sensors are swapped.
That is, everything that appears as investor1 is actually investor2.
And conversely, random on every HA reboot.
I have not found a solution …
Hi Folks,
is it possible to have multiple “Masters”?
I have a HA Dev/Test and a PROD environment. It appears that the Emilv2 integration plugin works fine in the PROD environment, but not in Dev/Test. I keep getting this error message:
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:174
First occurred: 2:58:49 PM (1 occurrences)
Last logged: 2:58:49 PM
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 174, in execute
response, last_exception = self._transact(
File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 293, in _transact
result = self._recv(response_length, full)
File "/usr/local/lib/python3.8/site-packages/pymodbus/transaction.py", line 325, 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.x.x:502): Connection unexpectedly closed 0.010403 seconds into read of 8 bytes without response from unit before it closed connection
Note: above IP has been masked for this post.
The huawei_solar component is installed via HACS and the latest update is installed.
My current HA is running OS 6.0, Core is 2021.6.4, Supervisor: 2021.06.0
Both PROD and Dev/Test are in the same subnet, and yes I can ping the inverter/dongle from the Dev/Test sever.
Configuration file for the huawei _solar is as follow:
sensor:
- platform: huawei_solar
host: 192.168.x.x # purposely masked for this post
optimizers: false
battery: false
Could it be that the current Emilv2 component does not support a multi-Master to single slave?
Thanks heaps for your help.
@ligeza Rafał problem polega na tym że nie mam w tej integracji pliku huawei_solar.py, są tylko takie jak domyśnie:
Bo to nie jest plik z integracji. Jest to biblioteka (lub jakkolwiek się to nazywa) potrzebna do działania integracji i instluje się ona (jeśli nie jest już w systemie) przy uruchomieniu HA. U mnie ten plik znajduje się w “\root\hass\lib\python3.9\site-packages\huawei_solar”
Hello,
I’ve just recent installed a huawei solar inverter.
Installed custom component integration via HACS.
And it worked for less than 30 minutes. After that it, stop give updates and after reset H.A shows the following error:
Detalles de registro (ERROR)
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:174
First occurred: 19:22:26 (1 occurrences)
Last logged: 19:22:26
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 108, in execute
raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.XXX.XXX:502)]
The tcp ip client is correct, checked and ping it.
Any clue?
Thank you!!
Hi there,
I have a similar error message, that is when I try to have two HA trying to connect to the same inverter. I think the Huawei modbus tcp is not a true modbus tcp connection as it appears to allow only 1 master (Home Assistant) to a client/slave (the inverter). I have even tried having my 2nd HA using the internal modbus platform rather than through the huawei_solar component, but the inverter likewise refuses the connection. I also observed that connecting to the inverter wifi also fails or timeout if the inverter is also already connected to HA.
This leads to my conclusion that the Huawei modbus tcp implementation is more like RTU over tcp rather than true TCP (which should be stateless) and thus allowing multiple masters.
I wonder if you have a similar issue or my understanding of modbus correct.
I’ll reply to myself.
Yes, Huawei inverter only accepts one TCP connection isn’t is a integration limitation.
Somtimes(like my case) this connection fails, but huawei inverter doesn’t close the connection, and you aren’t able to reconnect with it, until you switch off and switch on completly the inverter unit.
Then, if H.A log shows something like this:
...
raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: **Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.XXX.XXX:502)**]
And ip’s are correct and you previously get comunication with inverter. You need to restart it
Thank you
I’m using this integration over one year and never had any problems like you. Inverter as you said can accept only one tcp connection so if HA is connected to inverter then there is no possibility to use fusionsolar app locally and connect directly to router. Inverter after disconnecting should and connection in few seconds. How are you connecting to huawei? Do you use HA core or supervised? Did you try modbus integration?
Connect fusion solar locally could be the problem, because the installer was at my home doing some changes and check it with laptop and probably ises the local connection.
Could be this.
Thank you!!
Hi Guys
I did managed to have to HACS integration running and it’s reading data. But I can’t figure out the values, what I want to achieve is to read following data:
- Current generated power from the sun panels
- Daily yield
- Month yield
- Total yield
- House load
- Grid import
- Grid expotr
Who can help me?
This is the data I get:
model_id: 346
serial_number: XXXXXXXXXXXX
nb_pv_strings: 2
rated_power: 4000
grid_standard: C10/11
grid_country: XXXXX
daily_yield: 14.67
total_yield: 1945.63
grid_voltage: 236.8
grid_current: 12.65
line_voltage_A_B: 236.8
line_voltage_B_C: 0
line_voltage_C_A: 0
phase_A_voltage: 212.9
phase_B_voltage: 0.3
phase_C_voltage: 0
phase_A_current: 12.65
phase_B_current: 0
phase_C_current: 0
day_active_power_peak: 4400
reactive_power: 0
power_factor: 1
efficiency: 97.95
grid_frequency: 49.98
power_meter_active_power: 2798
input_power: 3042
grid_A_voltage: 234.1
grid_B_voltage: 1.1
grid_C_voltage: 235.8
active_grid_A_current: -1.07
active_grid_B_current: 12.87
active_grid_C_current: 12.34
active_grid_power_factor: -0.879
active_grid_frequency: 49.97
grid_exported_energy: 1393.18
grid_accumulated_energy: 464.35
active_grid_A_B_voltage: 234.6
active_grid_B_C_voltage: 236.3
active_grid_C_A_voltage: 406.8
active_grid_A_power: -115
active_grid_B_power: 2
active_grid_C_power: 2899
startup_time: '04:31:44'
shutdown_time: '21:00:35'
internal_temperature: 46.2
device_status: On-grid
nb_optimizers: 0
system_time: '2021-06-17T13:36:38+00:00'
pv_string_01_voltage: 229.3
pv_string_01_current: 6.64
pv_string_02_voltage: 229.6
pv_string_02_current: 6.58
unit_of_measurement: W
friendly_name: SUN2000-4KTL-L1
icon: mdi:solar-power
Thanks
>> EDIT: Found it in comments above… so nevermind
Check this post
Hello
I have a problem with integration. I am connected to the built-in AP in the inverter and can ping. I am getting the following errors, what could be the cause?
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:188
First occurred: 11:23:20 (1 occurrences)
Last logged: 11:23:20
could not read register value, is an other device already connected?
Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:124
Integration: Sensor (documentation, issues)
First occurred: 11:23:20 (1 occurrences)
Last logged: 11:23:20
Error while setting up huawei_solar platform for sensor
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.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 189, in read_register
raise ReadException(message)
huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?
I think you can only connect to the inverter with 1 device at a time. So if you are already connected with the AP via your mobile phone, HA would not be able to connect to it. So ensure nothing is connected to the inverter AP when your HA tries to connect to the inverter.
Yes I agree.
I had this same problem and thought it was the integration not working, but it’s when you have the app open, the HA client won’t connect.
Conversely, now when I try to connect via my phone and app to the inverter, I get an error message “the device is already connected”
Doesn’t bother me though, I have all the info I need in HA.
So, for what it’s worth, I did not need any RPi bridge, I just used the FusionSolar app to connect the inverter to my local wifi and then added it to HA.
I disconnected the app and restarted HA and things just worked.
Via smartdongle no HA cannot connect to inverter, connection error on port 502. Via built-in AP I am connected but cannot read information. Nothing is connected to the inverter but HA. It does not work after restarting the inverter. Restoring the inverter to the factory settings did not help eithe
If you continue to have an issue, you might want to try the FusionSolar Kiosk HACS addon: