Hilfe bei Home Assistant Fehler (BKW)

Gabriel7

New member
Hallo zusammen,
Ich habe mich hier im Forum angemeldet, da ich ein Problem mit meinem HO habe und nicht ganz so fit dabei bin und bitte euer Unterstützung brauche.
Ich habe mir ein Energy Dashboard erstellt, und meine Ersparniss wird errechnet.

Folgendes Bild, die 3 Fehler habe ich und meine Gesamtersparnis wird nicht mehr berechnet.

Anbei noch der Code:




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

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

template:
  - sensor:
      - name: "Power Total"
        unique_id: power_total
        unit_of_measurement: W
        device_class: power
        state: >
          {{ states('sensor.shelly_pro_3_em_phase_a_active_power')|float(0) +
             states('sensor.shelly_pro_3_em_phase_b_active_power')|float(0) +
             states('sensor.shelly_pro_3_em_phase_c_active_power')|float(0) }}
        availability: >
          {{ [ states('sensor.shelly_pro_3_em_phase_a_active_power'),
                states('sensor.shelly_pro_3_em_phase_b_active_power'),
                states('sensor.shelly_pro_3_em_phase_c_active_power') ] | map('is_number') | min }}

      - name: "Power vom Netz (Watt)"
        unique_id: power_vom_netz
        unit_of_measurement: W
        device_class: power
        state: >
          {% if states('sensor.power_total') | float(0) >= 0 %}
              {{ states('sensor.power_total') | float(0) | round(3) }}
          {% else %}
              {{ (0.0) | round(3) }}
          {% endif %}
        availability: >
          {{ [ states('sensor.power_total') ] | map('is_number') | min }}

      - name: "Power ins Netz (Watt)"
        unique_id: power_ins_netz
        unit_of_measurement: W
        device_class: power
        state: >
          {% if states('sensor.power_total') | float(0) < 0 %}
              {{ (states('sensor.power_total') | float(0) * -1) | round(3) }}
          {% else %}
              {{ (0.0) | round(3) }}
          {% endif %}
        availability: >
          {{ [ states('sensor.power_total') ] | map('is_number') | min }}

switch:
  - platform: mystrom
    name: mystrom_switch_1
    host: 192.168.178.66
  - platform: mystrom
    name: mystrom_switch_2
    host: 192.168.178.26

sensor:
  - platform: rest
    name: "mystrom_power_1"
    resource: http://192.168.178.66/report
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: "{{ value_json.power }}"
  - platform: integration
    source: sensor.mystrom_power_1
    name: "mystrom Energy Consumption 1"
    unit_prefix: k
    round: 3
  - platform: rest
    name: "mystrom_power_2"
    resource: http://192.168.178.26/report
    method: GET
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    value_template: "{{ value_json.power }}"
  - platform: integration
    source: sensor.mystrom_power_2
    name: "mystrom Energy Consumption 2"
    unit_prefix: k
    round: 3

  - platform: template
    sensors:
      solar_eigenverbrauch_watt:
        unique_id: solar_eigenverbrauch_watt
        unit_of_measurement: W
        device_class: power
        value_template: >
          {% if states('sensor.power_total') | float(0) < 0 %}
              {{ (states('sensor.power_total') | float(0) +
                   states('sensor.mystrom_device_leistung') | float(0) +
                   states('sensor.mystrom_haus_leistung') | float(0)) | round(3) }}
          {% else %}
              {{ (states('sensor.mystrom_device_leistung') | float(0) +
                   states('sensor.mystrom_haus_leistung') | float(0)) | round(3) }}
          {% endif %}
        availability_template: >
          {{ [ states('sensor.power_total'),
                states('sensor.mystrom_device_leistung'),
                states('sensor.mystrom_haus_leistung') ] | map('is_number') | min }}

      balkonsolar_vorteil:
        unique_id: balkonsolar_vorteil
        unit_of_measurement: EUR/h
        value_template: >
          {{ states('sensor.solar_eigenverbrauch_watt')|float(0) *
             states('input_number.strompreis')|float(0) / 1000 }}
 

