Integration Solar inverter huawei 2000L

Does anyone use EMHASS and have a working control for huawei and luna2000 that they can share?

Hi,
the Modbus specs report the availability to read the Insulation Resistance, but I did not have this value in the HA integration. Is it not available or it’s a problem of mine?

Hello, this is my card yaml file but can’t figure out how to have the actual house consumption and the correct value for the actual energy imported from the grid.
Any help?

type: custom:power-flow-card-plus
entities:
  battery:
    entity: sensor.battery_potenza_di_carica_scarica
    state_of_charge: sensor.battery_stato_della_capacita
  grid:
    entity: sensor.power_meter_potenza_attiva
  solar:
    entity: sensor.inverter_potenza_in_ingresso
    display_zero_state: true
  home: {}
clickable_entities: true
display_zero_lines:
  mode: show
  transparency: 50
  grey_color:
    - 189
    - 189
    - 189
use_new_flow_rate_model: true
w_decimals: 0
kw_decimals: 1
min_flow_rate: 0.75
max_flow_rate: 6
max_expected_power: 4000
min_expected_power: 0.01
watt_threshold: 1000
transparency_zero_lines: 0
house_consumption_power:
  name: house_consumption_power
  unique_id: house_consumption_power
  state_class: measurement
  device_class: power
  unit_of_measurement: W
  icon: mdi:solar-power
  state: >
    {% set inv_active_power = states('sensor.inverter_potenza_attiva')|float(0)
    %} {% set pm_active_power =
    states('sensor.power_meter_potenza_attiva')|float(0) %} {{ (inv_active_power
    - pm_active_power)|float(0)|round(0) }}
  availability: |
    {{ (states('sensor.inverter_potenza_attiva')|is_number)
        and (states('sensor.power_meter_potenza_attiva')|is_number) }}

This is what I get :frowning:

Screenshot 2024-03-27 alle 10.42.48

configuration.yaml


template:
  - sensor:
    - name: "House power Consumption"
      unique_id: "house_power_consumption"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {% set meter_power = states('sensor.power_meter_active_power') | float %}
        {% set inverter_power = states('sensor.inverter_active_power') | float %}
        {{ (inverter_power - meter_power )  | float(0) }}
        
  - sensor:
    - name: "Overproduction Companny Injection"
      unique_id: "solar_power_Overproduction"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {% set meter_power = states('sensor.house_power_consumption') | float %}
        {% set inverter_power = states('sensor.inverter_input_power') | float %}
        {% set battery = states('sensor.battery_charge_discharge_power') | float %}
        {{ (inverter_power - meter_power - battery )  | float(0) }}
        
  - sensor:
    - name: "Consumo EDP"
      unique_id: "Consumo_EDP"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {% set consumo_rede_edp = states('sensor.power_meter_active_power') | float %}
        {{ (consumo_rede_edp * (-1) )  | float(0) }}

then in lovelace


type: gauge
entity: sensor.house_power_consumption
min: 0
max: 6000
name: Consumo Casa
unit: W
needle: true
severity:
  green: 0
  yellow: 2500
  red: 4000

1 Like

Thanks for sharing, I added the lines into the configuration.yaml file but I’m missing the sensor.house_power_consumption entity.

Using Huawei Solar integration I’m having just 67 entities vs. 117 via Fusion Solar integration.

I’m just having the followings:

its this one to build:

Note: change the “states”'s sensors according your built
{% set meter_power = states(‘sensor.power_meter_active_power’) | float %}
{% set inverter_power = states(‘sensor.inverter_active_power’) | float %}
{{ (inverter_power - meter_power ) | float(0) }}

it will show up a new one called “house_power_consumption”

  • sensor:
    • name: “House power Consumption”
      unique_id: “house_power_consumption”
      unit_of_measurement: “W”
      device_class: power
      state_class: measurement
      state: >
      {% set meter_power = states(‘sensor.power_meter_active_power’) | float %}
      {% set inverter_power = states(‘sensor.inverter_active_power’) | float %}
      {{ (inverter_power - meter_power ) | float(0) }}

image

Thanks Pedro I think I did it correctly and restarted HA but still can’t find that sensor.

EDIT: I see the entity now but it returns no figures:

Screenshot 2024-03-27 alle 15.47.58

Here’s my config.yaml file:

template:
  - sensor:
    - name: "House power Consumption"
      unique_id: "house_power_consumption"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {% set meter_potenza = states('sensor.power_meter_potenza_attiva') | float %}
        {% set inverter_ptenza = states('sensor.inverter_potenza_attiva') | float %}
        {{ (inverter_potenza - meter_potenza )  | float(0) }}
        
  - sensor:
    - name: "Overproduction Companny Injection"
      unique_id: "solar_power_Overproduction"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {% set meter_potenza = states('sensor.house_power_consumption') | float %}
        {% set inverter_potenza = states('sensor.inverter_potenza_in_ingresso') | float %}
        {% set battery = states('sensor.battery_potenza_di_carica_scarica') | float %}
        {{ (inverter_potenza - meter_potenza - battery )  | float(0) }}

