Integration Solar inverter huawei 2000L

I’m not sure, is the script actually requesting that value?

How do you connect to the CLI? I have my RPi connected to the WiFi of the inverter but I have no clue how to connect to the modbus…

Basically this is my schema of connectivity:
Inverter is connected to my home network via wifi, they has the 192.168.1.x ip address.
I installed home assistant on my pi4 on docker with huawei solar script. The command that i launched on the previous screen is from cli of home assistant container.
The question is: why the battery data is not available among the sensor attributes?

After update, (reinstal from custom HACS), inverter data is not show. I check inverter connection:

in configuration.yaml I use:

sensor:
  - platform: huawei_solar   
    host: '192.168.200.1'
    optimizers: false
    battery: false

  - platform: template
    sensors:
      pv_01_voltage:
        friendly_name: "Tensiune String 1"
        unit_of_measurement: 'V'
        icon_template: mdi:flash-circle
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'pv_string_01_voltage') }}"

      pv_02_voltage:
        friendly_name: "Tensiune String 2"
        unit_of_measurement: 'V'
        icon_template: mdi:flash-circle
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'pv_string_02_voltage') }}"

      pv_01_current:
        friendly_name: "Curent String 1"
        unit_of_measurement: 'A'
        icon_template: mdi:current-dc
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'pv_string_01_current') }}"

      pv_02_current:
        friendly_name: "Curent String 2"
        unit_of_measurement: 'A'
        icon_template: mdi:current-dc
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'pv_string_02_current') }}"

      phase_a_voltage:
        friendly_name: "Faza 1 V (panouri)"
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'phase_A_voltage') }}"

      phase_b_voltage:
        friendly_name: "Faza 2 V (panouri)"
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'phase_B_voltage') }}"

      phase_c_voltage:
        friendly_name: "Faza 3 V (panouri)"
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'phase_C_voltage') }}"

      m_grid_a_voltage:
        friendly_name: "Faza 1 V (retea)"
        unit_of_measurement: 'V'
        icon_template: mdi:flash-alert-outline
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'grid_A_voltage') }}"

      m_grid_b_voltage:
        friendly_name: "Faza 2 V (retea)"
        unit_of_measurement: 'V'
        icon_template: mdi:flash-alert-outline
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'grid_B_voltage') }}"

      m_grid_c_voltage:
        friendly_name: "Faza 3 V (retea)"
        unit_of_measurement: 'V'
        icon_template: mdi:flash-alert-outline
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'grid_C_voltage') }}" 

      phase_a_current:
        friendly_name: "Faza 1 A (retea)"
        unit_of_measurement: 'A'
        icon_template: mdi:current-ac
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'phase_A_current') }}"

      phase_b_current:
        friendly_name: "Faza 2 A (retea)"
        unit_of_measurement: 'A'
        icon_template: mdi:current-ac
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'phase_B_current') }}"

      phase_c_current:
        friendly_name: "Faza 3 A (retea)"
        unit_of_measurement: 'A'
        icon_template: mdi:current-ac
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'phase_C_current') }}"

      pv_input_power:
        friendly_name: "Productie PV"
        unit_of_measurement: 'W'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'input_power') }}"

      power_meter_active_power:
        friendly_name: "Export"
        unit_of_measurement: 'W'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'power_meter_active_power') }}"
 
      active_grid_a_power:
        friendly_name: "Putere activa A"
        unit_of_measurement: 'W'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'active_grid_A_power') }}"
 
      active_grid_b_power:
        friendly_name: "Putere activa B"
        unit_of_measurement: 'W'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'active_grid_B_power') }}"
 
      active_grid_c_power:
        friendly_name: "Putere activa C"
        unit_of_measurement: 'W'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'active_grid_C_power') }}"
 
      m_grid_exporterd_energy:
        friendly_name: "Energia exportata"
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'grid_exporterd_energy') }}"
 
      m_grid_accumulated_energy:
        friendly_name: "Energia acumulata"
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'grid_accumulated_energy') }}"

      daily_yield:
        friendly_name: "Productia zilnica"
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'daily_yield') }}"

      total_yield:
        friendly_name: "Productia totala"
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'total_yield') }}"

      pv_temperatura:
        friendly_name: "Temperatura interna"
        unit_of_measurement: '°C'
        value_template: "{{ state_attr('sensor.sun2000_5ktl_m1', 'internal_temperature') }}"   

      pv_efficiency:
        friendly_name: "Eficienta"
        unit_of_measurement: '%'
        icon_template: mdi:percent-outline
        value_template: >
          {% if state_attr('sensor.sun2000_5ktl_m1', 'efficiency')|float < 100 %}
            {{ state_attr('sensor.sun2000_5ktl_m1', 'efficiency') }}
          {% else %}
            0
          {% endif %}

      energy_used:
        friendly_name: "Energia utilizata"
        unit_of_measurement: 'kWh'
        icon_template: mdi:flash-auto
        value_template: >
          {{ '%0.2f' | format(states('sensor.total_yield') | float - 
                              states('sensor.m_grid_exporterd_energy') | float + 
                              states('sensor.m_grid_accumulated_energy') | float) }}

