Bekomme meine config.yaml nicht wieder hin

Ich wollte eigentilch nur ausprobieren wie es mit include_dir_named funktioniert,damit die config aufgeräumter wird.Nun ist aber das Problem das weder das eine noch das andere mehr funktionieren will.

Meine Strom Import,Export sind nicht mehr vorhanden.Kann mir jemand helfen.Anbei habe ich meine Config.

# Loads default set of integrations. Do not remove.
default_config:


# Text to speech
tts:
  - platform: google_translate

homeassistant:
  packages: !include_dir_named packages
  
automation: !include automations.yaml
alarm_control_panel: !include alarm.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
modbus: !include modbus.yaml
mqtt: !include mqtt.yaml


#Ngnix Konfiguration
http:
    cors_allowed_origins:
        - https://google.com
        - https://www.home-assistant.io
    ip_ban_enabled: true
    login_attempts_threshold: 5
    use_x_forwarded_for: true
    trusted_proxies:
      - 172.30.33.0/24
      
# waste_collection_schedule source configuration
waste_collection_schedule:
  sources:
    - name: abfallnavi_de
      args:
        service: pi
        ort: Moorrege
        strasse: alle Straßen

sensor:
  # ------- Garbage Collection -------
  # next collection
  - platform: waste_collection_schedule
    name: "Nächste Abholung"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
  # Nächste Restabfall-Abholung
  - platform: waste_collection_schedule
    name: "Restabfall"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Restabfall 2wö
  # Nächste Biomüll Abholung
  - platform: waste_collection_schedule
    name: "Biotonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Biotonne
  # Nächste Gelbe Tonne Abholung
  - platform: waste_collection_schedule
    name: "Gelbe Tonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Gelbe Tonne
  # Nächste Papiermüll Abholung
  - platform: waste_collection_schedule
    name: "Papiertonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Papiertonne