do you have this?

type: gauge
entity: sensor.house_power_consumption
min: 0
max: 6000
name: Consumo Casa
unit: W
needle: true
severity:
green: 0
yellow: 2500
red: 4000

its wrong, switch

    {% set meter_power = states('sensor.power_meter_active_power') | float %}
    {% set inverter_power = states('sensor.inverter_active_power') | float %}
    {{ (inverter_power - meter_power )  | float(0) }}

soo yours

    {% set meter_potenza = states('sensor.power_meter_potenza_attiva') | float %}
    {% set inverter_ptenza = states('sensor.inverter_potenza_attiva') | float %}
    {{ (inverter_ptenza - meter_potenza )  | float(0) }}

Hey Pedro many many thanks.
Yes I got the sensor.house_power_consumption entity now and switched the config.yaml code as suggested but on the power flow plus card I’m still getting this wrong value: grid is likely my home consumption :frowning:

type: custom:power-flow-card
entities:
battery:
consumption: sensor.battery_day_discharge
production: sensor.battery_day_charge
battery_charge: sensor.battery_state_of_capacity
grid:
consumption: sensor.inverter_active_power
production: sensor.power_meter_active_power
solar: sensor.inverter_input_power
inverted_entities: battery, grid

EDIT: figured out it was a typo, many thanks @Pedro_Trancoso for supporting!

Much better but I’m getting strange values now. House consumption is higher than energy taken from grid (battery is below the minimum SOC so not giving any energy and PV are not producing as it’s 10 pm)

I connect to my SUN2000-33KTL-A via ELFIN-EW11. The connection is successful, through the browser I made the settings according to the instructions. But when I set up Huawei solar integration, I get a message “Failed to connect” almost immediately.
Is my inverter not compatible with this integration? Software version V200R002
MBUS Software Ver. V100R001C72SPC102.
Here is the log message:

