Integration Solar inverter huawei 2000L

The configuration is wrong, just read how template sensor sould look like:

sensor:
  - platform: template
    sensors:
      solar_angle:
        friendly_name: "Sun angle"
        unit_of_measurement: "degrees"
        value_template: "{{ state_attr('sun.sun', 'elevation') }}"

      sunrise:
        value_template: "{{ state_attr('sun.sun', 'next_rising') }}"

So after

sensor:
  - platform: template
    sensors:

you are adding all template sensor like in example.
As I said I’m using new format for template sensor and in configuration.yaml I added

template: !include template.yaml

to have all this sensors in separate file and in template.yaml I have:

  sensor:
    - name: "String 1 napięcie"
      unique_id: pv_01_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_01_voltage') | float(0) }}"

    - name: "String 2 napięcie"
      unique_id: pv_02_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_02_voltage') | float(0) }}"

    - name: "String 1 natężenie"
      unique_id: pv_01_current
      unit_of_measurement: 'A'
      icon: mdi:current-dc
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_01_current') | float(0) }}"

    - name: "String 2 natężenie"
      unique_id: pv_02_current
      unit_of_measurement: 'A'
      icon: mdi:current-dc
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_02_current') | float(0) }}"

    - name: "Faza 1 V (f)"
      unique_id: phase_a_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: >
        {% if state_attr('sensor.sun2000_8ktl_m0', 'phase_A_voltage') | float(0) > 180 and state_attr('sensor.sun2000_8ktl_m0', 'phase_A_voltage')|float(0) < 264 %}
          {{ state_attr('sensor.sun2000_8ktl_m0', 'phase_A_voltage') }}
        {% else %}
          {{ state_attr('sensor.sun2000_8ktl_m0', 'grid_A_voltage') }}
        {% endif %}

    - name: "Faza 2 V (f)"
      unique_id: phase_b_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: >
        {% if state_attr('sensor.sun2000_8ktl_m0', 'phase_B_voltage') | float(0) > 180 and state_attr('sensor.sun2000_8ktl_m0', 'phase_B_voltage')|float(0) < 264 %}
          {{ state_attr('sensor.sun2000_8ktl_m0', 'phase_B_voltage') }}
        {% else %}
          {{ state_attr('sensor.sun2000_8ktl_m0', 'grid_B_voltage') }}
        {% endif %}

    - name: "Faza 3 V (f)"
      unique_id: phase_c_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: >
        {% if state_attr('sensor.sun2000_8ktl_m0', 'phase_C_voltage') | float(0) > 180 and state_attr('sensor.sun2000_8ktl_m0', 'phase_C_voltage')|float(0) < 264 %}
          {{ state_attr('sensor.sun2000_8ktl_m0', 'phase_C_voltage') }}
        {% else %}
          {{ state_attr('sensor.sun2000_8ktl_m0', 'grid_C_voltage') }}
        {% endif %}

    - name: "Faza 1 V (m)"
      unique_id: m_grid_a_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_A_voltage') | float(0) }}"

    - name: "Faza 2 V (m)"
      unique_id: m_grid_b_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_B_voltage') | float(0) }}"

    - name: "Faza 3 V (m)"
      unique_id: m_grid_c_voltage
      unit_of_measurement: 'V'
      icon: mdi:flash-alert-outline
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_C_voltage') | float(0) }}" 

    - name: "Faza 1 A (f)"
      unique_id: phase_a_current
      unit_of_measurement: 'A'
      icon: mdi:current-ac
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_A_current') | float(0) }}"

    - name: "Faza 2 A (f)"
      unique_id: phase_b_current
      unit_of_measurement: 'A'
      icon: mdi:current-ac
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_B_current') | float(0) }}"

    - name: "Faza 3 A (f)"
      unique_id: phase_c_current
      unit_of_measurement: 'A'
      icon: mdi:current-ac
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_C_current') | float(0) }}"

    - name: "Produkcja DC"
      unique_id: pv_input_power
      unit_of_measurement: 'W'
      icon: mdi:solar-power
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'input_power') | float(0) }}"

    - name: "Zużycie prądu"
      unique_id: power_meter_active_power
      unit_of_measurement: 'W'
      icon: mdi:transmission-tower
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'power_meter_active_power') | float(0) }}"
 
    - name: "Zużycie A"
      unique_id: active_grid_a_power
      unit_of_measurement: 'W'
      icon: mdi:transmission-tower
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_A_power') | float(0) }}"
 
    - name: "Zużycie B"
      unique_id: active_grid_b_power
      unit_of_measurement: 'W'
      icon: mdi:transmission-tower
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_B_power') | float(0) }}"
 
    - name: "Zużycie C"
      unique_id: active_grid_c_power
      unit_of_measurement: 'W'
      icon: mdi:transmission-tower
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_C_power') | float(0) }}"
 
    - name: "Prąd oddany do sieci"
      unique_id: m_grid_exporterd_energy
      unit_of_measurement: 'kWh'
      icon: mdi:transmission-tower
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_exported_energy') | float(0) }}"
      device_class: energy
      state_class: total_increasing
      
    - name: "Prąd pobrany z sieci"
      unique_id: m_grid_accumulated_energy
      unit_of_measurement: 'kWh'
      icon: mdi:transmission-tower
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_accumulated_energy') | float(0) }}"
      device_class: energy
      state_class: total_increasing

    - name: "Temperatura falownika"
      unique_id: pv_temperatura
      unit_of_measurement: '°C'
      state: "{{ state_attr('sensor.sun2000_8ktl_m0', 'internal_temperature') | float(0) }}"   

    - name: "Efetywność Falownika"
      unique_id: pv_efficiency
      unit_of_measurement: '%'
      state: >
        {% if state_attr('sensor.sun2000_8ktl_m0', 'efficiency') | float(0) < 100 %}
          {{ state_attr('sensor.sun2000_8ktl_m0', 'efficiency') }}
        {% else %}
          0
        {% endif %}

    - name: "Zużycie prądu dom"
      unique_id: energy_used
      unit_of_measurement: 'kWh'
      state: >
        {% if states('sensor.total_yield') | float(0) > 0 and state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) > 0 and state_attr('sensor.sun2000_8ktl_m0','grid_accumulated_energy') | float(0) > 0 %}
        {{ '%0.2f' | format(states('sensor.total_yield') | float(0) - 
                            state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) + 
                            state_attr('sensor.sun2000_8ktl_m0','grid_accumulated_energy') | float(0)) }}
        {% endif %}                    
      device_class: energy
      state_class: total_increasing
      

