Integration Solar inverter huawei 2000L

@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.

I would open a warranty case with Huawei if it still doesn’t work when off-grid. There are other appliances that may still expect modbus data, not just home assistant (for instance, heat pumps).

I can’t test that case myself since I don’t have a backup box installed. If you have any info on how to safely put the inverters/battery in off-grid mode without a backup box, I’ll be glad to test it out as well.

pyModbus 3.0.0 was only released 9 days ago :sweat_smile:. I’ll look into updating the huawei-solar library to use this new version, as it also contains a fix for an issue that I had to monkeypatch to get the serial connection working reliably.

Hi Bert,

where do you configure the first part (the Riemann calc)?
is that under sensors?

I solved it with the previous version of the ABB integration, now the two integrations work side by side.

Hi guys, i’ve encountered a strange behavior, sometimes my battery charge sensor shoot an extremely high value that mess my energy dashboard… how can i prevent this to happen ?


Are you running the latest version of the integration? You are welcome to submit a bugreports, provided that you include logs from around a timestamp where such a spike occured. Make sure to enable all debug-logging as mentioned in the README

1 Like

yes, latest version of your integration (stable branch), and all the firmwares updated. i’m enabling the debug logging now