Integration Solar inverter huawei 2000L

No, it is not easily achievable to have both the integration and another device (like bliq) connect to the inverter, as both would want to act as a Modbus Master device.

You would need a Modbus RTU multiplexer that can support multiple masters for 1 slave device:

@wlcrs is there any public dashboard for Lovelace or grafana for the addon ?

@wlcrs
I have sometimes the following issue that the raspberry disconnect the connection to the inverter (Wi-Fi).
Connection is strong enough and I get the following error messages in the log do you know the issue


Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: huawei_solar.huawei_solar
Source: custom_components/huawei_solar/__init__.py:250 
Integration: Huawei Solar 
First occurred: 12:24:53 (1 occurrences) 
Last logged: 12:24:53

Could not read register value, has another device interrupted the connection?


Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py:344 
First occurred: 12:25:23 (53 occurrences) 
Last logged: 12:51:23

Modbus client is not connected to the inverter.
NoneType: None


Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.huawei_solar
Source: helpers/update_coordinator.py:151 
Integration: Huawei Solar 
First occurred: 12:09:07 (1 occurrences) 
Last logged: 12:09:07

Timeout fetching TA2240xxx data_update_coordinator data

1 Like

@unglazedswansea

I’m facing the same issue, and I’ve pinned it down to FusionSolar endpoint being down or an Internet connectivity outage.

When the plant can’t connect to the management system, modbus is not reachable.

I’ve posted a thread on Huawei forum, in case you want to comment there as well for visibility:

https://forum.huawei.com/enterprise/en/huawei/m/ViewThread.html?tid=1019116&lang=en&container=browser&navBar=1&isOpenAttach=1

3 Likes

@xploss
Thanks! It seems for me the same issue that you have also I am using also the EU region like you.

Can you update the post here when huawei is answering you ?

1 Like

Try to use a regular RS-485 for modbus. I noticed that the Dongle has a “recovery” algorithms and it it constantly trying to reboot itself when there is networking problems (and this of course leads to problems with integration).

2 Likes

After 3 days of testing via internal Raspberry Wifi 3 / Dongle Wifi I can say that this does not work reliably.

I have written an automation that notifies me when the WIFi connection to the dongle no longer exists.
Several times a day comes the message that it is no longer connected.
It only helps to restart Hassio or to connect manually again via GUI / SSH to the SUN Wifi.

Thus, it is not possible to get data properly via wifi, although the connection is stable!
There seems to be something that causes the disconnect automatically.

1 Like

@unglazedswansea @manio

Since I can’t easily reach the raspberry pi with an RS485 cable, I’m considering disconnecting the setup completely from FusionSolar.

That way, there should not be any failed connections that cause the dongle to restart. Plus, it will isolate the install from an external cloud that I don’t use anyway.

Short of resetting all devices, does anyone know how to disable FusionSolar management system?

1 Like

I have now implemented it as follows.
LAN cable in the dongle to the switch / router.
Normal IP address from the LAN Get and configured with the IP in Home Assistant the whole.
WIFI on the Raspberry PI deactivated.
This worked and did not require a Modbus converter / module.

I thought that does not work?!

1 Like

There are DNS names configured for the huawei cloud in the dongle/inverter which are accessible via FusionSolar/SUN2000 phone app:


You can probably disable it there as well because I can see a toggle-switch for this…

Full thread:
https://forum.huawei.com/enterprise/en/install-and-set-smart-dongle-on-sun2000-3-20ktl-m0/thread/606418-100027

3 Likes

Thank you! I’ll attempt this next weekend, and do a couple of cable pulls on the router, to see how the dongle behaves (whether it resets/shuts down modbus).

Edit: I wonder though if it’ll still connect to the WLAN when the remote management is disabled.

I’ll report back.

1 Like

Connected my Sun2000 to an exising HA docker instance succesfully via MQTT and openAPI with PyFusionSolarDataRelay modifications in the projects’ docker-compose, because I don’t need another MQTT server, Grafana and InfluxDB right now.
Unfortuantely I’m waiting for my FusionSolar developer account, so I can creat six mqtt entities “only”.
Btw: How often would it be possible to poll the openAPI?

version: '3'

services:
  pyfusionsolar:
    container_name: pyfusionsolardatarelay
    image: jsprnl/pyfusionsolardatarelay:latest
    restart: unless-stopped

    environment:
      - pvdebug=True

      - pvfusionsolar=True
      - pvfusionsolarkkid=XXXXXXXXXX
      - pvfusionminutecron=15

      - pvmqtt=True
      - pvmqtthost=XXXXXXXXXX
      - pvmqttauth=True
      - mqttuser: XXXXXXXXXX
      - mqttpasswd: XXXXXXXXXX

    volumes:
      - /etc/localtime:/etc/localtime:ro

