Integration Solar inverter huawei 2000L

Finally got it to work. Connected to Huawei 10KTL-M1 using Raspberry pi’s builtin wifi.

  1. Supervisor
  2. System
  3. click change next to IP address
  4. select Wlan0
  5. Select wifi and scan for access points.
  6. Connect to SUN2000-xxxxx (xxxxx being your Inverters’ serial number) password is “Changeme” if it wasn’t changed :crazy_face:
  7. add the following code to configuration.yaml file.
  8. restart HA.
  9. It will add a new sensor name " sensor.sun2000_10ktl_m1" or whichever the model of your inverter is.
  10. follow @Emilv2 and @ligeza 's advice for further queries. because I don’t know next steps at this stage. @iz3man thanks for rpi4 advice. temporary solution but a solution non the less. :blush:

This is the code I used in configration.yaml file

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

can someone please help me to explain how to setup with LAN cable beacuse my RPi4 cant find the inverter wifi anymore.

But i can find it by my phone so it works .

But i got the dongle uppgraded to version 122 but cant get it to work .

Everyone seems to type different things in there config file ??

Can anybody typer their setting for LAN cable

I have made it work.
My scenario is not the common one. I have not my HA instance running in a RPI. It is on a Intel miniPC away from the inverter.
So, I have used an old TPLink router with wifi to route and masquerade the traffic between the internal inverter AP to my local network.
I have followed this tutorial that I got from this thread:
https://skyboo.net/2021/07/how-to-connect-to-sun2000-from-dd-wrt/
I had some trouble adapting it to my settings, but I finally got it.

1 Like

My RPi4 cant see the Wi-Fi anymoore i have had it working before so now i want to have it working with LAN cable.

Now I get that there is already someone connected ??

Do I use Emil’s or modbus in config ??

I have just started with Emil’s custom component. But I still have not made anything with the sensor values.
My plan is to make some automations based on the consumption and generation.
Also, I would like to use the new “Energy” feature in HA, but on my first attempt, I could not see the sensor in the config wizard. The HA docs state that Modbus should be valid, but I would like to support Emil’s work.

did you try Guide: Connecting Pi with Home Assistant OS to wifi (or other networking changes)?
check with the following commands

curl -v 192.168.200.1

and check ping

ping 192.168.200.1

to kill the ping Ctrl + C

The wifi don’t show up in the rpi4 anymore … it’s located 2 meters from the inverter .

It don’t connect to it by WiFi …

I have now it connected by Lan and now get someone already connected

Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py:311
First occurred: August 28, 2021, 2:42:23 PM (1 occurrences)
Last logged: August 28, 2021, 2:42:23 PM

could not read register value, is an other device already connected?

I can ping the LAN ip with good reslut but still get the error message

**I Now managed to get into the inverter and changed the inverter wifi password and then it poped up in RPI4 again … so i am now connected **

Your Ping and Curl -v response should be like this.

Now I am trying to set up separate sensors.
I used the following code

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') }}"

but in log I got this error

Logger: homeassistant.config
Source: config.py:445
First occurred: 2:12:44 PM (1 occurrences)
Last logged: 2:12:44 PM

Invalid config for [template]: [total_yield] is an invalid option for [template]. Check: template->total_yield. (See /config/configuration.yaml, line 30).

what I am doing wrong here?

@ligeza How did you removed W.distinct legend. it is showing up in my graphs

What attributes do you use at the new Energy tab

My Exported Energy shows unknown …

Can someone provide with a copy of your configuration file please ??

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) }}