template:    
  sensor: 
     - unique_id: gaszaehler_kWh
       name: Gaszähler kWh
       state: "{{ states ('sensor.gasverbrauch_m3_esp_2') | float * 11.5}}"
       unit_of_measurement: kWh
       icon: mdi:meter-gas
       device_class: gas
       state_class: total_increasing 

     - unique_id: gaszaehler_eur
       name: Gaszähler EUR
       state: "{{ (states ('sensor.gaszaehler_kWh') | float * 0.0885)|round(2)}}"
       unit_of_measurement: EUR
       icon: mdi:meter-gas
       device_class: gas
       state_class: total_increasing  
       
     - name: Stromzähler Verbrauch
       unique_id: Stromzaehler_Verbrauch
       unit_of_measurement: kWh
       device_class: energy
       state_class: total_increasing
       state: >-
           {{ float(states('sensor.stromzahler_lk13be_power_total_in')) | round(3) }}
              
     - name: Stromzähler Erzeugung
       unique_id: Stromzaehler_Erzeugung
       unit_of_measurement: kWh
       device_class: energy
       state_class: total_increasing
       state: >-
           {{ float(states('sensor.stromzahler_lk13be_power_total_out')) | round(3) }} 
           
  sensor:
  - platform: template
    sensors:

      # 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.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float) > 0 %}
            {{ states('sensor.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.l1_power'),
              states('sensor.l2_power'),
              states('sensor.l3_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.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float) < 0 %}
            {{ (states('sensor.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float) * -1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.l1_power'),
              states('sensor.l2_power'),
              states('sensor.l3_power')
            ] | map('is_number') | min
          }}"

      # Template sensor for values of power consumption
      power_consumption:
        friendly_name: "Power Consumption"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) < 0 %}
          {% elif (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) > 0 %}
            {{ (states('sensor.power_solargen')|float(0)) - states('sensor.power_export')|float(0) }}    
          {% else %}
            {{ states('sensor.power_import')|float(0) + states('sensor.power_solargen')|float(0) }}
          {% endif %}


  # Sensor for Riemann sum of energy import (W -> Wh)
  - platform: integration
    source: sensor.power_import
    name: energy_import_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy export (W -> Wh)
  - platform: integration
    source: sensor.power_export
    name: energy_export_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy consumption (W -> Wh)
  - platform: integration
    source: sensor.power_consumption
    name: energy_consumption_sum
    unit_prefix: k
    round: 2
    method: left

utility_meter:
  energy_import_daily:
    source: sensor.energy_import_sum
    name: Energy Import Daily
    cycle: daily
  energy_import_monthly:
    source: sensor.energy_import_sum
    name: Energy Import Monthly
    cycle: monthly
  energy_export_daily:
    source: sensor.energy_export_sum
    name: Energy Export Daily
    cycle: daily
  energy_export_monthly:
    source: sensor.energy_export_sum
    name: Energy Export Monthly
    cycle: monthly
  energy_consumption_daily:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Daily
    cycle: daily
  energy_consumption_monthly:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Monthly
    cycle: monthly

Ich vermute eigentlich nur eine kleinigkeit,aber sitze schon wieder 3 Stunden daran :frowning:
gruß Tobias

:crayon:by HarryP: Codezeilen formatiert (bitte immer über </> einbinden)

sorry, aber aus diesem MischMasch an Code und dann einfach kopiertem Text kann man nicht wirklich schlau werden. Pack doch einfach mal deine yaml-Datei in den hier angebotenen Code-Editor, dass man besser sehen kann was da steht und wie es aufgebaut ist.

P.S. ich habe meine configuration.yaml auch massiv entrümpelt und alles in andere yaml-Dateien ausgelagert. Beim Entrümpeln ist am Ende einiges etwas anders im Aufbau als davor. also einfach Copy&Paste in andere yaml-Dateien ist zum Scheitern verurteilt.
Falls Interesse besteht kann ich das hier mal aufzeigen. Muss dann aber mal am Computer sitzen um mich beim Copy&Paste nicht zu verheddern. :joy:
Ich habe einiges an Zeit gebraucht. Eine Kleinigkeit auslagern, testen, reboot, testen, Fehler beheben und das Nächste auslagern.

# Loads default set of integrations. Do not remove.
default_config:


# Text to speech
tts:
  - platform: google_translate

homeassistant:
  packages: !include_dir_named packages
  
automation: !include automations.yaml
alarm_control_panel: !include alarm.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
modbus: !include modbus.yaml
mqtt: !include mqtt.yaml


#Ngnix Konfiguration
http:
    cors_allowed_origins:
        - https://google.com
        - https://www.home-assistant.io
    ip_ban_enabled: true
    login_attempts_threshold: 5
    use_x_forwarded_for: true
    trusted_proxies:
      - 172.30.33.0/24
      
# waste_collection_schedule source configuration
waste_collection_schedule:
  sources:
    - name: abfallnavi_de
      args:
        service: pi
        ort: Moorrege
        strasse: alle Straßen

sensor:
  # ------- Garbage Collection -------
  # next collection
  - platform: waste_collection_schedule
    name: "Nächste Abholung"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
  # Nächste Restabfall-Abholung
  - platform: waste_collection_schedule
    name: "Restabfall"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Restabfall 2wö
  # Nächste Biomüll Abholung
  - platform: waste_collection_schedule
    name: "Biotonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Biotonne
  # Nächste Gelbe Tonne Abholung
  - platform: waste_collection_schedule
    name: "Gelbe Tonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Gelbe Tonne
  # Nächste Papiermüll Abholung
  - platform: waste_collection_schedule
    name: "Papiertonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Papiertonne
      

  
template:    
  sensor: 
     - unique_id: gaszaehler_kWh
       name: Gaszähler kWh
       state: "{{ states ('sensor.gasverbrauch_m3_esp_2') | float * 11.5}}"
       unit_of_measurement: kWh
       icon: mdi:meter-gas
       device_class: gas
       state_class: total_increasing 

     - unique_id: gaszaehler_eur
       name: Gaszähler EUR
       state: "{{ (states ('sensor.gaszaehler_kWh') | float * 0.0885)|round(2)}}"
       unit_of_measurement: EUR
       icon: mdi:meter-gas
       device_class: gas
       state_class: total_increasing  
       
     - name: Stromzähler Verbrauch
       unique_id: Stromzaehler_Verbrauch
       unit_of_measurement: kWh
       device_class: energy
       state_class: total_increasing
       state: >-
           {{ float(states('sensor.stromzahler_lk13be_power_total_in')) | round(3) }}
              
     - name: Stromzähler Erzeugung
       unique_id: Stromzaehler_Erzeugung
       unit_of_measurement: kWh
       device_class: energy
       state_class: total_increasing
       state: >-
           {{ float(states('sensor.stromzahler_lk13be_power_total_out')) | round(3) }} 
           
  sensor:
  - platform: template
    sensors:

      # 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.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float) > 0 %}
            {{ states('sensor.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.l1_power'),
              states('sensor.l2_power'),
              states('sensor.l3_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.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float) < 0 %}
            {{ (states('sensor.l1_power')|float + states('sensor.l2_power')|float + states('sensor.l3_power')|float) * -1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.l1_power'),
              states('sensor.l2_power'),
              states('sensor.l3_power')
            ] | map('is_number') | min
          }}"

      # Template sensor for values of power consumption
      power_consumption:
        friendly_name: "Power Consumption"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) < 0 %}
          {% elif (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) > 0 %}
            {{ (states('sensor.power_solargen')|float(0)) - states('sensor.power_export')|float(0) }}    
          {% else %}
            {{ states('sensor.power_import')|float(0) + states('sensor.power_solargen')|float(0) }}
          {% endif %}


  # Sensor for Riemann sum of energy import (W -> Wh)
  - platform: integration
    source: sensor.power_import
    name: energy_import_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy export (W -> Wh)
  - platform: integration
    source: sensor.power_export
    name: energy_export_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy consumption (W -> Wh)
  - platform: integration
    source: sensor.power_consumption
    name: energy_consumption_sum
    unit_prefix: k
    round: 2
    method: left

utility_meter:
  energy_import_daily:
    source: sensor.energy_import_sum
    name: Energy Import Daily
    cycle: daily
  energy_import_monthly:
    source: sensor.energy_import_sum
    name: Energy Import Monthly
    cycle: monthly
  energy_export_daily:
    source: sensor.energy_export_sum
    name: Energy Export Daily
    cycle: daily
  energy_export_monthly:
    source: sensor.energy_export_sum
    name: Energy Export Monthly
    cycle: monthly
  energy_consumption_daily:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Daily
    cycle: daily
  energy_consumption_monthly:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Monthly
    cycle: monthly

           
  

Nachtrag:
Ich hoffe jetzt ist es übersichtlicher.Leider habe ich vergessen mir die ausgangs config zu speichern,und verzweifel langsam am hin und her.Bin dann schon froh das ich neu starten kann ohne das Fehler drin sind.Nur ist jetzt mein Energie Dashboard leider ohne funktion.
Wenn ich die Config mit der Aufteilung machen möchte ist doch eigentlich der ganze Teil für den Shelly 3em und die Riemann in einer Datei anzulegen,oder nicht?

:crayon:by HarryP: Zusammenführung Doppelpost (bitte “bearbeiten” Funktion nutzen)

Und es gibt keinerlei Backups, in denen sie noch enthalten ist?!

Bekommst du einen Fehler, was nicht passt? Vielleicht steckt der Fehler in der modbus.yaml

Ich bekomme keinen Fehler angezeigt,ich glaube in der Modbus.yaml steht nichts.Habe gestern schon versucht ein Backup wiederherzustellen wo auf jeden Fall noch alles funktioniert hat,aber bezieht sich das Backup nicht nur auf ein Update von einem Progamm?Oder wird auch die Config gesichert?

Es kommt darauf an, ob es ein volles Backup war oder nicht.

Bei einem Full Backup sollten auch alle Config Dateien enthalten sein. Also im Zweifelsfall mal entpacken und schauen wie sie da aussah.

Wenn ich ein Update mache,wird zumindest immer ein Backup gemacht.

Moin,

will mich hier nicht hereindrängen, aber Du kannst ja mal in ein Backup schauen und sollte da dann noch die original configuration.yaml enthalten sein, dann kannst Du nur die extrahieren und auf Dein produktives System zurückkopieren.

VG
Bernd

Wenn du eine leere modbus.yaml einbindest kann dies auch zu Fehlern führen, hatten wir vor zwei Tagen auch schon mal im forum

Kurze Zwischenfrage: wie kann ich ein Backup entpacken? Welches Tool verwendet ihr?

das geht mit 7zip zum Beispiel

Moin,

da ich nur Linux verwende, spielt das bei mir keine Rolle, ich kann das nach dem Download einfach im Dateimanager öffnen.
Das abgelegte Backup ist ein .tar in dem sich dann wieder einzelne .tar.gz Dateien befinden.
Die .tar Dateien sind nicht komprimierte Archive, sie dienen nur dem Sammeln der einzelnen Dateien und Verzeichnisse, die .tar.gz sind dann gezippte Archive, um Platz zu sparen.

Unter KleinWeich kenne ich mich nicht aus, da gibt es aber auch die Packer, die .tar und/oder .tar.gz können.

VG
Bernd

Ok, nun wird es doch etwas länger :wink:

Wenn ich das Full Backup entpacke, mit tar z.B., dann habe ich darin die einzelnen Files:

45df7312_zigbee2mqtt.tar.gz
5c53de3b_esphome.tar.gz
...

Und dann würde ich diese Files auch weiter auspacken wollen. Nur z.B. gunzip sagt:

gunzip 45df7312_zigbee2mqtt.tar.gz                                                                                                                                                                                                                                                                        
gunzip: 45df7312_zigbee2mqtt.tar.gz: not in gzip format

Ähnliches mit 7zip:

7zz e 45df7312_zigbee2mqtt.tar.gz                                                                                                                                                                                                                                                                     <aws:prod>

7-Zip (z) 23.01 (arm64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20
 64-bit arm_v:8 locale=de_DE.UTF-8 Threads:11 OPEN_MAX:256, ASM

Scanning the drive for archives:
1 file, 1952 bytes (2 KiB)

Extracting archive: 45df7312_zigbee2mqtt.tar.gz
ERROR: 45df7312_zigbee2mqtt.tar.gz
45df7312_zigbee2mqtt.tar.gz
Open ERROR: Cannot open the file as [gzip] archive


ERRORS:
Is not archive

Can't open as archive: 1
Files: 0
Size:       0
Compressed: 0

Moin,

arbeitest Du unter Linux oder KleinWeich?

Das Archivformat tar hat da sein eigenes gzip, wenn Du unter Linux arbeitest, dann schau Dir mal die man Page zu tar an.

Wenn Du folgendes auf der Kommandozeile tippst

tar -ztvf 45df7312_zigbee2mqtt.tar.gz

Dann wird Dir nur der Inhalt ausgegeben, das macht das -t = test, das -z = gzip(unzip)

Um dann zu entpacken,

tar -xzvf 45df7312_zigbee2mqtt_proxy.tar.gz

VG
Bernd

Blöder Vorschlag, aber ich würde jetzt alles auskommentieren und dann Schritt für Schritt wieder einkommentieren. :flushed:

Ich weiß ist ein scheiß Job, aber wenn es eh nicht tut und nichts offensichtlich kaputt zu sein scheint, wäre das mein Weg.

Ich habe es soweit wieder am laufen,jetzt würde ich aber trotzdem gerne anfangen bisschen was auszulagern.Wie könnte ich die Ahoy DTU z.b in einer einzelnen *.yaml auslagern?Ich lege mir eine Ahoy.yaml an und kopiere mir den rest aus der config,wie muß jetzt was wo ein oder ausgerückt werden und welche Art von Sensor ist das?

ti# Loads default set of integrations. Do not remove.
default_config:


# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
alarm_control_panel: !include alarm.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
modbus: !include modbus.yaml
mqtt: !include mqtt.yaml


#Ngnix Konfiguration
http:
    cors_allowed_origins:
        - https://google.com
        - https://www.home-assistant.io
    ip_ban_enabled: true
    login_attempts_threshold: 5
    use_x_forwarded_for: true
    trusted_proxies:
      - 172.30.33.0/24
      
# waste_collection_schedule source configuration
waste_collection_schedule:
  sources:
    - name: abfallnavi_de
      args:
        service: pi
        ort: Moorrege
        strasse: alle Straßen

sensor:
  # ------- Garbage Collection -------
  # next collection
  - platform: waste_collection_schedule
    name: "Nächste Abholung"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
  # Nächste Restabfall-Abholung
  - platform: waste_collection_schedule
    name: "Restabfall"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Restabfall 2wö
  # Nächste Biomüll Abholung
  - platform: waste_collection_schedule
    name: "Biotonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Biotonne
  # Nächste Gelbe Tonne Abholung
  - platform: waste_collection_schedule
    name: "Gelbe Tonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Gelbe Tonne
  # Nächste Papiermüll Abholung
  - platform: waste_collection_schedule
    name: "Papiertonne"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Papiertonne

  
  - platform: template
    
    sensors:
      # 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.shelly3em_channel_a_power')|float + states('sensor.shelly3em_channel_b_power')|float + states('sensor.shelly3em_channel_c_power')|float) > 0 %}
            {{ states('sensor.shelly3em_channel_a_power')|float + states('sensor.shelly3em_channel_b_power')|float + states('sensor.shelly3em_channel_c_power')|float }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.shelly3em_channel_a_power'),
              states('sensor.shelly3em_channel_b_power'),
              states('sensor.shelly3em_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.shelly3em_channel_a_power')|float + states('sensor.shelly3em_channel_b_power')|float + states('sensor.shelly3em_channel_c_power')|float) < 0 %}
            {{ (states('sensor.shelly3em_channel_a_power')|float + states('sensor.shelly3em_channel_b_power')|float + states('sensor.shelly3em_channel_c_power')|float) * -1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.shelly3em_channel_a_power'),
              states('sensor.shelly3em_channel_b_power'),
              states('sensor.shelly3em_channel_c_power')
            ] | map('is_number') | min
          }}"
      # Template sensor for values of power consumption
      power_consumption:
        friendly_name: "Power Consumption"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) < 0 %}
          {% elif (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) > 0 %}
            {{ (states('sensor.power_solargen')|float(0)) - states('sensor.power_export')|float(0) }}    
          {% else %}
            {{ states('sensor.power_import')|float(0) + states('sensor.power_solargen')|float(0) }}
          {% endif %}
     

  # Sensor for Riemann sum of energy import (W -> Wh)
  - platform: integration
    source: sensor.power_import
    name: energy_import_sum
    unit_prefix: k
    round: 2
    method: left
  # Sensor for Riemann sum of energy export (W -> Wh)
  - platform: integration
    source: sensor.power_export
    name: energy_export_sum
    unit_prefix: k
    round: 2
    method: left
  # Sensor for Riemann sum of energy consumption (W -> Wh)
  - platform: integration
    source: sensor.power_consumption
    name: energy_consumption_sum
    unit_prefix: k
    round: 2
    method: left
    