MQTT entities example:

# Make sure to set  up the MQTT integration in hass integration settings for this to work
mqtt:
  sensor:
    - name: Solar power
      state_topic: energy/pyfusionsolar
      value_template: "{{ value_json['values']['realTimePower'] | int / 1000 }}"
      unique_id: pyfusion_solar_power
      device_class: power
      unit_of_measurement: "kW"
      icon: mdi:solar-power

    - name: Solar energy
      state_topic: energy/pyfusionsolar
      value_template: "{{ value_json['values']['cumulativeEnergy'] | int / 1000 }}"
      unique_id: pyfusion_solar_energy
      device_class: energy
      unit_of_measurement: "kWh"
      state_class: total_increasing
      last_reset_value_template: '1970-01-01T00:00:00+00:00'
      icon: mdi:solar-power-variant-outline

Why is that not possible to choose the sensor

sensor.inverter_input_power (Actual Production) in the Energy dashboard ?
I have some other that I can choose for example daily or total but not the right one that show the actual production.

@unglazedswansea
because it’s a power sensor. you have to convert the input power to energy trough Riemann helper (take in mind that’s not a 100% efficency)

Will this reset to 0 every night?

As promised, reporting back!

PSA: if you already have Huawei inverters integrated with Home Assistant, DISCONNECT them from FusionSolar.

This is achieved as proposed above by @manio, going through the quick settings once everything has been configured, and disabling remote monitoring.

WLAN details will show as greyed out, but the inverter will remain connected to the previously set-up WiFi.

This effectively isolates your install, making it resilient against Internet outages or FusionSolar servers being down, as now Modbus will continue to report data even if the inverters can’t reach Huawei’s servers (the way it was meant to work, and Huawei doesn’t seem to like).

Local integration FTW :slight_smile: .

2 Likes

Unfortunately, there is still the issue of not being able to connect via modbus when in off grid mode :frowning:

Hello
I installed wlcrs/huawei_solar integration from HACS. But I can’t configure it because it says this

huawei_solar_error

This is what you can see from the log.

2022-10-20 19:03:03.046 WARNING (MainThread) [pymodbus.client.asynchronous] Importing deprecated clients. Dependency Twisted is Installed
2022-10-20 19:03:03.070 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.huawei_solar.config_flow
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/loader.py”, line 722, in get_platform
cache[full_name] = self._import_platform(platform_name)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 739, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File “/usr/local/lib/python3.10/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 992, in _find_and_load_unlocked
File “”, line 241, in _call_with_frames_removed
File “”, line 1050, in _gcd_import
File “”, line 1027, in _find_and_load
File “”, line 1006, in _find_and_load_unlocked
File “”, line 688, in _load_unlocked
File “”, line 883, in exec_module
File “”, line 241, in call_with_frames_removed
File “/config/custom_components/huawei_solar/init.py”, line 18, in
from huawei_solar import HuaweiSolarBridge, HuaweiSolarException, InvalidCredentials
File “/usr/local/lib/python3.10/site-packages/huawei_solar/init.py”, line 6, in
from .bridge import HuaweiSolarBridge # noqa
File “/usr/local/lib/python3.10/site-packages/huawei_solar/bridge.py”, line 22, in
from huawei_solar.huawei_solar import AsyncHuaweiSolar, Result
File “/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py”, line 14, in
from pymodbus.client.asynchronous.async_io import (
File “/usr/local/lib/python3.10/site-packages/pymodbus/client/asynchronous/async_io/init.py”, line 9, in
from pymodbus.client.asynchronous.mixins import AsyncModbusClientMixin
File “/usr/local/lib/python3.10/site-packages/pymodbus/client/asynchronous/mixins.py”, line 2, in
from pymodbus.client.sync import BaseModbusClient
File “/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py”, line 180, in
class ModbusTcpClient(BaseModbusClient):
File “/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py”, line 184, in ModbusTcpClient
def init(self, host=‘127.0.0.1’, port=Defaults.Port,
AttributeError: type object ‘Defaults’ has no attribute ‘Port’
2022-10-20 19:03:03.076 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration huawei_solar: Exception importing custom_components.huawei_solar.config

flow

Could you help me where the error could be?

The PyModbus library (on which this integration depends) seems to be in a corrupted state. You’ll need to try to reinstall it to fix it. The following command can reinstall that dependency:

pip install --reinstall pymodbus==2.5.3

I found the error, an ABB inverter reader is installed, which requires pymodbus==3.0.0, and the two integrations do not work at the same time.