Integration Solar inverter huawei 2000L

  1. input_power
  2. value of sensor.sun2000…
  3. power_meter_active_power
  4. it’s counted (value of sensor.sun2000 - power_meter_active_power)
  5. it’s counted (7 - 6)
  6. grid_exporterd_energy
  7. daily_yield
  8. grid_accumulated_energy
  9. it’s counted

Thank you very much for the answer.

Would it be possible to put these values ​​as independent sensors?

You can use template sensor. I think it is better option then independent sensors because I can chose which sensors I want, instead of having over 50 sensors.

- platform: template
  sensors:
    m_grid_exporterd_energy:
      friendly_name: "Prąd oddany do sieci"
      unit_of_measurement: 'kWh'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_exporterd_energy') }}"

Cant you post your hole list of configuration.yaml of the huawei settings ??

Please that have been much appriciated

- platform: huawei_solar   
  host: 192.168.8.1

- platform: template
  sensors:
    pv_01_voltage:
      friendly_name: "String 1 napięcie"
      unit_of_measurement: 'V'
      icon_template: mdi:flash-alert-outline
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_01_voltage') }}"

    pv_02_voltage:
      friendly_name: "String 2 napięcie"
      unit_of_measurement: 'V'
      icon_template: mdi:flash-alert-outline
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_02_voltage') }}"

    pv_01_current:
      friendly_name: "String 1 natężenie"
      unit_of_measurement: 'A'
      icon_template: mdi:current-dc
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_01_current') }}"

    pv_02_current:
      friendly_name: "String 2 natężenie"
      unit_of_measurement: 'A'
      icon_template: mdi:current-dc
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'pv_string_02_current') }}"

    phase_a_voltage:
      friendly_name: "Faza 1 V (f)"
      unit_of_measurement: 'V'
      icon_template: mdi:flash-alert-outline
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_A_voltage') }}"

    phase_b_voltage:
      friendly_name: "Faza 2 V (f)"
      unit_of_measurement: 'V'
      icon_template: mdi:flash-alert-outline
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_B_voltage') }}"

    phase_c_voltage:
      friendly_name: "Faza 3 V (f)"
      unit_of_measurement: 'V'
      icon_template: mdi:flash-alert-outline
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'phase_C_voltage') }}"

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

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

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

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

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

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

    pv_input_power:
      friendly_name: "Produkcja DC"
      unit_of_measurement: 'W'
      icon_template: mdi:solar-power
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'input_power') }}"

    power_meter_active_power:
      friendly_name: "Zużycie prądu"
      unit_of_measurement: 'W'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'power_meter_active_power') }}"
 
    active_grid_a_power:
      friendly_name: "Zużycie A"
      unit_of_measurement: 'W'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_A_power') }}"
 
    active_grid_b_power:
      friendly_name: "Zużycie B"
      unit_of_measurement: 'W'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_B_power') }}"
 
    active_grid_c_power:
      friendly_name: "Zużycie C"
      unit_of_measurement: 'W'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'active_grid_C_power') }}"
 
    m_grid_exporterd_energy:
      friendly_name: "Prąd oddany do sieci"
      unit_of_measurement: 'kWh'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_exporterd_energy') }}"
 
    m_grid_accumulated_energy:
      friendly_name: "Prąd pobrany z sieci"
      unit_of_measurement: 'kWh'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'grid_accumulated_energy') }}"

    daily_yield:
      friendly_name: "Produkcja dziś"
      unit_of_measurement: 'kWh'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'daily_yield') }}"

    total_yield:
      friendly_name: "Produkcja total"
      unit_of_measurement: 'kWh'
      icon_template: mdi:transmission-tower
      value_template: "{{ state_attr('sensor.sun2000_8ktl_m0', 'total_yield') }}"

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

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

    energy_used:
      friendly_name: "Zużycie prądu dom"
      unit_of_measurement: 'kWh'
      value_template: >
        {{ '%0.2f' | format(states('sensor.total_yield') | float - 
                            states('sensor.m_grid_exporterd_energy') | float + 
                            states('sensor.m_grid_accumulated_energy') | float) }}
2 Likes

Hello,

I want to integrate a Huawei SUN2000 inverter - 5KTL-M1, using HA on an Rpy3.
Rpi is connected to the router via LAN. Router and Rpy IP is 192.168.16.xxx
The inverter is connected to the router via wifi dongle. (without battery and optimizer)