utility_meter:
  energy_import_daily:
    source: sensor.energy_import_sum
    name: Energy Import Daily
    cycle: daily
  energy_import_monthly:
    source: sensor.energy_import_sum
    name: Energy Import Monthly
    cycle: monthly
  energy_export_daily:
    source: sensor.energy_export_sum
    name: Energy Export Daily
    cycle: daily
  energy_export_monthly:
    source: sensor.energy_export_sum
    name: Energy Export Monthly
    cycle: monthly
  energy_consumption_daily:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Daily
    cycle: daily
  energy_consumption_monthly:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Monthly
    cycle: monthly
  gaszaehler_daily:
    source: sensor.gaszaehler_eur
    cycle: daily
    name: Gas Tageskosten
  gaszaehler_monthly:
    source: sensor.gaszaehler_eur
    cycle: monthly
    name: Gas Monatsverbrauch
  gaszaehler_yearly:
    source: sensor.gaszaehler_eur
    cycle: yearly
    name: Gas Jahresverbrauch
  
template:    
  sensor:
     - unique_id: gaszaehler_kWh
       name: Gaszähler kWh
       state: "{{ states ('sensor.gasverbrauch_m3_esp_2') | float * 11.5}}"
       unit_of_measurement: kWh
       icon: mdi:meter-gas
       device_class: gas
       state_class: total_increasing 

     - unique_id: gaszaehler_eur
       name: Gaszähler EUR
       state: "{{ (states ('sensor.gaszaehler_kWh') | float * 0.0885)|round(2)}}"
       unit_of_measurement: EUR
       icon: mdi:meter-gas
       device_class: gas
       state_class: total_increasing  
       
     - name: Stromzähler Verbrauch
       unique_id: Stromzaehler_Verbrauch
       unit_of_measurement: kWh
       device_class: energy
       state_class: total_increasing
       state: >-
           {{ float(states('sensor.stromzahler_lk13be_power_total_in')) | round(3) }}
              
     - name: Stromzähler Erzeugung
       unique_id: Stromzaehler_Erzeugung
       unit_of_measurement: kWh
       device_class: energy
       state_class: total_increasing
       state: >-
           {{ float(states('sensor.stromzahler_lk13be_power_total_out')) | round(3) }} 
    
