Bewegungsmelder in Home Assistant automatisieren (Der beste Weg)

Hallo,

ich habe die Anleitung erfolgreich umgesetzt.

Nun habe ich aber das Ereignis, dass das Licht nicht wieder ausgeht, wenn die Zeit zum Ausschalten noch nicht abgelaufen ist und der Schwellenwert sich in der Zeit so verändert hat das er überschritten ist.

Ich denke, es würde enorm helfen, wenn du den Code posten würdest

Hallo,
danke für die Antwort, ich hoffe das hilft:

mode: restart
max_exceeded: silent
variables:
  scene_ambient: scene.none
  scene_morning: scene.none
  scene_day: scene.none
  scene_evening: scene.none
  scene_night: scene.none
  automation_blocker: binary_sensor.flur_licht
  automation_blocker_boolean: true
  no_motion_blocker: null
  no_motion_blocker_boolean: false
  elevation_check: none
  scene_no_motion: scene.none
  motion_entity: binary_sensor.bewegungsmeder_flur_motion_detection
trigger:
  - platform: state
    entity_id: binary_sensor.bewegungsmeder_flur_motion_detection
    from: 'off'
    to: 'on'
  - platform: state
    entity_id: binary_sensor.bewegungsmeder_flur_motion_detection
    from: 'on'
    to: 'off'
    for: 15
condition:
  - condition: or
    conditions:
      - '{{ automation_blocker == none }}'
      - >-
        {{ automation_blocker_boolean and states[automation_blocker].state ==
        'on' }}
      - >-
        {{ not automation_blocker_boolean and states[automation_blocker].state
        == 'off' }}
  - condition: template
    value_template: >-
      {{ (elevation_check == none) or (state_attr('sun.sun','elevation') <=
      elevation_check | float(90)) }}
action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ trigger.to_state.state == ''on'' }}'
        sequence:
          - choose:
              - conditions:
                  - '{{ scene_morning != ''scene.none''}}'
                  - condition: time
                    after: '00:00:00'
                    before: '00:00:00'
                sequence:
                  - scene: scene.none
              - conditions:
                  - '{{ scene_day != ''scene.none''}}'
                  - condition: time
                    after: '00:00:00'
                    before: '00:00:00'
                sequence:
                  - scene: scene.none
              - conditions:
                  - '{{ scene_evening != ''scene.none''}}'
                  - condition: time
                    after: '00:00:00'
                    before: '00:00:00'
                sequence:
                  - scene: scene.none
              - conditions:
                  - '{{ scene_night != ''scene.none''}}'
                  - condition: time
                    after: '00:00:00'
                    before: '00:00:00'
                sequence:
                  - scene: scene.none
            default:
              - service: light.turn_on
                target:
                  area_id: flur_erdgeschoss
                  entity_id: light.flur_licht
      - conditions:
          - condition: template
            value_template: '{{ trigger.to_state.state == ''off'' }}'
          - condition: or
            conditions:
              - '{{ no_motion_blocker == none }}'
              - >-
                {{ no_motion_blocker_boolean and states[no_motion_blocker].state
                == 'on' }}
              - >-
                {{ not no_motion_blocker_boolean and
                states[no_motion_blocker].state == 'off' }}
        sequence:
          - choose:
              - conditions:
                  - '{{ scene_ambient != ''scene.none'' }}'
                  - condition: time
                    after: '00:00:00'
                    before: '00:00:00'
                sequence:
                  - scene: scene.none
              - conditions:
                  - '{{ scene_no_motion != ''scene.none'' }}'
                sequence:
                  - scene: scene.none
            default:
              - service: light.turn_off
                target:
                  area_id: flur_erdgeschoss
                  entity_id: light.flur_licht
id: '1697632830437'
alias: Flur Licht
description: ''

Zu diesem Thema gibt es hier im Forum schon einen Beitrag.