Integration Solar inverter huawei 2000L

New release: v1.1.4

New Features

Bugfixes

  • Always enable ‘advanced permissions’ when connecting over serial
  • Handle Timeout as a retry-able error during integration setup
  • Upgrade backoff dependency
  • try to fix erroneous readings by checking number of received registers

Other

  • Automatically retry operation when an “Abnormal Slave Response” ModBus error message is received
1 Like

Hi,

I can’t conect with my HA to my Huawei KTL30M3.

I got always: Reading from the inverter failed.
I use the IP from my inverter in my home network
I use ID: 0 , 1 or 2
Modbus is activate and the Port 502 is open.

Can anybody help me please?



hi @wlcrs can you add this sensor to your integration? maybe it calculate remaining time in min. (before End-of-discharge) when Luna switch to “back-up mode” (in case of power outage), many thanks again 4 your great work :wink:

This value is not exposed over Modbus, sorry. I guess you can compute it from the values already exposed by the integration?

1 Like

ok many thanks, I think as below maybe work ok (in backup mode or grid connected I think battery discharge will be the same :grin: ):

####################### Battery Time Left Till End Discharge ######################################
template:
  - sensor:
      - name: "Battery Power Left"
        unique_id: battery_power_left
        unit_of_measurement: "kW"
        state: >-
          {% set inpower = states('sensor.charge_discharge_power')|float(2) %}
          {% if inpower < 0 %}
            {{ (inpower * -1) / 1000 }}
          {% else %}
            {{ '%.2f' | format(states('sensor.average_kw_discharged_from_battery_last_24_hour') | float / 1000 ) }}
          {% endif %}
  - sensor:
      - name: "Luna2000 Time Left To End Disc."
        unique_id: battery_time_left
        state: >-
          {% set percent = states('sensor.battery_state_of_capacity') | float(1) /100 %}
          {% set energy = 20.0 %}
          {% set reserve = 0.1 %}
          {% set charge = (percent - reserve) * energy %}
          {% set current_power = states('sensor.battery_power_left') | float(0) %}
          {% set decimal_hours = charge / current_power %}
          {% set minutes = (decimal_hours % 1 * 60) | round(0) %}
            {{ decimal_hours | int(0) ~ 'h ' ~ minutes ~ 'min' }}

# average of discharge in last 24h
sensor:
  - platform: statistics
    name: "Average kW discharged from Battery Last 24 Hour"
    entity_id: sensor.power_batt_disch_kwp
    state_characteristic: mean
    max_age:
      hours: 24
    sampling_size: 7200
    precision: 3

3 Likes

Hello everybody

One question, but now the wired network connection doesn’t work anymore?

Do I have to connect via modbus to get back to receiving data?

New release: v1.1.6

Bugfixes

  • Fix regression for inverters that don’t support optimizers
  • Fix missing unique_id for working mode select entity (which was botched in 1.1.5)

New Features

  • Add “Excess PV energy use in TOU” select entity

Thank you!

A big thanks to all my current and past sponsors. Your contributions keep me motivated to maintain this integration to a high standard! :heart:

5 Likes

Hello,
I have a new Huawei SUN2000-6KTL-1, I am using Huawei FusionSolar Android App to setup and configure inverter. The inverter integrated WiFi is configured and connected to my house WiFi.

Firmware is updated (software version V200R001C00SPC124 and MBUS firmware is to V100R001C00SPC320). Modbus TCP is enabled unrestricted. The installer password is set.

I can open TCP connection from computer to port 6607. Slave ID is 1. Additional Huawei power sensor is connected and visible in the app.

After HACS and wlcrs/huawei_solar installation. I am unable to initially connect - “Reading from the inverter failed” . In logs I see:

logger: custom_components.huawei_solar.config_flow
Source: custom_components/huawei_solar/config_flow.py:114
Integration: huawei_solar