#Maehroboter  
mqtt:
  sensor:
    - name: "Maehroboter Batterie"
      state_topic: "automower /mower/battery/charge"
      device_class: battery
      unit_of_measurement: " "
      unique_id: "maehroboter_batterie"
      icon: mdi:battery
      
    - name: "Maehroboter gestoppt"
      state_topic: "automower /mower/stopped"
      unique_id: "maehroboter_gestoppt"
      icon: mdi:octagon
      
    - name: "Maehroboter Wifi Signal"
      state_topic: "automower /wlan/rssi"
      unit_of_measurement: " "
      unique_id: "maehroboter_wifi_signal"
      icon: mdi:wifi
      
    - name: "Maehroboter Status raw"
      state_topic: "automower /mower/status"
      unique_id: "maehroboter_status_raw"
      icon: mdi:list-status
      
    - name: "Maehroboter Zeit im aktuellen Status"
      state_topic: "automower /mower/status/duration"
      unique_id: "maehroboter_zeit_im_aktuellen_status"
      unit_of_measurement: " "
      
    - name: "Maehroboter Mode RAW"
      state_topic: "automower /mower/mode"
      unique_id: "maehroboter_mode_raw"
      
    - name: "Maehroboter Betriebsstunden"
      state_topic: "automower /mower/statistic/hours"
      unit_of_measurement: "Stunden"
      unique_id: "maehroboter_betriebsstunden"
      icon: mdi:timer-sand
      
    - name: "Maehroboter Fehlercode"
      state_topic: "automower /mower/error/code"
      unique_id: "maehroboter_fehlercode"
      icon: mdi:alert-circle
      
    - name: "Maehroboter Fehlernachricht"
      state_topic: "automower /mower/error/message"
      unique_id: "maehroboter_fehlernachricht"
      icon: mdi:alert-circle
      
    - name: "Maehroboter Messerqualität"
      state_topic: "automower /mower/blades/quality"
      unit_of_measurement: "%"
      unique_id: "maehroboter_messerqualität"
      icon: mdi:terraform
      
    - name: "Maehroboter Wetterstop"
      state_topic: "automower /weather/data/break"
      unique_id: "maehroboter_wetterstop"
      icon: mdi:stop
      
    - name: "Maehroboter Status"
      state_topic: "automower /mower/status"
      unique_id: "maehroboter_status"
      value_template:  >
          {% if is_state("sensor.maehroboter_status_raw", "0") -%}
            Erkenne Status
          {% elif is_state("sensor.maehroboter_status_raw", "1") -%}
            Parkt
          {% elif is_state("sensor.maehroboter_status_raw", "2") -%}
            Mäht
          {% elif is_state("sensor.maehroboter_status_raw", "3") -%}
            Fährt heim
          {% elif is_state("sensor.maehroboter_status_raw", "4") -%}
            Lädt
          {% elif is_state("sensor.maehroboter_status_raw", "5") -%}
            Sucht
          {% elif is_state("sensor.maehroboter_status_raw", "7") -%}
            Fehler
          {% elif is_state("sensor.maehroboter_status_raw", "16") -%}
            Aus
          {% elif is_state("sensor.maehroboter_status_raw", "17") -%}
            Schläft
          {% elif is_state("sensor.maehroboter_status_raw", "18") -%}
            Wartet_auf_Garagentor
          {% else -%}
            Versuche herauszufinden was {{ states("sensor.maehroboter_status_raw") }} bedeutet
          {%- endif %}  
    
    # HM-300/#
    - name: "AHOY comm_start"
      state_topic: ahoy/comm_start
    - name: "AHOY comm_start_extended"
      state_topic: ahoy/comm_start
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY comm_stop"
      state_topic: ahoy/comm_stop
    - name: "AHOY comm_stop_extended"
      state_topic: ahoy/comm_stop
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY dis_night_comm"
      state_topic: ahoy/dis_night_comm
    - name: "AHOY mqtt"
      state_topic: ahoy/mqtt
    - name: "AHOY status"
      state_topic: ahoy/status
    - name: "AHOY status extended"
      state_topic: ahoy/status
      value_template: >-
        {% if (value | int) == 0 %}
          offline
        {% elif (value | int) == 1 %}
          partial
        {% elif (value | int) == 2 %}
          online
        {% endif %}
    - name: "AHOY sunrise"
      state_topic: ahoy/sunrise
    - name: "AHOY sunrise_extended"
      state_topic: ahoy/sunrise
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY sunset"
      state_topic: ahoy/sunset
    - name: "AHOY sunset_extended"
      state_topic: ahoy/sunset
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY Uptime"
      state_topic: ahoy/uptime
      unit_of_measurement: "s"
    - name: "AHOY Uptime_extended"
      state_topic: ahoy/uptime
      value_template: >
        {% set uptime =value | int %}
        {% set days = (uptime / 86400) | int %}
        {%- if days > 0 -%}
          {{ days }}Tage {{ (uptime - (days * 86400)) | int | timestamp_custom('%-Hh %-Mm', false) }}
        {%- else -%}
          {{ uptime | int | timestamp_custom('%-Hh %-Mm', false) }}
        {%- endif -%}
    - name: "AHOY Version"
      state_topic: ahoy/version
    - name: "AHOY Device"
      state_topic: ahoy/device
    - name: "AHOY WiFi"
      state_topic: ahoy/wifi_rssi
      unit_of_measurement: "dBm"
    - name: "AHOY Gesamtertrag"
      state_topic: ahoy/YieldTotal
      unit_of_measurement: "kWh"
    #<TOPIC>/<INVERTER_NAME_FROM_SETUP>/#
    - name: "AHOY available"
      state_topic: ahoy/HM-300/available
    - name: "AHOY available extended"
      state_topic: ahoy/HM-300/available
      value_template: >-
        {% if (value | int) == 0 %}
          not available and not producing
        {% elif (value | int) == 1 %}
          available but not producing
        {% elif (value | int) == 2 %}
          available and producing
        {% endif %}
    - name: "AHOY last_success"
      state_topic: ahoy/HM-300/last_success
    - name: "AHOY last_success_extended"
      state_topic: ahoy/HM-300/last_success
      value_template: >
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    #Basic <TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch0/#
    - name: "AHOY U_AC"
      state_topic: ahoy/HM-300/ch0/U_AC
      unit_of_measurement: "V"
    - name: "AHOY I_AC"
      state_topic: ahoy/HM-300/ch0/I_AC
      unit_of_measurement: "A"
    - name: "AHOY P_AC"
      state_topic: ahoy/HM-300/ch0/P_AC
      unit_of_measurement: "W"
    - name: "AHOY Q_AC"
      state_topic: ahoy/HM-300/ch0/Q_AC
    - name: "AHOY F_AC"
      state_topic: ahoy/HM-300/ch0/F_AC
      unit_of_measurement: "Hz"
    - name: "AHOY PF_AC"
      state_topic: ahoy/HM-300/ch0/PF_AC
    - name: "AHOY Temperatur"
      state_topic: ahoy/HM-300/ch0/Temp
      unit_of_measurement: "°C"
    - name: "AHOY EVT"
      state_topic: ahoy/HM-300/ch0/EVT
    - name: "AHOY YieldDay"
      state_topic: ahoy/HM-300/ch0/YieldDay
      device_class: energy
      unit_of_measurement: "Wh"
    - name: "AHOY YieldTotal"
      state_topic: ahoy/HM-300/ch0/YieldTotal
      device_class: energy
      unit_of_measurement: "kWh"
    - name: "AHOY P_DC"
      state_topic: ahoy/HM-300/ch0/P_DC
      unit_of_measurement: "W"
    - name: "AHOY Efficiency"
      state_topic: ahoy/HM-300/ch0/Efficiency
      unit_of_measurement: "%"
    - name: "AHOY FWVersion"
      state_topic: ahoy/HM-300/ch0/FWVersion
    - name: "AHOY FWBuildYear"
      state_topic: ahoy/HM-300/ch0/FWBuildYear
    - name: "AHOY FWBuildMonthDay"
      state_topic: ahoy/HM-300/ch0/FWBuildMonthDay
    - name: "AHOY HWPartID"
      state_topic: ahoy/HM-300/ch0/HWPartId
    - name: "AHOY PowerLimit"
      state_topic: ahoy/HM-300/ch0/PowerLimit
    - name: "AHOY LastAlarmCode"
      state_topic: ahoy/HM-300/ch0/LastAlarmCode
    #Panel 1 - UNTEN - <TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch<CHANNEL_NUMBER>/#
    - name: "AHOY U_DC 1"
      state_topic: ahoy/HM-300/ch1/U_DC
      unit_of_measurement: "V"
    - name: "AHOY I_DC 1"
      state_topic: ahoy/HM-300/ch1/I_DC
      unit_of_measurement: "A"
    - name: "AHOY P_DC 1"
      state_topic: ahoy/HM-300/ch1/P_DC
      unit_of_measurement: "W"
    - name: "AHOY YieldDay 1"
      state_topic: ahoy/HM-300/ch1/YieldDay
      unit_of_measurement: "Wh"
    - name: "AHOY YieldTotal 1"
      state_topic: ahoy/HM-300/ch1/YieldTotal
      unit_of_measurement: "kWh"
    - name: "AHOY Irradiation 1"
      state_topic: ahoy/HM-300/ch1/P_DC
      unit_of_measurement: "%"
    #Panel 2 - OBEN - <TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch<CHANNEL_NUMBER>/#
    - name: "AHOY U_DC 2"
      state_topic: ahoy/HM-300/ch2/U_DC
      unit_of_measurement: "V"
    - name: "AHOY I_DC 2"
      state_topic: ahoy/HM-300/ch2/I_DC
      unit_of_measurement: "A"
    - name: "AHOY P_DC 2"
      state_topic: ahoy/HM-300/ch2/P_DC
      unit_of_measurement: "W"
    - name: "AHOY YieldDay 2"
      state_topic: ahoy/HM-300/ch2/YieldDay
      unit_of_measurement: "Wh"
    - name: "AHOY YieldTotal 2"
      state_topic: ahoy/HM-300/ch2/YieldTotal
      unit_of_measurement: "kWh"
    - name: "AHOY Irradiation 2"
      state_topic: ahoy/HM-300/ch2/P_DC
      unit_of_measurement: "%"  ppe oder füge den Code hier ein

