Integration Solar inverter huawei 2000L

Here is my configuration.yaml there is some mistake with sensor template which I can’t understand, but rest is working fine. I am connected via RPi4

sensor solar:
  - platform: huawei_solar
    host: '192.168.200.1'
    optimizers: false
    battery: false
template:
  - sensor:
    total_yield:
      friendly_name: "total yield"
      unit_of_measurement: 'kWh'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'total_yield') }}"

Here is my near final look

sensor solar:
  - platform: huawei_solar
    host: '192.168.200.1'
    optimizers: false
    battery: false
  - platform: template
    sensors:
      pv_input_power:
        friendly_name: "Solar Production"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'W'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'input_power') }}"
        
  - platform: template
    sensors:
      pv_daily_yield:
        friendly_name: "Daily Yield"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'daily_yield') }}"
   
  - platform: template
    sensors:
      pv_total_yield:
        friendly_name: "Total Yield"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'total_yield') }}"
        
  - platform: template
    sensors:
      pv_string_01_voltage:
        friendly_name: "Pv String 01 Voltage"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_01_voltage') }}"

  - platform: template
    sensors:
      pv_string_01_current:
        friendly_name: "PV String 01 Current"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_01_current') }}"
        
  - platform: template
    sensors:
      pv_string_02_voltage:
        friendly_name: "PV String 02 Voltage"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_02_voltage') }}"
        
  - platform: template
    sensors:
      pv_string_02_current:
        friendly_name: "PV String 02 Current"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_02_current') }}"
        
  - platform: template
    sensors:
      pv_active_power:
        friendly_name: "Power Meter Active Power"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'power_meter_active_power') }}"
        
  - platform: template
    sensors:
      consumption:
        friendly_name: "Consumption"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: '{{ states("sensor.sun2000_10ktl_m1") |float - states("sensor.pv_active_power") | float }}'
        
  - platform: template
    sensors:
      pv_device_status:
        friendly_name: "Device Status"
        #entity_id: sensor.sun2000_10ktl_m1
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'device_status') }}"

  - platform: template
    sensors:
      pv_string_02_power:
        friendly_name: "PV String 02 Power"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: '{{ states("sensor.pv_string_02_voltage") |float * states("sensor.pv_string_02_current") | float / 1000|round(2) }}'
        
  - platform: template
    sensors:
      pv_string_01_power:
        friendly_name: "PV String 01 Power"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: '{{ states("sensor.pv_string_01_voltage") |float * states("sensor.pv_string_01_current") | float / 1000|round(2) }}'

  - platform: template
    sensors:
      pv_efficiency:
        friendly_name: "Solar Efficiency"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: '%'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'efficiency') }}"

Do anyone have this working ???
I only get unknown

     m_grid_exporterd_energy:
       friendly_name: "Exported energy"
       unit_of_measurement: 'kWh'
       icon_template: mdi:transmission-tower
       value_template: "{{ state_attr('sensor.sun2000_15ktl_m0', 'grid_exporterd_energy') }}"
       value_template: "{{ state_attr('sensor.sun2000_15ktl_m0', 'grid_exporterd_energy') }}"

change to

       value_template: "{{ state_attr('sensor.sun2000_15ktl_m0', 'grid_exported_energy') }}"

Took me many times to read what the different was but super thanks :pray:

Hi all,
I have configured and have access to the sensor created by Emil’s custom component and I created sensor templates for many attributes as @yousaf465 do.
But I could not use any of them for the new Energy feature in HA.
Anyone has been able to use that way?

for that, you will need to you need to check @ligeza’s video or this link Integration Solar inverter huawei 2000L - #589 by yousaf465

I added template sensor like this:

sensor:
  - platform: template
    sensors:
      pv_total_yield:
        friendly_name: "Total Yield"
        unit_of_measurement: "kWh"
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'total_yield') }}"

And this:

homeassistant:
  customize_glob:
    sensor.pv_total_yield:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement

energy_sun2000

what I am doing wrong?

 pv_total_yield:
        friendly_name: "Total Yield"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'total_yield') }}"

