Integration Solar inverter huawei 2000L

I have another question:

I see there are two integrations for the HUAWEI inverters.
What is the difference between the two ?
it’s not clear to me

Not on my end. I was able to enable Modbus TCP using the Sun2000 app on my iPhone.

Do you use the latest SUN2000 app? Older version does not have the option.

version 3.2.00.007

No option to enable MODBUS TCP in SUN2000 versie 3.2.00.007

Not sure about iOS, but on android version 3.2.00.15 is required to have the option.
Try to update the App.

I also have version 3.2.00.007 on an iPhone and I do have the option to enable modbus TCP. I guess 3.2.00.007 is the newest version for iOS.

Buenas

Tengo activa la configuración de MODBUS TCP para el Inversor Huawei y me funciona todo.
Quiero, a partir del sensor POTENCIA ACTIVA (del sensor de medida ddsu666-h), cuyos valores son positivos si se Exporta a la Red y negativos si se Importan a la Red, obtener por separado los valores de Exportación e Importación en sensores distintos y en Positivo ambos.
He probado con esto pero no funciona:

platform: template
sensors:
power_exported_grid:
value_template: ‘{% set pow_exp = sensor.sun2000_5ktl_l1_meter_active_power | int %}
{% if pow_exp > 0 %}
{{ pow_exp | int }}
{% else %}
0
{% endif %}’
device_class: power
unit_of_measurement: W

No se si hay algo mal escrito, o es problema del sensor de origen sensor.sun2000_5ktl_l1_meter_active_power (el cual no tiene ID al venir de modbus).

¿alguien me puede echar una mano? vi que @ligeza tenia algo parecido a mi pero no se si lo tiene aun.

Good

I have activated the MODBUS TCP configuration for the Huawei Inverter and everything works for me.
I want, from the ACTIVE POWER sensor (of the ddsu666-h measurement sensor), whose values ​​are positive if Exported to the Network and negative if Imported to the Network, obtain separately the Export and Import values ​​in different sensors and Positive both.
I’ve tried with this but it doesn’t work:

platform: template
sensors:
power_exported_grid:
value_template: ‘{% set pow_exp = sensor.sun2000_5ktl_l1_meter_active_power | int %}
{% if pow_exp > 0 %}
{{ pow_exp | int }}
{% else %}
0
{% endif %}’
device_class: power
unit_of_measurement: W

I don’t know if there is something wrong, or it is a problem with the original sensor sensor.sun2000_5ktl_l1_meter_active_power (which has no ID coming from modbus).

Can someone give me a hand? I saw that @ligeza had something similar to me but I don’t know if he still has it.

I don’t know if I correctly understand you, but I think you want something like that:

- platform: template
  sensors:
    power_exported_grid:
      friendly_name: "Power exported" 
      value_template: >
      {% if state_attr('sensor.sun2000_5ktl_l1', 'power_meter_active_power') | float(0) > 0 %}
      {{state_attr('sensor.sun2000_5ktl_l1', 'power_meter_active_power') | float(0) }}
      {% else %}
      0
      {% endif %}

    power_import_grid:
      friendly_name: "Power imported" 
      value_template: >
      {% if state_attr('sensor.sun2000_5ktl_l1', 'power_meter_active_power') | float(0) < 0 %}
      {{ - state_attr('sensor.sun2000_5ktl_l1', 'power_meter_active_power') | float(0) }}
      {% else %}
      0
      {% endif %}

It is something similar @ligeza , but the sensor sensor.sun2000_5ktl_l1_meter_active_power is a sensor as such, it is not an attribute of sun2000_5ktl_l1. I do not know what is the modification that I should make to the above taking it as a sensor and not as an attribute.

I autocorrect myself @ligeza , I have used the “states” function and for the negative I have used “abs” and it works.

One final question, I don’t understand what float (0) is for, I mean the 0 attribute of the float.

# Sensores Control de Consumo
- platform: template
  sensors:
    power_exported_grid:
      friendly_name: "Power exported" 
      unique_id: 'power_exported_grid'
      device_class: power
      unit_of_measurement: 'W'
      value_template: >
        {% if states("sensor.sun2000_5ktl_l1_meter_active_power") | float(0) > 0 %}
          {{ states("sensor.sun2000_5ktl_l1_meter_active_power") | float(0) }}
        {% else %}
          0
        {% endif %}

    power_import_grid:
      friendly_name: "Power imported" 
      unique_id: 'power_import_grid'
      device_class: power
      unit_of_measurement: 'W'
      value_template: >
        {% if states("sensor.sun2000_5ktl_l1_meter_active_power") | float(0) < 0 %}
          {{ (states("sensor.sun2000_5ktl_l1_meter_active_power") | float(0)) | abs }}
        {% else %}
          0
        {% endif %}
1 Like

Me too i thought that smart power meter values was what I was consuming from grid, but no is the difference between production solar power panels and grid consumption with + symbol for giving to grid and - symbol for using from grid.

Thx a lot for your time and help! I will try as soon as my sonoff powr3 arrive.

hello! someone with firmware 117 who has gotten it to work?

confirmado, la 117 no funciona, he bajado el inversor (sun-6ktl-L1) a la versión 115 y funciona correcta la integración.

Thank you very much ligeza, the problem was that my inverter was not configured to export energy to the grid, so the power meter never showed positive values. I have changed the configuration to export and now I can see the production surplus.

thank you!

My integration exposes relevant values as separate sensors, while Emilv2’s integration (at the time) exposed everything as one sensor with a lot of attributes. In the meantime, he has released a new version which also exposed some values as separate sensors, as it was otherwise impossible to integrate them in the Energy dashboard without jumping through some extra hoops.

I made the integration as I think it aligns better with what Home Assistant thinks a sensor should be. It also uses the modern configuration flow, so that you don’t need to edit your configuration.yaml.

1 Like

Hi, with my sun-5ktl-L1 with firmware updated to v.117 modbus port is closed and integration can’t work. So if Huawei said that never open this port again in inverter built in wifi but only will grant access by dongle can we can try to use api to download data from inverter? as described here? Communicate with FusionSolar through an openAPI account - Huawei Enterprise Support Community

I’ve been working on exposing some parameters as configurable entities in Home Assistant. My primary use case would be to make it possible to set the “Maximum Discharge Power” for my LUNA2000 battery from Home Assistant. This would allow me to adjust the power output of the battery dynamically based on other inputs.

Example use case: in Belgium, you are taxed on peak usage, starting when you draw more than 2.5kW from the grid for a certain time. I would like to create an automation that sets the “Maximum Discharging Power” for my battery to “Current Grid Power Usage (in W) - 2500W”.

However, while the register is mentioned as being read/writeable in the Modbus Interface Definitions document, I’m receiving a “Permission denied” error (0x80) when trying to write to it.

Support is letting me know that the function is not available at the moment :frowning: :

For everyone who would also be interested in using this function: Please send a mail to Huawei support to ask for this functionality!

An example mail:

Dear,

I want to use the Modbus-interface on my inverter to dynamically set the maximum discharging power of my LUNA2000 battery.
The Modbus Interface Definitions state that register 47077 is RW. However, when I try to write a value to this register, I get the error code 0x80, which means “No permission”?

My inverter SN: HVxxx
Battery SN: BTyyy

1 Like

Thank you for the explanation