Wenn Du mit packages arbeiten willst.
Einfach in der configuration.yaml dies Zeile hinzufügen:

homeassistant:
  packages: !include_dir_named packages

Im Verzeichnis /config den Ordner packages erstellen.

Konfiguration prüfen und Home Assistant Neustarten.

Nun kannst Du die yaml Dateien im Ordner packages erstellen und 1:1 die Konfiguration dort auslagern.

Gruß
Osorkon

2 „Gefällt mir“

Das habe ich beim letzten Mal versucht,bis dann nichts mehr ging.Ich dachte ich fange mit der Ahoy DTU an.Nur was muss ich noch ändern?Ich habe mit dem Einrücken usw Probleme

Eine Datei im Ordner packages erstellen. z.B. ahoy.yaml
In der configuration.yaml alles ab der Zeiler # HM-300/# und in die ahoy.yaml einfügen. Zusätzlich die Zeilen

mqtt:
  sensor:

hinzufügen.

#/packages/ahoy.yaml
mqtt:
  sensor:
    # HM-300/#
    - name: "AHOY comm_start"
      state_topic: ahoy/comm_start
    - name: "AHOY comm_start_extended"
      state_topic: ahoy/comm_start
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY comm_stop"
      state_topic: ahoy/comm_stop
    - name: "AHOY comm_stop_extended"
      state_topic: ahoy/comm_stop
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY dis_night_comm"
      state_topic: ahoy/dis_night_comm
    - name: "AHOY mqtt"
      state_topic: ahoy/mqtt
    - name: "AHOY status"
      state_topic: ahoy/status
    - name: "AHOY status extended"
      state_topic: ahoy/status
      value_template: >-
        {% if (value | int) == 0 %}
          offline
        {% elif (value | int) == 1 %}
          partial
        {% elif (value | int) == 2 %}
          online
        {% endif %}
    - name: "AHOY sunrise"
      state_topic: ahoy/sunrise
    - name: "AHOY sunrise_extended"
      state_topic: ahoy/sunrise
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY sunset"
      state_topic: ahoy/sunset
    - name: "AHOY sunset_extended"
      state_topic: ahoy/sunset
      value_template: >-
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    - name: "AHOY Uptime"
      state_topic: ahoy/uptime
      unit_of_measurement: "s"
    - name: "AHOY Uptime_extended"
      state_topic: ahoy/uptime
      value_template: >
        {% set uptime =value | int %}
        {% set days = (uptime / 86400) | int %}
        {%- if days > 0 -%}
          {{ days }}Tage {{ (uptime - (days * 86400)) | int | timestamp_custom('%-Hh %-Mm', false) }}
        {%- else -%}
          {{ uptime | int | timestamp_custom('%-Hh %-Mm', false) }}
        {%- endif -%}
    - name: "AHOY Version"
      state_topic: ahoy/version
    - name: "AHOY Device"
      state_topic: ahoy/device
    - name: "AHOY WiFi"
      state_topic: ahoy/wifi_rssi
      unit_of_measurement: "dBm"
    - name: "AHOY Gesamtertrag"
      state_topic: ahoy/YieldTotal
      unit_of_measurement: "kWh"
    #<TOPIC>/<INVERTER_NAME_FROM_SETUP>/#
    - name: "AHOY available"
      state_topic: ahoy/HM-300/available
    - name: "AHOY available extended"
      state_topic: ahoy/HM-300/available
      value_template: >-
        {% if (value | int) == 0 %}
          not available and not producing
        {% elif (value | int) == 1 %}
          available but not producing
        {% elif (value | int) == 2 %}
          available and producing
        {% endif %}
    - name: "AHOY last_success"
      state_topic: ahoy/HM-300/last_success
    - name: "AHOY last_success_extended"
      state_topic: ahoy/HM-300/last_success
      value_template: >
        {{ value | int | timestamp_custom('%d.%m.%Y %H:%M:%S') }}
    #Basic <TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch0/#
    - name: "AHOY U_AC"
      state_topic: ahoy/HM-300/ch0/U_AC
      unit_of_measurement: "V"
    - name: "AHOY I_AC"
      state_topic: ahoy/HM-300/ch0/I_AC
      unit_of_measurement: "A"
    - name: "AHOY P_AC"
      state_topic: ahoy/HM-300/ch0/P_AC
      unit_of_measurement: "W"
    - name: "AHOY Q_AC"
      state_topic: ahoy/HM-300/ch0/Q_AC
    - name: "AHOY F_AC"
      state_topic: ahoy/HM-300/ch0/F_AC
      unit_of_measurement: "Hz"
    - name: "AHOY PF_AC"
      state_topic: ahoy/HM-300/ch0/PF_AC
    - name: "AHOY Temperatur"
      state_topic: ahoy/HM-300/ch0/Temp
      unit_of_measurement: "°C"
    - name: "AHOY EVT"
      state_topic: ahoy/HM-300/ch0/EVT
    - name: "AHOY YieldDay"
      state_topic: ahoy/HM-300/ch0/YieldDay
      device_class: energy
      unit_of_measurement: "Wh"
    - name: "AHOY YieldTotal"
      state_topic: ahoy/HM-300/ch0/YieldTotal
      device_class: energy
      unit_of_measurement: "kWh"
    - name: "AHOY P_DC"
      state_topic: ahoy/HM-300/ch0/P_DC
      unit_of_measurement: "W"
    - name: "AHOY Efficiency"
      state_topic: ahoy/HM-300/ch0/Efficiency
      unit_of_measurement: "%"
    - name: "AHOY FWVersion"
      state_topic: ahoy/HM-300/ch0/FWVersion
    - name: "AHOY FWBuildYear"
      state_topic: ahoy/HM-300/ch0/FWBuildYear
    - name: "AHOY FWBuildMonthDay"
      state_topic: ahoy/HM-300/ch0/FWBuildMonthDay
    - name: "AHOY HWPartID"
      state_topic: ahoy/HM-300/ch0/HWPartId
    - name: "AHOY PowerLimit"
      state_topic: ahoy/HM-300/ch0/PowerLimit
    - name: "AHOY LastAlarmCode"
      state_topic: ahoy/HM-300/ch0/LastAlarmCode
    #Panel 1 - UNTEN - <TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch<CHANNEL_NUMBER>/#
    - name: "AHOY U_DC 1"
      state_topic: ahoy/HM-300/ch1/U_DC
      unit_of_measurement: "V"
    - name: "AHOY I_DC 1"
      state_topic: ahoy/HM-300/ch1/I_DC
      unit_of_measurement: "A"
    - name: "AHOY P_DC 1"
      state_topic: ahoy/HM-300/ch1/P_DC
      unit_of_measurement: "W"
    - name: "AHOY YieldDay 1"
      state_topic: ahoy/HM-300/ch1/YieldDay
      unit_of_measurement: "Wh"
    - name: "AHOY YieldTotal 1"
      state_topic: ahoy/HM-300/ch1/YieldTotal
      unit_of_measurement: "kWh"
    - name: "AHOY Irradiation 1"
      state_topic: ahoy/HM-300/ch1/P_DC
      unit_of_measurement: "%"
    #Panel 2 - OBEN - <TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch<CHANNEL_NUMBER>/#
    - name: "AHOY U_DC 2"
      state_topic: ahoy/HM-300/ch2/U_DC
      unit_of_measurement: "V"
    - name: "AHOY I_DC 2"
      state_topic: ahoy/HM-300/ch2/I_DC
      unit_of_measurement: "A"
    - name: "AHOY P_DC 2"
      state_topic: ahoy/HM-300/ch2/P_DC
      unit_of_measurement: "W"
    - name: "AHOY YieldDay 2"
      state_topic: ahoy/HM-300/ch2/YieldDay
      unit_of_measurement: "Wh"
    - name: "AHOY YieldTotal 2"
      state_topic: ahoy/HM-300/ch2/YieldTotal
      unit_of_measurement: "kWh"
    - name: "AHOY Irradiation 2"
      state_topic: ahoy/HM-300/ch2/P_DC
      unit_of_measurement: "%"  ppe oder füge den Code hier ein

Konfiguration prüfen und im Anschluß die MANUELL KONFIGURIERTE MQTT-ENTITÄTEN Konfiguration neu laden.
Gruß
Osorkon

1 „Gefällt mir“