Motion Detector - pause countown to turn off light when motion is detected still

Also you cant use this service template if you are adjusting the brightness.

The light turn off action does not accept a brightness value. This will generate errors and stop your automation.

Use Dave’s original automation and just change the brightness to include the template.

alias: Alfresco LED Strip Auto
description: Alfresco LED Strip Auto
trigger:
  - platform: state
    entity_id:
      - binary_sensor.paradox_z6_alfresco_pir
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.alfresco_presence_sensor_f9a541_pir_sensor
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.paradox_z3_garage_door
    to: "on"
action:
  - service: light.turn_on
    data:
      brightness_pct: >
        {% if 6 <= now().hour < 21 %}
          60
        {% else %}
          30
        {% endif %}
    target:
      entity_id: light.alfresco_led_strip
  - delay: "00:02:00"
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.alfresco_led_strip
trace:
  stored_traces: 20
mode: restart

Means I cannot use variables here (service: light.turn_{{ trigger.to_state.state }})

So I have just to create an own service for each action (on/off)?

alias: Motion Detection - TRADFRI Leon Tür
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.tradfri_leon_tuer_bewegung
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.tradfri_leon_tuer_bewegung
    to: "off"
    for:
      minutes: 3
condition: []
action:
  - service: light.turn_on
    data:
      brightness_pct: |
        {% if 6 <= now().hour < 21 %}
          60
        {% else %}
          20
        {% endif %}
    target:
      entity_id: light.flur_oben_light
    - service: light.turn_off
    target:
      entity_id: light.flur_oben_light
mode: restart

Ah you already put in an example above, just saw. Yeah thats what I mean I guess.

No that will immediately turn off your lights after turning them on. At least it would if it was indented correctly.

Just use what I posted above.

yes I will try it now

Hi.
Yes it seems like working and though the restart option, e.g. when working in the basemant to 20 Minutes, the light does not went out since each restarting will set off the 2 minute down-counter again. Right?

Thes was heloing a lot @tom_l .

Hi,

after some time observation - the issue that the light-bulbs are went off to early even though passing the sensors in very short Intervalls (seconds). I really do not know what I’m doing wrong here. The bulbs are just supposed to switch off AFTER the last passing of one of the three sensors for at least two minutes.

these is the yaml file, the other ones, there are looking exactly the same except for the motion sensors id of course.

Am I missing something?

alias: Motion Detection - EG HM Sensor
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.bewegungsmelder_eg_bewegung
    to: "on"
action:
  - service: light.turn_on
    data:
      brightness_pct: |
        {% if 6 <= now().hour < 21 %}
          60
        {% else %}
          40
        {% endif %}
    target:
      entity_id: light.flur_eg_01_light
  - service: light.turn_on
    data:
      brightness_pct: |
        {% if 6 <= now().hour < 21 %}
          60
        {% else %}
          40
        {% endif %}
    target:
      entity_id: light.flur_eg_02_light_2
  - service: light.turn_on
    data:
      brightness_pct: |
        {% if 6 <= now().hour < 21 %}
          60
        {% else %}
          40
        {% endif %}
    target:
      entity_id: light.flur_eg_03_light
  - service: light.turn_on
    data:
      brightness_pct: |
        {% if 6 <= now().hour < 21 %}
          60
        {% else %}
        40
        {% endif %}
    target:
      entity_id: light.flur_eg_04_light
  - delay: "00:02:00"
  - service: light.turn_off
    target:
      entity_id: light.flur_eg_01_light
    data: {}
  - service: light.turn_off
    target:
      entity_id: light.flur_eg_02_light_2
    data: {}
  - service: light.turn_off
    target:
      entity_id: light.flur_eg_03_light
    data: {}
  - service: light.turn_off
    target:
      entity_id: light.flur_eg_04_light
    data: {}
mode: restart
1 Like