and

      energy_used:
       friendly_name: "total energy used"
       unit_of_measurement: 'kWh'
       value_template: >
         {{ '%0.2f' | format(states('sensor.total_yield') | float - 
                            states('sensor.grid_exporterd_energy') | float + 
                            states('sensor.grid_accumulated_energy') | float) }}


After upgrade to 2021.9, the Energy stopped working. I had to change customize & template sensor to this:

sensors.yaml:

- platform: template
  sensors:
    solar_kwh:
      friendly_name: "Solar Energy"
      value_template: "{{ state_attr('sensor.sun2000_12ktl_m2', 'total_yield') }}"
      unit_of_measurement: "kWh"
      icon_template: mdi:solar-power
      device_class: energy

customize.yaml:

sensor.solar_kwh:
  unit_of_measurement: kWh
  device_class: energy
  last_reset: "1970-01-01T00:00:00+00:00"
  state_class: total_increasing
1 Like

Yes they changed total increasing.

@Emilv2 since a few days the inverter local access modbus gets hanged after 24h moreless. Even connecting by wifi is imposible. So a reboot is required. Maybe delaying requests could help, can you tell me how to change the python so that I can give a try? Thanks

Hi everyone,

I’ve been trying to integrate my Sun2000l system with Home Assistant Energy Management.

I’ve managed to get my system integrated with Home Assistant courtesy of @Emilv2 but now I’m confused about how to setup Energy Management. I’ve setup the Grid Production with @sakalauskas sensor. Theres still nothing on the dashboard but Home Assistant says that it can take 2 Hours for changes to occur.

But I’m confused on how to setup the Grid Consumption and Return to Grid parameters with the attributes available for me to use. I’m assuming that it’s asking for the total amount of energy used from the grid and total amount of energy returned to the grid over the day (or is it total?).

Would appreciate if someone could help me use the existing attributes to obtain these values.

The values I have available to me are:

model_id:
serial_number:
nb_pv_strings:
rated_power:
grid_standard:
grid_country:
daily_yield:
total_yield:
grid_voltage:
grid_current:
line_voltage_A_B:
line_voltage_B_C:
line_voltage_C_A:
phase_A_voltage:
phase_B_voltage:
phase_C_voltage:
phase_A_current:
phase_B_current:
phase_C_current:
day_active_power_peak:
reactive_power:
power_factor:
efficiency:
grid_frequency:
power_meter_active_power:
input_power:
grid_A_voltage:
grid_B_voltage:
grid_C_voltage:
active_grid_A_current:
active_grid_B_current:
active_grid_C_current:
active_grid_power_factor:
active_grid_frequency:
grid_exported_energy:
grid_accumulated_energy:
active_grid_A_B_voltage:
active_grid_B_C_voltage:
active_grid_C_A_voltage:
active_grid_A_power:
active_grid_B_power:
active_grid_C_power:
startup_time:
shutdown_time:
internal_temperature:
device_status:
nb_optimizers:
system_time:
pv_string_01_voltage:
pv_string_01_current:
pv_string_02_voltage:
pv_string_02_current:
unit_of_measurement:
friendly_name:

Thanks

I use HA Modbus and its the same… Since 2 says ago i need to restart because is stuck.

Note… Could it be after 2021.09…
Thanks

2021.6.5, i dont update since june… HA cant be the issue

here is my configuration.yaml

sensor solar:
  - platform: huawei_solar
    host: '192.168.200.1'
    optimizers: false
    battery: false
  - platform: template
    sensors:
      pv_input_power:
        friendly_name: "DC Production"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'W'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'input_power') }}"
        
  - platform: template
    sensors:
      pv_daily_yield:
        friendly_name: "Daily Yield"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'daily_yield') }}"

  - platform: template
    sensors:
      grid_exported_energy:
        friendly_name: "grid exported energy"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'grid_exported_energy') }}"
        
  - platform: template
    sensors:      
      energy_used_by_house:
        friendly_name: "energy used by house"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'grid_accumulated_energy') }}"
        