I checked and sensors are visible in HA energy tab. In new format there are no friendly name option, so I had to change entity names in HA from GUI to have the same entity names as before.

1 Like

Hi, this not home-assistant platform, this monitoring system i wrote from scratch a lot years ago in PHP, Javascript and Mysql for my home and for my friend projects. I updated inverter visualization, and now looks a bit better

2 Likes

hi

I’m back with a question so i followed the staps from the git hub page.

but when i put the code in may configuration.yaml it says not valid.
Who can help me. I’m all new to this.

sensor:
    - platform: fusion_solar_kiosk
    kiosks:
        - id: "XXXXX"
        name: "A readable name for the plant"

greetz

Thank again for your work.
I have some question for better understanding sensor output:

#1:
For what I need to know, and how can I use it, “energy_used” attribute? It is calculate correct?

“energy_used” = “grid_accumulated_energy” - “grid_exported_energy” , right?

in my case: 4171.45 - 3733.23 = 438.22

I ask these, because I need to read, or calculate “self-consumption” value.

“self-consumption” = “total_yeld” - “grid_exported_energy”

5883.61-3733.23=2150.38

#2
It is possible to read “Consumption” value???

Thank you again,
Mircea

Energy_used is calculated Energy used by home. The formuła should be correct. If you want self consumption it is more complicated end I don’t know how it should be calculated.

Thank for reply, but (if I not make mistake) I think energy_used must have value: 6321.83 (kWh) = Consumption according above picture. In UI value is ~ 438 (kWh)

You missing Energy imported, check again formula.
5883 - 3733 + 4171 = 6321

If I well udestand, formula is in config.yaml:

{{ '%0.2f' | format(states('sensor.total_yield') | float - 
                            states('sensor.m_grid_exporterd_energy') | float + 
                            states('sensor.m_grid_accumulated_energy') | float)

so must check value for total_yeld. ( total_yield, storage_charge_discharge_power, storage_total_charge and storage_total_discharge are now separate sensors instead of attributes.)

If you have battery then it is more complicated, you will need add battery, if the battery is full then you are exporting Energy to grid, if battery is discharged then you will import Energy grom grid, SO this is more complicated and I don’t know how to count it.

I do not have battery. I undestand your point …

for now, I read your post with config.yaml but I am confused with sensor template.

If I don’t ask too much, can you share part of your config.yaml (just first part with template)

My template sensors are in seperate file, I posted them yesterday in this thread.

you have separate template.yaml?

I just read your post, but as I said, I’m confused (I don’t have enough knowledge)

You can add content of template.yaml to configuration.yaml but in section template:
Check on HA home page how template sensors should look like.

1 Like

Hello Guys,
I spent a few hours on this post but I confess I’m stil quite confused.
Today I activated my solar system and integrated it into HA with huawei_solar integration.

  - platform: huawei_solar   
    host: '192.168.178.67'
    optimizers: true
    battery: true
    slave: 1

I have 3 batteries and 2 inverters and I’d like to recreate on HA, Energy tab, what I see on my FusionSolar App but I’m really far away to understand how.
On HA I can see, daily_yield, total_yield, storage_charge_discharge_power, storage_total_charge, storage_total_discharge, and all attributes of sensor.sun2000_8ktl entity.
I also created all templates listed by @ligeza, reading correctly all the parameters but my question is, which entities should I put in “Grid Consumption”, “Return to Grid”, “Solar Production” and “Battery Systems”?
Any help is much appreciated, thanks.

Do you have also Smart meter Dtsu666-H? It is nessesery to read grid consumption.

Hi, yes I do have one.

Grid consumption is Energy used from grid so you should use entity made from grid_accumulated_energy

I created those entities but they basically look stuck to the same values since hours.
grid_exported_energy: 21474836.47
grid_accumulated_energy: 21474836.47

Do you see imported and exported to grid energy on huawei Fusion portal? Usually this value means that there is no Smart meter.

On Fusion portal everything seems to be ok, see attached screenshot from the related app.