RalfWinter / lambda-heatpump-modbus-tcp-HA

Home Assistant configuration.yaml additions to integrate Lambda heatpump
Apache License 2.0
28 stars 6 forks source link

General E-Manager section sensors unavailable #3

Open lutzvahl opened 1 year ago

lutzvahl commented 1 year ago

Hi,

great work, thanks for sharing the config! I was able to adopt in my HA, unfortunately I don't get any values for the 'General E-Manager' Section registers 01xx. E.g. for 0103 (Actual power consumption) HA is just showing: unavailable Pump values, buffer and boiler (so 1xxx, 2xxx, and 3xxx) are working great! I'm even able to set the solar power values (register 0102), but I'm unable to read the overall power consumption of the system.

Any clue what's going on with the 01xx registers?

As of now I'm using the eu13l_hp1_inverter_power_consumption (1012 registers) to track power.

thecem commented 5 months ago

Deine Einstellungen sind korrekt! Der Alarm auch, ich denke das es an deinem Sensor liegt. Hierzu brauche ich aber die Ausgabe..

RalfWinter commented 5 months ago

Bei folgendem Kommando kommt -9400 {{states('sensor.shelly3em_total_power') | int }}

Damit kommt ca. 56500: {{states('sensor.shelly3em_total_power') | int | bitwise_and(65535)

Die -9400 war zu dem Zeitpunkt der Export (in Watt) ins Grid.

thecem commented 5 months ago

Kannst du bitte noch mal den Wert beim Verbrauch posten? Gerne auch erst heute Abend.

RalfWinter commented 5 months ago

Kein Problem, bin Privatier ;-) Was meinst Du mit "Verbrauch"? Von der WP?

Eisbaer2 commented 5 months ago

Bei folgendem Kommando kommt -9400 {{states('sensor.shelly3em_total_power') | int }}

Damit kommt ca. 56500: {{states('sensor.shelly3em_total_power') | int | bitwise_and(65535)

Die -9400 war zu dem Zeitpunkt der Export (in Watt) ins Grid.

Eigentlich sollte es mit den 56500 klappen ...

RalfWinter commented 5 months ago

Dein Zählerwert sollte bei PV-Überschuss negativ sein. Ist dem so?

Ja, genau. Und weil in der Lambda "Neg. E-Überschuss" definiert ist, hätte ich gedacht, das passt. In HA wird bei "EU13L_EMgr_Actual_Power" immer "-32768" angezeigt, als ob der Wert nicht gesetzt wird.

RalfWinter commented 5 months ago

Ah, here we go...habe mal den Loglevel auf Debug gestellt: 2024-04-11 11:53:59.476 ERROR (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: EU13L: Error: device: 0 address: 102 -> Exception Response(134, 6, IllegalFunction)

thecem commented 5 months ago

Was ist denn die config fürs Modbus?

RalfWinter commented 5 months ago

Was ist denn die config fürs Modbus?

Die schaut so aus:

modbus: - name: "EU13L" type: tcp host: 192.168.1.120 port: 502

thecem commented 5 months ago

Bitte mal den Leistungswert selbst setzen und zwar alle /5 Sec. Wichtig ist der Bindestrich "-".

alias: Leistungsdaten => Wärmepumpe
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.leistung_aktuell
  - platform: time_pattern
    seconds: /5
condition: []
action:
  - service: modbus.write_register
    data:
      address: 102
      hub: EU13L
    value:
      - "49666"
mode: single
RalfWinter commented 5 months ago

Bitte mal den Leistungswert selbst setzen und zwar alle /5 Sec. Wichtig ist der Bindestrich "-".

Du bist mein Held, das hat funktioniert, der Fehler in der Lambda-GUI ist prompt weg! In HA steht nun -18.870 W.

Hast Du noch eine Tipp, wie ich den eigentlichen Wert übertragen bekomme?

Eisbaer2 commented 5 months ago

Nimm meine Automation und tausche nur den Sensor aus. Wahrscheinlich lag es bei dir nur am fehlenden Bindestrich.

RalfWinter commented 5 months ago

Ja, eigentlich easy, das Minus hat es gemacht, allerdings muss der Wert so wie bei Dir deklariert werden: - "{{states('sensor.leistung_aktuell') | int | bitwise_and(65535)}}"

1000 Dank Euch Beiden, @Eisbaer2 und @thecem

RalfWinter commented 5 months ago

Nochmal zum Abschluß: den potentialfreien Kontakt habe ich abgebaut und arbeite jetzt nur noch mit dem EMgr, ein Träumchen. EMgr PV-Betrieb

RalfWinter commented 5 months ago

Back to English: for owners of a Shelly 3EM smart meter this is the description to send the PV-surplus not needed elsewhere in your household to the E-manager of your Lambda heatpump. The Shelly 3EM is a cheap alternative to the expensive ModBus-Smartmeter offered by Lambda. In addition many HA-users already have Shelly devices because of the easy integration in Home Assistant.

The following is divided into three parts: the automation,the configuration.yaml und Lambda-setup part.

The automation part:

alias: PV-Excess-to-HP
description: Sent PV-Excess to Heatpump
trigger:
  - platform: state
    entity_id:
      - sensor.power_current
    for:
      hours: 0
      minutes: 0
      seconds: 0
  - platform: time_pattern
    seconds: /10
condition: []
action:
  - service: modbus.write_register
    data:
      hub: EU13L
      address: 102
      value:
        - "{{states('sensor.power_current') | int | bitwise_and(65535)}}"
mode: single

The configuration.yaml part:

Because the Shelly-integration for the 3-phase smart meter does not include an entity which represents the total power over all 3 phases you need to add following template sensors at the end of your configuration.yaml (change the unique id of your Shelly-3EM [here "34945474b5f2"] according to your discovered Shelly-3EM in your installation).

#
# Shelly 3EM additions for PV numbers
#
      # Template sensor for current power comsumption
      power_current:
        friendly_name: "Power Current"
        unit_of_measurement: 'W'
        value_template: >-
            {{ states('sensor.shellyem3_34945474b5f2_channel_a_power')|float + states('sensor.shellyem3_34945474b5f2_channel_b_power')|float + states('sensor.shellyem3_34945474b5f2_channel_c_power')|float }}
        availability_template: "{{
            [ states('sensor.shellyem3_34945474b5f2_channel_a_power'),
              states('sensor.shellyem3_34945474b5f2_channel_b_power'),
              states('sensor.shellyem3_34945474b5f2_channel_c_power')
            ] | map('is_number') | min
          }}"

      # Template sensor for values of power import (active_power > 0)
      power_import:
        friendly_name: "Power Import"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.shellyem3_34945474b5f2_channel_a_power')|float + states('sensor.shellyem3_34945474b5f2_channel_b_power')|float + states('sensor.shellyem3_34945474b5f2_channel_c_power')|float) > 0 %}
            {{ states('sensor.shellyem3_34945474b5f2_channel_a_power')|float + states('sensor.shellyem3_34945474b5f2_channel_b_power')|float + states('sensor.shellyem3_34945474b5f2_channel_c_power')|float }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.shellyem3_34945474b5f2_channel_a_power'),
              states('sensor.shellyem3_34945474b5f2_channel_b_power'),
              states('sensor.shellyem3_34945474b5f2_channel_c_power')
            ] | map('is_number') | min
          }}"

      # Template sensor for values of power export (active_power < 0)
      power_export:
        friendly_name: "Power Export"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.shellyem3_34945474b5f2_channel_a_power')|float + states('sensor.shellyem3_34945474b5f2_channel_b_power')|float + states('sensor.shellyem3_34945474b5f2_channel_c_power')|float) < 0 %}
            {{ (states('sensor.shellyem3_34945474b5f2_channel_a_power')|float + states('sensor.shellyem3_34945474b5f2_channel_b_power')|float + states('sensor.shellyem3_34945474b5f2_channel_c_power')|float) * -1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.shellyem3_34945474b5f2_channel_a_power'),
              states('sensor.shellyem3_34945474b5f2_channel_b_power'),
              states('sensor.shellyem3_34945474b5f2_channel_c_power')
            ] | map('is_number') | min
          }}"

