Sensor nach eine x-Minuten kopieren

Hallo zusammen,

ich will einen Sensor in gewissen Abständen (z.B. 15 Minuten) duplizieren. Hintergrund ist, der Eingangsensor liefert alle paar Sekunden einen Wert. Den Zielwert will ich in Grafana abspeichern. Damit sich nicht zu viele Daten Grafana ansammeln, will ich den Eingangsensor in gewissen Abständen kopieren.

Der folgend Eintrag in “template.yaml” funktioniert bis auf den timer. Was mache ich da falsch? Hab schon zahlreiche Varianten ausprobiert, aber nichts hat funktioniert.

 - sensor:
    - name: “ziel_sensor”
      unit_of_measurement: “°C”
      state: “{{ states(‘sensor.eingangs_sensor’) }}”
      unique_id: test_uuid
    - trigger:
      platform: time_pattern
      minutes: “/5

Vielleicht weiß jemand, wie das klappen könnte.

Sorry, die formatierung klappt irgendwie nicht ganz

Viele Grüße und besten Dank schon mal vorab

Grafana sammelt keine Daten, sondern die db welche Du mit Grafana verbunden hast.

Der template Sensor sollte so aussehen:

template:
  - triggers:
      trigger: time_pattern
      minutes: /5
    sensor:
      - name: Ziel Sensor
        state: |
          {{ states('sensor.eingangs_sensor') | float(0) }}
        state_class: measurement
        device_class: temperature
        unit_of_measurement: "°C"
        unique_id: 019cab35-7689-7251-910c-cee858fa4e61

Doku Template Sensor:

Gruß Osorkon

Kenne ich, aber es klappt nicht. Folgende Fehlermeldung bekomme ich:

Logger: homeassistant.config
Quelle: config.py:354
Erstmals aufgetreten: 17:38:36 (21 Vorkommnisse)
Zuletzt protokolliert: 22:31:45

Invalid config for ‘template’ at template.yaml, line 946: ‘name’ is an invalid option for ‘template’, check: name Invalid config for ‘template’ at template.yaml, line 946: ‘sensor’ is an invalid option for ‘template’, check: sensor Invalid config for ‘template’ at template.yaml, line 946: ‘state’ is an invalid option for ‘template’, check: state Invalid config for ‘template’ at template.yaml, line 946: ‘unique_id’ is an invalid option for ‘template’, check: unique_id Invalid config for ‘template’ at template.yaml, line 946: ‘unit_of_measurement’ is an invalid option for ‘template’, check: unit_of_measurement
Invalid config for ‘template’ at template.yaml, line 949: ‘for’ is an invalid option for ‘template’, check: for
Invalid config for ‘template’ at template.yaml, line 932: ‘sensor’ is an invalid option for ‘template’, check: sensor
Invalid config for ‘template’ at template.yaml, line 952: required key ‘trigger’ not provided
Invalid config for ‘template’ at template.yaml, line 953: required key ‘trigger’ not provided

Der Statement in template.yaml sieht so aus:

YAML und Einrückungen. :grin:
Du solltest auch den Code unverändert bzw. korrekt übernehmen. :wink:

Ab Zeile 935, gehört alles 2 Stellen nach Links. Also ab Zeile sensor:

Gruß Osorkon

Ähnlicher Fehler

Logger: homeassistant.config
Quelle: config.py:354
Erstmals aufgetreten: 17:38:36 (25 Vorkommnisse)
Zuletzt protokolliert: 23:06:14

Invalid config for ‘template’ at template.yaml, line 946: ‘name’ is an invalid option for ‘template’, check: name Invalid config for ‘template’ at template.yaml, line 946: ‘sensor’ is an invalid option for ‘template’, check: sensor Invalid config for ‘template’ at template.yaml, line 946: ‘state’ is an invalid option for ‘template’, check: state Invalid config for ‘template’ at template.yaml, line 946: ‘unique_id’ is an invalid option for ‘template’, check: unique_id Invalid config for ‘template’ at template.yaml, line 946: ‘unit_of_measurement’ is an invalid option for ‘template’, check: unit_of_measurement
Invalid config for ‘template’ at template.yaml, line 949: ‘for’ is an invalid option for ‘template’, check: for
Invalid config for ‘template’ at template.yaml, line 932: ‘sensor’ is an invalid option for ‘template’, check: sensor
Invalid config for ‘template’ at template.yaml, line 952: required key ‘trigger’ not provided
Invalid config for ‘template’ at template.yaml, line 953: required key ‘trigger’ not provided

Gruß

Richard

Was hast Du den ab Zeile 945 und folgende stehen?
Da sind noch weitere Fehler.

Gruß Osorkon

Es hat jetzt geklappt. Der Fehler lag in der Datei weiter unten. Da hat es wohl eine Konflikt gegeben, welche ich nicht gesehen habe.

Besten Dank.