I read the previous posts, and I can’t make this integration. That’s what I’ve done so far:

I found out the address of the inverter, I checked it:

>>> import huawei_solar
>>> inverter = huawei_solar.HuaweiSolar ('192.168.200.1')
>>> inverter.get ("model_name")
Result (value = 'SUN2000-5KTL-M1', unit = None)

I created the folder and put the necessary files in it, and wrote in configuration.yaml:

sensor:
   - platform: huawei_solar
     host: '192.168.200.1'

ping seems to be a problem …
74 packets transmitted, 0 packets received, 100% packet loss

Then with nmcli wifi device, SUN2000-HVxxxxxx appeared but with a weak signal (15) - is that the problem ???

I do not know what to do anymore…

Thanks in advance for your help!

Do you see any errors in HA logs? I see that connection from python works, so is rpi connected to inverter internal wifi (you can’t connect this integration to smart dongle)? Did you try move rpi closer to inverter to test it with better wifi signal?

Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:124
Integration: Senzor (documentation, issues)
First occurred: 10:57:11 (1 occurrences)
Last logged: 10:57:11

Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 169, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 198, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/huawei_solar/sensor.py", line 109, in setup_platform
    HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])
  File "/config/custom_components/huawei_solar/sensor.py", line 124, in __init__
    self._name = self._inverter.get("model_name").value
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 40, in get
    response = self.read_register(reg.register, reg.length)
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 172, in read_register
    raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]

Rpy is not connected via dongle, I think it is connected via wifi (nmcli shows Sun2000 …). Maybe I don’t know how to connect Rpy to the inverter’s internal wifi …

I will try to bring Rpy closer to the inverter.

another error:

Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:171
First occurred: 10:57:09 (1 occurrences)
Last logged: 10:57:09

failed to connect to device, is the host correct?
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 169, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:171
First occurred: 10:57:09 (1 occurrences)
Last logged: 10:57:09

failed to connect to device, is the host correct?
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 169, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.200.1:502)]

Logger: pymodbus.client.sync
Source: /usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py:214
First occurred: 10:57:02 (2 occurrences)
Last logged: 10:57:09

Connection to (192.168.200.1, 502) failed: timed out

It is problem with connecting to inverter, can you ping 192.168.200.1 from rpi?

No, can not ping, as I said:
ping seems to be a problem …
74 packets transmitted, 0 packets received, 100% packet loss

I don’t know why.

Is it still working? Was it from rpi? Can you show network configuration from rpi? On rpi you shoul have 2 IP, one from home network (LAN) and one from Inverter (wifi)

It shows me a single eternet connection.

I think I have to do like here: (post LGHD)

if I do this, Rpy stays connected to the router on the LAN and connected to the inverter on Wifi ???

… I’m sorry for my stupid question, but I’m newbie… and thank’s for your answer…

It is from my laptop, near the inverter

image

No connection to inverter, I don’t have rpi, so I can’t help you configure wifi.

Yes, as I understand it if you do this you will stay connected to the router via LAN and connected to the inverter via Wifi. If it works you should see an ip address behind IPv4 addresses from wlan0 in the System information.

Thank’s for reply,

after many attempts, I found that the signal emitted by the inverter is too weak. I amplified it with a router, and now this appears:

first SUN2000… with full signal (100) is after extender, and last SUN2000… with 30db signal is inverter itself

I restart HA, but nothing new :frowning:

maybe is helpful for debug:

this is properties of extented inverter:

|SSID:|SUN2000-HV20B0025337|
|---|---|
|Protocol:|Wi-Fi 4 (802.11n)|
|Security type:|WPA2-Personal|
|Network band:|2.4 GHz|
|Network channel:|3|
|Link speed (Receive/Transmit):|19/26 (Mbps)|
|Link-local IPv6 address:|fe80::85b5:16:6565:1549%15|
|IPv4 address:|192.168.200.102|
|IPv4 DNS servers:|192.168.200.1|
|Manufacturer:|Intel Corporation|
|Description:|Intel(R) Wi-Fi 6 AX201 160MHz|
|Driver version:|22.10.0.7|
|Physical address (MAC):|34-C9-3D-8A-9B-93|

Finally :sweat_smile: it works !!!

Thanks for the help and this integration. Now wish the configuration part in the dashboard

Thanks again!

1 Like