Anhänge

  • IMG_8305.png
    IMG_8305.png
    218,7 KB · Aufrufe: 6
Zuletzt bearbeitet:
Hallo @Gabriel7,

ging das die ganze Zeit?
Dann hängt das vermutlich mit dem neuen Core-Update zusammen.
https://www.home-assistant.io/blog/2024/10/02/release-202410/#improved-yaml-syntax-for-automations

Es haben sich viele Schreibweisen geändert...
1728362339633.png

Überprüfe mal Deine *.yaml dahingehend...., ob da eine Änderung mit anhängen von einem "s" plural was bringt...

Ist nur eine Vermutung von mir.
Vermutlich sind noch andere Verursacher darin versteckt.
Aber die Profis melden sich noch dazu...

Von Dir alt..
YAML:
template:
  - sensor:
      - name: "Power Total"
        unique_id: power_total
        unit_of_measurement: W
        device_class: power
        state: >

Von mir neu....
YAML:
template:
  - sensors:
      - name: "Power Total"
        unique_id: power_total
        unit_of_measurement: W
        device_class: power
        state: >

Mach aber vorher ein Backup und sichere das weg...
Taste Dich langsam ran und mache immer vorher eine Validierung des Codes...
 
Zuletzt bearbeitet:
die alte Syntax ist nach wie for valid - abgesehen davon, das an sensor nichts geändert wurde.
The result of all this is that YAML automation syntax now has triggers with multiple trigger definitions, conditions with multiple condition definitions, and actions with multiple action definitions.
As with the other syntax changes we’ve done recently, this is not a breaking change, and there will be no deprecation. The previous syntax will continue to work, and there are no plans to remove the old syntax.
 
Zuletzt bearbeitet:
Hallo zusammen,

hier ganz am Schluss benutzt er aber bei "platform: template" den Ausdruck "sensors" selber... und oben nur "sensor".
Kann eine Bedeutung haben, muss es aber nicht...
Die Profis sind da mehr in der Materie als ich..
Oder das "s" muss dann überall weg, wo es benutzt wird.

YAML:
  - platform: template
    sensors:
      solar_eigenverbrauch_watt:
        unique_id: solar_eigenverbrauch_watt
        unit_of_measurement: W
        device_class: power
        value_template: >
          {% if states('sensor.power_total') | float(0) < 0 %}
              {{ (states('sensor.power_total') | float(0) +
                   states('sensor.mystrom_device_leistung') | float(0) +
                   states('sensor.mystrom_haus_leistung') | float(0)) | round(3) }}
          {% else %}
              {{ (states('sensor.mystrom_device_leistung') | float(0) +
                   states('sensor.mystrom_haus_leistung') | float(0)) | round(3) }}
          {% endif %}
        availability_template: >
          {{ [ states('sensor.power_total'),
                states('sensor.mystrom_device_leistung'),
                states('sensor.mystrom_haus_leistung') ] | map('is_number') | min }}

      balkonsolar_vorteil:
        unique_id: balkonsolar_vorteil
        unit_of_measurement: EUR/h
        value_template: >
          {{ states('sensor.solar_eigenverbrauch_watt')|float(0) *
             states('input_number.strompreis')|float(0) / 1000 }}
 
Fehlende Zustandsklasse, also state_class. Kann es sein, dass eine zusätzliche Angabe wie state_class: measurement bei jedem Sensor den Fehler beheben würde? Das ist jetzt allerdings nur geraten, da ich in dem Thema echt null drin bin - den Wert "measurement" habe ich in dem Kontext nur schon öfters gesehen.
 

Zurzeit aktive Besucher

Letzte Anleitungen

Statistik des Forums

Themen
5.389
Beiträge
53.359
Mitglieder
5.177
Neuestes Mitglied
griessbx
Zurück
Oben