sensor total:
  - platform: template
    sensors:
      pv_total_yield:
        friendly_name: "Total Yield"
        unit_of_measurement: "kWh"
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'total_yield') }}"
        
      energy_used:
       friendly_name: "total energy used"
       unit_of_measurement: 'kWh'
       value_template: >
         {{ '%0.2f' | format(states('sensor.total_yield') | float - 
                            states('sensor.grid_exporterd_energy') | float + 
                            states('sensor.grid_accumulated_energy') | float) }}

        
  - platform: template
    sensors:
      pv_string_01_voltage:
        friendly_name: "Pv String 01 Voltage"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_01_voltage') }}"

  - platform: template
    sensors:
      pv_string_01_current:
        friendly_name: "PV String 01 Current"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_01_current') }}"
        
  - platform: template
    sensors:
      pv_string_02_voltage:
        friendly_name: "PV String 02 Voltage"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_02_voltage') }}"
        
  - platform: template
    sensors:
      pv_string_02_current:
        friendly_name: "PV String 02 Current"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'pv_string_02_current') }}"
        
  - platform: template
    sensors:
      pv_active_power:
        friendly_name: "Power Meter Active Power"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'power_meter_active_power') | float / 1000|round(2)  }}"
        
  - platform: template
    sensors:
      consumption:
        friendly_name: "Consumption"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: '{{ states("sensor.sun2000_10ktl_m1") |float - states("sensor.pv_active_power") | float }}'
        
  - platform: template
    sensors:
      pv_device_status:
        friendly_name: "Device Status"
        #entity_id: sensor.sun2000_10ktl_m1
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'device_status') }}"

  - platform: template
    sensors:
      pv_string_02_power:
        friendly_name: "PV String 02 Power"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: '{{ states("sensor.pv_string_02_voltage") |float * states("sensor.pv_string_02_current") | float / 1000|round(2) }}'
        
  - platform: template
    sensors:
      pv_string_01_power:
        friendly_name: "PV String 01 Power"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
        value_template: '{{ states("sensor.pv_string_01_voltage") |float * states("sensor.pv_string_01_current") | float / 1000|round(2) }}'

  - platform: template
    sensors:
      pv_efficiency:
        friendly_name: "Solar Efficiency"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: '%'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'efficiency') }}"

for energy dashboard these values are important.


  - platform: template
    sensors:
      pv_daily_yield:
        friendly_name: "Daily Yield"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'daily_yield') }}"

  - platform: template
    sensors:
      grid_exported_energy:
        friendly_name: "grid exported energy"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'grid_exported_energy') }}"
        
  - platform: template
    sensors:      
      energy_used_by_house:
        friendly_name: "energy used by house"
        #entity_id: sensor.sun2000_10ktl_m1
        unit_of_measurement: 'kWh'
        icon_template: mdi:transmission-tower
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'grid_accumulated_energy') }}"
        
sensor total:
  - platform: template
    sensors:
      pv_total_yield:
        friendly_name: "Total Yield"
        unit_of_measurement: "kWh"
        icon_template: mdi:solar-power
        value_template: "{{ state_attr('sensor.sun2000_10ktl_m1', 'total_yield') }}"
        
      energy_used:
       friendly_name: "total energy used"
       unit_of_measurement: 'kWh'
       value_template: >
         {{ '%0.2f' | format(states('sensor.total_yield') | float - 
                            states('sensor.grid_exporterd_energy') | float + 
                            states('sensor.grid_accumulated_energy') | float) }}

you have to change their attributes as described here Integration Solar inverter huawei 2000L - #589 by yousaf465. These instruction are for upto 2021.8.8, from 2021.9.x onward use

state_class: total_increasing 
1 Like

I’m just wondering if anyone elses attributes are sat stuck, specifically:

  • grid_exported_energy
  • grid_accumulated_energy

Mine have both just sat at 21474836.47 since day one, and wondered if there is a fix in the integration for this, or how it is supposed to be, or whether there is an issue with the invertor?

The Solar Fusion app shows grid export values.

There already was discussion about this:

1 Like

quick question - is your dongle TCP available 24h? Mine is going offline when inverter is in sleep mode, also consumption graphs are only available within inverter ‘working’ hours - I have KTL8-M0 model? has someone solution for this?


Here is inverters two day status. I don’t think night consumption data is available
.