Integration Solar inverter huawei 2000L

My integration works great, but i have an error in the logs:

Unexpected error importing huawei_solar/intent.py
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/integration_platform.py", line 50, in _async_process_single_integration_platform_component
    platform = integration.get_platform(platform_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.huawei_solar-main.intent'

…there is any file named intent.py… what it want?

I have a SUN2000-6KTL-L1 connected to a 6kw Luna battery pack.

using this code:

  - sensor:
      - name: energy_pv
        #friendly_name: "PV Energy"
        unique_id: "PV Energy"
        state: "{{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float)}}"
        device_class: energy      
        state_class: total
        unit_of_measurement: kWh
      - name: energy_pv_daily
        #friendly_name: "PV Energy daily"
        unique_id: "PV Energy daily"
        state: "{{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float)}}"
        device_class: energy
        state_class: total
        unit_of_measurement: kWh

The energy dashboard create this graph:

But as you can see there is a negative solar production during the night.

How can I solve this issue?

Hi!
Just want to know if someone has trouble with the huawei solar integration, that’s two days that doesn’t work at all. Already opened a bug issue on GitHub .

      - name: energy_pv
        unique_id: "PV Energy"
        state: "{{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float)}}"
        device_class: energy      
        state_class: total
        unit_of_measurement: kWh

Add this as a template and use it instead

Is there any solution for connecting two Huawei inverters to home assistant if a connection between them is in cascade? master is with a dongle which has wifi or LAN connection?

for now I can only see and read all data from master inverter and metar .Thanks

This is the same code that I posted.

Need a little bit of help.
One of my inverters constantly disables the IP integration so I do not have access (I think it my provider that monitor everything is doing something)

So I bought a EW11 and connected it following this guide: Connecting to the inverter · wlcrs/huawei_solar Wiki · GitHub

But I can’t get any data the integration fails to read data from the Inverter thru EW11.
When running QModMaster I can read register 30000 sometimes, I can have 4-5 timeouts then I get the values.

The setup is 2 inverters a battery and a backupbox connected to this ModBus.
If I try to read battery data 37762 I get it after a few tries.
Can I do anything to either set more tries or anything on the EW11 to get it working better

Log from the setup

Error setting up entry SUN2000-4KTL-L1 for huawei_solar
16:00:28 – (ERROR) Huawei Solar (custom integration)
Aborting client creation due to error.
16:00:28 – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py
Config entry 'SUN2000-4KTL-L1' for huawei_solar integration not ready yet: Failed to read register 30071 after 6 tries; Retrying in background
15:59:55 – (WARNING) config_entries.py - message first occurred at 15:03:09 and shows up 2 times
Giving up _do_read(...) after 6 tries (asyncio.exceptions.TimeoutError)
15:59:55 – (ERROR) Huawei Solar (custom integration) - message first occurred at 15:03:09 and shows up 8 times
Aborting client creation due to error.
15:16:53 – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py - message first occurred at 15:13:41 and shows up 5 times
Modbus client is not connected to the inverter.
15:16:53 – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py - message first occurred at 07:20:41 and shows up 6 times
Failed to connect:
15:16:52 – (WARNING) Huawei Solar (custom integration) - message first occurred at 15:14:19 and shows up 4 times
Failed to connect:
15:13:40 – (WARNING) Huawei Solar (custom integration)
Aborting client creation due to error.
15:04:20 – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py - message first occurred at 07:44:27 and shows up 8 times
Got error Failed to read register 47000 after 6 tries while trying to determine battery.
15:04:20 – (ERROR) /usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py
Failed to read register 43006 after 6 tries
14:58:31 – (ERROR) Huawei Solar (custom integration) - message first occurred at 07:44:27 and shows up 7 times
Giving up _do_read(...) after 6 tries (asyncio.exceptions.TimeoutError)
14:58:31 – (ERROR) Huawei Solar (custom integration) - message first occurred at 07:44:27 and shows up 7 times
Giving up _do_login(...) after 4 tries (asyncio.exceptions.TimeoutError)
07:40:16 – (ERROR) Huawei Solar (custom integration) - message first occurred at 18 September 2023 at 18:50:45 and shows up 2156 times
Timeout fetching HV2140011391_data_update_coordinator data
07:08:31 – (ERROR) Huawei Solar (custom integration)
Config entry 'SUN2000-4KTL-L1' for huawei_solar integration not ready yet: Failed to login after 4 tries; Retrying in background
18 September 2023 at 18:50:45 – (WARNING) config_entries.py

Hey all in the group. Just thought I’d report that I got the integration working OK. To me the dongle is extremely stable. Im sure it has a lot to do with your router rater than the dongle itself. This is my screen so far. Unfortunately I do not have usage metrics and return to grid metrics to report so this is it for now unless anyone has some suggestions. At this stage there is no point using HA energy tab. I plan to install the Huawei meter in the switchboard which should yield further metrics.

Thinking about it, the only thing I can add is you need to have an installers account when you log into the unit using the SUN2000 app. That’s the only place you can turn on the necessary levels to access Modbus data correctly I believe ar at least I couldn’t find them in the FusionSolar app.

EDIT: If you want rock solid performance after modifying any parameters with the SUN2000 app, make sure you go to Communications Settings/Router and enter the password to your router into the inverter again. That should guarantee rock solid performance.

6 Likes

Can you share this dashboard?

1 Like
Template:
- sensor:
    - name: "Active Power House"
      unique_id: "house_active_power"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >-
        {% set pvpower = states('sensor.input_power_with_efficiency_loss') | float %}
        {% set batterypower = states('sensor.power_meter_active_power') | float %}
        {% set meterpower = states('sensor.battery_charge_discharge_power') | float %}
        
         {{ (pvpower - batterypower - meterpower) | round(3) }}

This worked pretty well for my 2 inverters with the Dongle. My only problem is, that the sensor refresh is not synchronized:
After request of the sensor refresh it takes different times for Power Meter, Battery, Inverter 1 and Inverter 2.
This is a problem for my calculated “house active power” and for power indicated automations.
@wlcrs: Is there a solution to synchronize the refreshing?
I already tried to refresh via automation, but the refreshing takes different times for the inverters etc …

When setting up the integration you need to specify 2 IDs, separated by comma.

i.e. 1, 16 (or whatever your IDs are, usually master is 1).

I am using cable connection via Dongle and port is 502 as well.
However you need to access the inverter (or dongle) as Installer (use Sun 200 App, connect to WLAN of Dongle/Inverter), then enable Modbus TCP with all rights in order to use this integration.

1 Like

I am using Node-RED for my home automation. I already get the data from the solar system through the FusionSolar API. Now I want to be able to set the battery operation mode and switch between TOU and ‘maximum self consumption’ from the api.
I can not find any documentation to do so. How did you manage in HA ?

how to find which IDS is on the slave inverter ??? thanks

I think somewhere in the inverter configuration via Fusion you might see it.
I know several people that had 1 for master and 16 for slave. You might want to try that.

Thanks, finaly i set up all through the lan connection and now I see all data from inverter 1, inverter 2 and metar .

Yes you can see IDs when you connect with wifi directly to inverter.

nb 1 step is to Activate Unrestricted Modbus TCP mode in the settings for Dongle communication in the Inverter .

That is exactly what I did :slight_smile: My Master is ID 1 and the Slave ID 2.
Nevertheless, they are not refreshing in the same second, they are up to 10 seconds apart. That is the problem I like to fix :wink:

Can’t say I’ve noticed that tbh

Really like your dashboard, can you provide the yaml?