Could not read register value, has another device interrupted the connection?
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py”, line 356, in _do_read
response = await self._client.protocol.read_holding_registers(
File “/usr/local/lib/python3.10/site-packages/pymodbus/client/asynchronous/async_io/init.py”, line 35, in execute
resp = await asyncio.wait_for(req, timeout=self._timeout)
File “/usr/local/lib/python3.10/asyncio/tasks.py”, line 445, in wait_for
return fut.result()
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Connection lost during request

What other devices / connections is possible to have / how to disable them?
Should I disable Huawei cloud connection inside FusionSolar app (“Management System” connection to EU / global servers)?
I can use the mobile app and device commissioning as installer with password on the same/home network. If this “device commissioning” needs to be disabled, how to do it?

Are you connecting to the inverter hotspot?
It Only accepts one connection

today after instaling Home Assistant 2022.11.0 ,Huwai solar integration stop working .all time in log I received this message :Logger: homeassistant.setup
Source: setup.py:184
First occurred: 10:43:27 AM (1 occurrences)
Last logged: 10:43:27 AM

Setup failed for custom integration huawei_solar: Requirements for huawei_solar not found: [‘huawei-solar==2.0.1’].

:warning: UPDATE REQUIRED: Home Assistant 2022.11 and above requires you to update to v1.1.6 of this integration :warning:

(sorry for the shouting, but I expect a lot of these reports popping up in the upcoming days/weeks).

6 Likes

did you mean version 1.1.6 ??? oh all works now like charm after update .thanks

1 Like

Hi, with this method do you have some errors by HA? In particular fetching data errors from update_coordinator.

New firmwares updates from Huawei

Thanks for the notification. I read diagonally through the updated modbus definitions in the release notes, but it contains little news. The only noteworthy thing is that a few new battery operating modes were added, which all seem related to the ‘EMMA’ AI thingy from Huawei. I haven’t seen EMMA appear in the FusionSolar webinterface of my inverter, so I’m unable to test it.

1 Like

Recently swapped over to your integration @wlcrs - nice work!
Decided to swing you some sponsor love, as should everybody else on this thread gaining from your efforts :wink:

Everything works perfectly other than a strange issue I’m seeing in my Influx/Grafana logging…
My brain has always preferred to see instantaneous active power usage vs kWh, so a basic formula gives me the figure I like to see on my dashboards:

      huawei_house_usage:
        friendly_name: "Huawei House Active Power Usage"
        value_template: "{{ (states('sensor.inverter_active_power') | float) - (states('sensor.power_meter_active_power') | float) }}"

What I’ve found since swapping to your integration are small transient figures logged as negative.
This is obviously impossible!
I believe this is due to the fact there are now two ‘devices’, and the small fraction of a time difference between both devices ‘reporting’ is causing bogus information to be logged in the template resultant figure.


(hanging out for these sporadic clouds to bugger off haha!)

Any ideas how I can combat this? I thought of rejecting negative figures in my fluxdb query but I’ve seen errors above zero as a result of the formula too.

Cheers!

2 Likes

Thank you for sponsoring! Greatly appreciated! :heart:

W.r.t. your question: the power meter is connected to the inverter via a secondary modbus, shared with any batteries and daisy chained inverters that are present in your installation. This means that reading from the power meter is not instantaneous. I expect that these (small) delays can lead to the anomalies you are seeing.

I would just filter these negative values away, and treat those instantaneous values with the necessary caution. The accumulative kWh counters will be more useful for long term statistics.

1 Like

@wlcrs
do you think RS485 connection is more reliable than a wiredDongle as @manio say in his post ?

I have a wired Dongle, why even if i have setted up a polling time of 30s , i have some fetching error from data update coordinator ?
gist:252688eff820f0d7aaf7e3b458dd90ed (github.com)
it’s really annoiyng because the integration stop to work a lot of time during a day as you can see here, that’s normal ?

I’ve noticed that sometime i lost the connection to the remote management system (from SUN2000app ) but that’s not related to my connection that i constantly monitor…in your opinion, that can be related to my fetching errors?
I’m also refering to @unglazedswansea and @xploss with their post

I have no opinion on this as I do not own an SDongle and do not use the serial pins to connect to my inverter in practice.

Note that you cannot use the serial pins and the SDongle at the same time: there are several reports of constant interruptions of the serial connection in that case.

1 Like

Hello, my first post here. I haven’t yet configured home assistant, still reading to prepare. But I have found something I wanted to share with you.
As you know, recent inverter firmware has blocked the modbus tcp port from local lan access and is only available when connecting to the wifi access point of inverter (SUN2000…). I don’t know if what I am reporting was working before or if it works for all models, but it does work for me and inverter SUN2000-5KTL-L1 with firmware V200R001C00SPC124 (latest). Using latest android fusionsolar app (version is 6.23.00.125) you can enable again modbus tcp from local lan access. Go to device commissioning, connect to your inverter (needs installer password), then go to Settings → Communication configuration → Router connection settings. Then, select your local wifi access point, enter your password and check the option “Local Oamp;M”, then click Connect. It will reconnect to your access point, but this time port 6607 is open on local lan. If you revisit the same configuration page, the option seems it is disabled, but port is indeed open (and works, I tested and got data).
I attach a photo taken from the phone (for some reason android screen capture was disabled in this menu) to see the option.
Local Oamp;M should have been Local O&M actually but some text translation failed. O&M stands for “Operation and Maintenance”.
Hope this helps others.

5 Likes