Aborting client creation due to error.
Traceback (most recent call last):
File “/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py”, line 178, in create
await huawei_solar._initialize()
File “/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py”, line 107, in _initialize
self.time_zone = (await self.get(rn.TIME_ZONE)).value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py”, line 241, in get
return (await self.get_multiple([name], slave))[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py”, line 276, in get_multiple
response = await self._read_registers(registers[0].register, total_length, slave)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py”, line 398, in _read_registers
return await _do_read()
^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/backoff/_async.py”, line 151, in retry
ret = await target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/backoff/_async.py”, line 151, in retry
ret = await target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py”, line 378, in _do_read
raise ReadException(
huawei_solar.exceptions.ReadException: Got error while reading from register 43006 with length 1: Exception Response(131, 3, IllegalAddress)

Thank you🙂

Hey, I have passed the whole day on this. Getting crazy. Looking to grab live data from my 3 8ktl-m1 with 2 batteries to manage mypv elwa2.

I have done my possible to connect to modbus with ew11 It is currenty connected to main inverter on port rs485A1(2), and rs485B1(4). But can’t seem to get this through. Any help would be greatly appreciated. :slight_smile:

2024-03-31 18:07:18.127 DEBUG (MainThread) [pymodbus.logging] Connecting to 192.168.1.173:8899.
2024-03-31 18:07:18.128 DEBUG (MainThread) [pymodbus.logging] Connecting comm
2024-03-31 18:07:18.163 DEBUG (MainThread) [pymodbus.logging] Connected to comm
2024-03-31 18:07:18.163 DEBUG (MainThread) [pymodbus.logging] callback_connected called
2024-03-31 18:07:18.164 DEBUG (MainThread) [huawei_solar.modbus] Waiting for 1500 milliseconds after connection before performing operations
2024-03-31 18:07:18.164 INFO (MainThread) [huawei_solar.huawei_solar] Waiting for connection ...
2024-03-31 18:07:19.665 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006 with length 1 from slave 1
2024-03-31 18:07:19.665 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x3 0xa7 0xfe 0x0 0x1
2024-03-31 18:07:19.666 DEBUG (MainThread) [pymodbus.logging] Adding transaction 1
2024-03-31 18:07:29.668 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x3 0xa7 0xfe 0x0 0x1
2024-03-31 18:07:29.669 DEBUG (MainThread) [pymodbus.logging] Adding transaction 1
2024-03-31 18:07:39.671 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x3 0xa7 0xfe 0x0 0x1
2024-03-31 18:07:39.671 DEBUG (MainThread) [pymodbus.logging] Adding transaction 1
2024-03-31 18:07:49.672 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x3 0xa7 0xfe 0x0 0x1
2024-03-31 18:07:49.673 DEBUG (MainThread) [pymodbus.logging] Adding transaction 1
2024-03-31 18:07:59.674 DEBUG (MainThread) [pymodbus.logging] Connection lost comm due to Server not responding
2024-03-31 18:07:59.675 DEBUG (MainThread) [pymodbus.logging] Getting transaction 1
2024-03-31 18:07:59.675 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py", line 178, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py", line 107, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py", line 241, in get
    return (await self.get_multiple([name], slave))[0]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py", line 276, in get_multiple
    response = await self._read_registers(registers[0].register, total_length, slave)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py", line 398, in _read_registers
    return await _do_read()
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/huawei_solar/huawei_solar.py", line 351, in _do_read
    response = await self._client.read_holding_registers(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pymodbus/client/base.py", line 207, in async_execute
    raise ModbusIOException(
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] ERROR: No response received after 3 retries

Not sure where the problem is :frowning:
Thanks

Standardisation of WLCRS (Huawei / iStore) Custom Sensors?

Hi @JensenNick @heinemannj

Apologies this was the only forum I could think of that would allow tagging both of you in (vs your own seperate GitHub Repos). I’ve been working on a number of derived / custom sensors (for use with SunSynk card for Huawei / iStore) from WLCRS ‘raw’ sensors and looking around you also have done the same.

Wondering if instead of there being multiple different developments of derived sensors, each with different names and/or unique_id’s for the same sensors, if it would make sense to pool efforts and have one standard set of custom sensors for WLCRS users?

In this way, it would allow all WLCRS end users to have a single and consistent set of sensors they can easily add to their HA, and in doing this be able to easily then leverage them for different visualisations/cards that people have developed.

Thoughts… ?

Here my “project” in Home Assistant
If you are interested i can send you the code

I’m configuring several actions when my inverter Huawei M1 10 KTL is Off Grid (i have a Backup Box), and i need to identify the EXACT value for DEVICE STATUS when the inverter is OFF GRID
When it’s ON GRID, the value is “On-grid”, i suppose that for OFF GRID the value should be “Off-grid”
Do you have a list of these kind of values ? Could you help me ?
Thanks a lot

1 Like

@Ribe

The outputs of WLCRS for Huawei are all based upon the ‘Modbus Register Definitions’ as published by Huawei.

https://www.photovoltaikforum.com/core/attachment/315028-solar-inverter-modbus-interface-definitions-pdf

The ‘Device State’ you mentioned is register # 32089, also 32000 - 32003

Look in at lines 10 - 41 of the Library that WLCRS uses to query this state, for the possible replies he caters for:

See: huawei-solar-lib/src/huawei_solar/register_values.py at 026b37f3e60d709e70b280b76d5c1b3aeb6ece9c ¡ wlcrs/huawei-solar-lib ¡ GitHub

Interested if you can send me your card, as I’m trying to work out what the dial is for on the bottom left ?

1 Like

Struggling to get this Template Sensor right. It’s reporting always the wrong value for my House consumption and i think it must have something to do with positive and negative values of battery_charge_discharge_power and power_meter_active_power because they both can have negative and positive values. So i’m not a math genie and i’m struggling to think clear about this maybe because i tried so much. I think it has something to do with substract or addition of the values and the order in which this should be calculated. So maybe somebody has a hint for me?

template:
  - sensor:
    - name: "House power Consumption"
      unique_id: "house_power_consumption"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {% set meter_power = states('sensor.power_meter_active_power') | float %}
        {% set inverter_power = states('sensor.inverter_active_power_group') | float %}
        {% set battery_power = states('sensor.battery_charge_discharge_power') | float %}
        {{ (inverter_power - meter_power - battery_power)  | float(0) }}

Edit:
Just thought about it and i think i have to take out the charging power of the Battery if it charges. Same is for the power from grid. I should only use the imported power from grid to calculate house consumtion. So there should only the positive values used for calculation and i can not figure out how to only use positive values of those two entities.

I’ve replied above

you are inserting the batery, and can’t

  • sensor:
    • name: “House power Consumption”
      unique_id: “house_power_consumption”
      unit_of_measurement: “W”
      device_class: power
      state_class: measurement
      state: >
      {% set meter_power = states(‘sensor.power_meter_active_power’) | float %}
      {% set inverter_power = states(‘sensor.inverter_active_power’) | float %}
      {{ (inverter_power - meter_power ) | float(0) }}

Hm, but shouldnt i?
I think if i only use Power of the battery and not from grid. Let’s say 400W, my home is consuming 400W. Not from grid and not from one of my inverters. So i thought i have to take the battery in this calculation also…
I just want an entitiy for the power consumption of my house, not what im consuming from grid or solar etc. I want a total of all consumed energy and that includes power i take from the batterys or am i wrong?