The E-Manager part: In order to consume the PV-surplus numbers the E-Manager in your Lambda-HP needs to be configured as follows:

The other values in the E-Manager configuration will be set according to the "best-practices" of the installer of your heatpump and, the last point, whether you have a battery coupled to your PV-system or not: EMgr-config

If all works fine you should see (depending on your personal setup....) following values in HA: Emgr-HA ...and in case of enough PV-surplus you will see the new "PV-and-sun"-icon on your Lambda-display (see screenshots in the previous comment).

Last but not least you configure the PV-temperature increase in your different modules like in "domestic hot water" (in my setup: 13k), the "buffer" (14k) and the "heating circuit(s)" (here I only increased a little, 3k, I already increased the buffer massively).

huhndomi commented 4 months ago

Ich habe Probleme die automation zum Schreiben der Werte in die Lambda Wärmepumpe in meine configuration.yaml einzufügen. Ich habe diese ganz unten ans Ende der configuration.yaml wie folgt eingefügt:

...
     eu15l_hc1_operating_mode_txt:
        friendly_name: "EU15L_Hc1_Operating_Mode_txt"
        value_template: >
          {{ ['Off', 'Manual', 'Automatik', 'Auto-Heating', 'Auto-Cooling', 'Frost', 'Summer', 'Floor-dry'][states('sensor.EU15L_hc1_operating_mode')|int] }}
      eu15l_hc2_operating_state_txt:
        friendly_name: "EU15L_Hc2_Operating_State_txt"
        value_template: >
          {{ ['Heating', 'Eco', 'Cooling', 'Floor-dry', 'Frost', 'Max-Temp', 'Error', 'Service', 'Holiday', 'Central Heating Summer', 'Central Cooling Winter', 'Prio-Stop', 'Off', 'Release-Off', 'Time-Off', 'Standby', 'Standby-Heating', 'Standby-Eco', 'Standby-Cooling', 'Standby-Frost', 'Standby-Floor-dry'][states('sensor.EU15L_hc2_operating_state')|int] }}
      eu15l_hc2_operating_mode_txt:
        friendly_name: "EU15L_Hc2_Operating_Mode_txt"
        value_template: >
          {{ ['Off', 'Manual', 'Automatik', 'Auto-Heating', 'Auto-Cooling', 'Frost', 'Summer', 'Floor-dry'][states('sensor.EU15L_hc2_operating_mode')|int] }}

