Einen Entitätsustand alle 5 Min überprüfen?

HI!

Ich habe ein Tor welches Mir beim Öffnen eine Meldung ausgibt. Das funktioniert bestens.

Nun wollte ich gern das Tor auch “überwachen” sodass wenn es offen ist mir alle ca 5 Min eine neue meldung ausgibt.

Was mach in diesem Fall mehr Sinnn ohne HA irgendwie unsinnig auszulasten?

Ist es unproblematisch alle 5 Min zu checken ob das tor offen ist und dann einne Meldung abzusetzen oder gibt es bessere Alternativen?

Ware das so in Ordnung?
Ist dann der zweite Wenn/Dann Abschnitt…

alias: Tor Steht Offen!
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.hm_sec_sco_oeq1428806
    from: "off"
    to: "on"
    id: Haustür Geöffnet
  - trigger: state
    entity_id:
      - binary_sensor.hm_sec_sco_oeq1429441
    from: "off"
    to: "on"
    id: Terrassentür geöffnet
  - trigger: time_pattern
    minutes: "5"
    id: Alle 5min
conditions: []
actions:
  - if:
      - condition: trigger
        id:
          - Haustür Geöffnet
          - Terrassentür geöffnet
      - condition: state
        entity_id: binary_sensor.8ksensorbueroip_sensor_2_torip_ch2
        state: "on"
      - condition: not
        conditions:
          - condition: time
            after: "03:55:00"
            before: "04:45:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
          - condition: time
            after: "05:15:00"
            before: "06:20:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
          - condition: time
            after: "07:10:00"
            before: "07:35:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
    then:
      - action: media_player.play_media
        target:
          entity_id: media_player.mpd
        data:
          media_content_id: media-source://media_source/local/mpd/media/TorStehtOffen.mp3
          media_content_type: audio/mpeg
        metadata:
          title: TorStehtOffen.mp3
          thumbnail: null
          media_class: music
          children_media_class: null
          navigateIds:
            - {}
            - media_content_type: app
              media_content_id: media-source://media_source
            - media_content_type: ""
              media_content_id: media-source://media_source/local/mpd
            - media_content_type: ""
              media_content_id: media-source://media_source/local/mpd/media
  - if:
      - condition: trigger
        id:
          - Alle 5min
      - condition: state
        entity_id: binary_sensor.8ksensorbueroip_sensor_2_torip_ch2
        state: "on"
      - condition: not
        conditions:
          - condition: time
            after: "03:55:00"
            before: "04:45:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
          - condition: time
            after: "05:15:00"
            before: "06:20:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
          - condition: time
            after: "07:10:00"
            before: "07:35:00"
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
    then:
      - action: media_player.play_media
        target:
          entity_id: media_player.mpd
        data:
          media_content_id: media-source://media_source/local/mpd/media/TorStehtOffen.mp3
          media_content_type: audio/mpeg
        metadata:
          title: TorStehtOffen.mp3
          thumbnail: null
          media_class: music
          children_media_class: null
          navigateIds:
            - {}
            - media_content_type: app
              media_content_id: media-source://media_source
            - media_content_type: ""
              media_content_id: media-source://media_source/local/mpd
            - media_content_type: ""
              media_content_id: media-source://media_source/local/mpd/media
mode: single

Die 5 Minuten belasten sicherlich nicht das System. Du müsstest das Pattern aber so schreiben: /5
Sonst triggert es immer nur um 5 nach jeder vollen Stunde.

Ich würde es evtl. mit einem Repeat in der Aktion machen

repeat:
  sequence:
    - action: notify.mobile_app_maxe
      metadata: {}
      data:
        title: Tür
        message: Offen
    - delay:
        hours: 0
        minutes: 5
        seconds: 0
        milliseconds: 0
  until:
    - condition: state
      entity_id: cover.garage
      state: closed

1 „Gefällt mir“

Ich mache so etwas ähnliches mit meinem Auto. Wenn dort eine Tür länger geöffnet ist, gebe ich eine Meldung aus. Dies wird dann so lange fortgesetzt, bis die Tür abgeschlossen wird.

Damit findet das Polling immer nur statt, wenn die Tür auch wirklich geöffnet ist.

alias: "Meldung: BMW ist offen"
description: ""
triggers:
  - entity_id:
      - binary_sensor.bmw_zustand_der_turverriegelung
    attribute: door_lock_state
    for:
      hours: 0
      minutes: 1
      seconds: 0
    to: UNLOCKED
    trigger: state
conditions: []
actions:
  - repeat:
      until:
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.bmw_zustand_der_turverriegelung
              attribute: door_lock_state
              state: LOCKED
            - condition: state
              entity_id: binary_sensor.bmw_zustand_der_turverriegelung
              attribute: door_lock_state
              state: SECURED
      sequence:
        - metadata: {}
          data:
            title: BMW
            message: BMW ist noch geöffnet.
          action: notify.mobile_app_larss_iphone
        - delay:
            hours: 0
            minutes: 3
            seconds: 0
            milliseconds: 0
        - data: {}
          target:
            entity_id:
              - binary_sensor.bmw_zustand_der_turverriegelung
          action: homeassistant.reload_config_entry
mode: single

Gruß, Lars