Help please :slight_smile:

1 Like

The soc modbus location is at 37004

    - name: State of charge
      hub: solar
      unit_of_measurement: '%' 
      count: 1
      register: 37004
      data_type: uint
      scale: 0.1
      precision: 0

Amazing, where did you find it?
Thank you so much.

There’s updated modbus documentation by Huawei not published… you can ask it to huawei support and they will share it.

Hi guys, I’m back :slight_smile: I will look at some issues and try to fix them.

@everyone having issues connecting the app and Modbus at the same time when using the dongle, apparently there is a firmware update you can get from Huawei that fixes this: Reading data from Huawei inverter SUN 2000 (3KTL-10KTL) via modbus TCP and RTU - #83 by Rado1 - Tutorials & Examples - openHAB Community

2 Likes

Can you share the source?
This work for me but i don’t find the register value in my document.

I’ve got a SUN2000-KTL6-L1 it connects to my network to upload data and I can access it fine over my network without using its wifi hotspot.
But it seems to run into problems after a while and it stops being able to connect to the inverter until home assistant is restarted.
Also if you restart while it is running ok there is a good chance it will fail to connect after the restart.
Maybe a connection is getting left open and the inverter won’t allow anything else to connect?

The same happens to me during last 1-2 months, while never I saw it previously.
I have a SUN2000L-5KTL WiFi connected to a WiFi repeater positioned close to the inverter.

Make sure you or anyone else is not using the Huawei app. You can only connect one client at a time to the inverter

anyone having issue after 2021.7.2 update?

2021-07-15 14:54:02 ERROR (MainThread) [homeassistant.components.sensor] huawei_solar: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 432, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 601, in async_device_update
await task
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/huawei_solar/sensor.py”, line 289, in update
self._grid_exporterd_energy = self._inverter.get(“grid_exporterd_energy”).value
File “/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py”, line 262, in get
reg = REGISTERS[name]
KeyError: ‘grid_exporterd_energy’

Hi all, only for update.
I have made the following changes to display the battery status without modbus:
nano /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py
“battery_status”: RegisterDefinitions(“u16”, “W”, 10, 37004, 1)

nano /homeassistant/config/custom_components/huawei_solar/sensor.py
ATTR_BATTERY_STATUS = “battery_status”
ATTR_BATTERY_STATUS: self._battery_status
self._battery_status = self._inverter.get(“battery_status”).value

nano /homeassistant/config/configuration.yaml
stato_batteria:
friendly_name: “SOC Batteria”
unit_of_measurement: “%”
icon_template: mdi:battery-charging-10
value_template: “{{ state_attr(‘sensor.sun2000_6ktl_l1’, ‘battery_status’) }}”

This is the output:
Schermata 2021-07-15 alle 09.39.57

I released a new version of the library which changes some register names but accidentally made it not alpha so on a reinstall/update you will install the new version. I will release a new version of the custom component that fixes this today or tomorrow. For now you can change the requirements to huawei-solar>=0.1.0,<1.0.0 as a workaround.

Thank you. I do not know that much. Can you provide how to change the requirements?

Edit manifest.json in custom_components/huawei_solar/ and replace "huawei-solar>=0.1.0" with " "huawei-solar>=0.1.0,<1.0.0"`

works for me now. Thank you.

have this setup " huawei-solar>=0.1.0,<1.0.0"`

but on core core-2021.7.3 not working .thanks

hm now all working.thanks