# Werte von HomeAssistant zur Lambda schicken. Raumtemperatur und verfuegbarer PV Ueberschuss
automation:
  alias: PV-Ueberschuss-zur-Lambda
  description: Schicke PV-Ueberschuss zur Lambda Waermepumpe
    trigger:
    - platform: state
      entity_id:
        - sensor.smart_meter_ts_65a_3_wirkleistung
      for:
        hours: 0
        minutes: 0
        seconds: 0
    - platform: time_pattern
      seconds: /10
  condition: []
  action:
    - service: modbus.write_register
      data:
        hub: EU15L
        address: 102
        value:
          - "{{states('sensor.smart_meter_ts_65a_3_wirkleistung') | int | bitwise_and(65535)}}"
    mode: single

Wenn ich dies so einfüge erhalte ich immer folgende Fehlermeldung:

Konfigurationsfehler Error loading /config/configuration.yaml: mapping values are not allowed here in "/config/configuration.yaml", line 1018, column 12

Line 1018 ist hierbei die Zeile mit "trigger:"

Nutze folgende Version von HA: Core 2024.5.4 Supervisor 2024.05.1 Operating System 12.3 Frontend 20240501.1

Könnt ihr mir da weiterhelfen? Danke

huhndomi commented 4 months ago

Ich habe den Fehler selbst gefunden. Problem waren die Leerzeichen in der Konfiguration. Da hat mir diese Seite weitergeholfen: https://www.geeksforgeeks.org/how-do-i-resolve-a-mapping-values-are-not-allowed-here-error-in-yaml/

@RalfWinter Vielleicht kannst du dies auch direkt in deine Konfiguration hier mit übernehmen.

Mit mehreren Werten welche ich von meinem HomeAssistant in die Lambda übertrage, sieht meine configuration.yaml wie folgt aus. Dies habe ich am Ende der Konfiguration eingefügt:

# Werte von HomeAssistant zur Lambda schicken. Raumtemperatur und verfuegbarer PV Ueberschuss
automation:
  - alias: PV-Ueberschuss-zur-Lambda
    description: Schicke PV-Überschuss zur Lambda Wärmepumpe
    trigger:
      - platform: state
        entity_id:
          - sensor.smart_meter_ts_65a_3_wirkleistung
        for:
          hours: 0
          minutes: 0
          seconds: 0
      - platform: time_pattern
        seconds: /10
    condition: []
    action:
      - service: modbus.write_register
        data:
          hub: EU15L
          address: 102
          value:
            - "{{states('sensor.smart_meter_ts_65a_3_wirkleistung') | int | bitwise_and(65535)}}"
    mode: single
  - alias: Durchschnittstemperatur-Fussbodenheizung-zur-Lambda
    description: Schicke Durchschnittstemperatur Fußbodenheizung zur Lambda Wärmepumpe
    trigger:
      - platform: state
        entity_id:
          - sensor.temperatur_heizkreis_fussbodenheizung_durchschnitt
        for:
          hours: 0
          minutes: 0
          seconds: 0
      - platform: time_pattern
        seconds: /10
    condition: []
    action:
      - service: modbus.write_register
        data:
          hub: EU15L
          address: 5004
          value:
            - >-
              {{ (float(states('sensor.temperatur_heizkreis_fussbodenheizung_durchschnitt')) *10 )
              |round(0)  }}
    mode: single
  - alias: Durchschnittstemperatur-Heizkoerper-zur-Lambda
    description: Schicke Durchschnittstemperatur Heizkörper zur Lambda Wärmepumpe
    trigger:
      - platform: state
        entity_id:
          - sensor.temperatur_heizkreis_heizkorper_durchschnitt
        for:
          hours: 0
          minutes: 0
          seconds: 0
      - platform: time_pattern
        seconds: /10
    condition: []
    action:
      - service: modbus.write_register
        data:
          hub: EU15L
          address: 5104
          value:
            - >-
              {{ (float(states('sensor.temperatur_heizkreis_heizkorper_durchschnitt')) *10 )
              |round(0)  }}
    mode: single
andreas-bulling commented 1 week ago

Nimm meine Automation und tausche nur den Sensor aus. Wahrscheinlich lag es bei dir nur am fehlenden Bindestrich.

same here - have been trying to get this working for two days now. Thanks a million!

thecem commented 1 week ago

Pls post your formatted (use the button above <>) automation and the sensor details (developer/states).