Good morning. I’m having a weird problem regarding motion controlled lighting. I have tried a couple different blueprints and I have the same results regardless of the blueprint. I should mention that these switches were used previously in smartthings for a similar automation. I set them up to turn on when motion is detected and then off after a period of time. I have some that are longer wait times (ie. 15 minutes on one and 45 on another). Regardless of the automation, or the room…the lights turn off after about a minute and a half (90 seconds). Nothing seems to “fix” this (ie. different blueprint, different motion detectors, different switch, brands etc). Any suggestion on what I could do to rectify. Below is a copy of the blueprint code I’m using. And also a copy of one of the automations.
blueprint:
name: Motion-activated Switch
description: Turn on a light when motion is detected.
domain: automation
source_url: https://github.com/home-assistant/core/blob/11f80762eabf9e0a3c21395e7ae9cd8d939016ea/homeassistant/components/automation/blueprints/motion_light.yaml
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
switch_target:
name: Switch
selector:
target:
entity:
domain: switch
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: minutes
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
action:
- alias: "Turn on the light"
service: switch.turn_on
target: !input switch_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of minutes that has been set"
delay: !input no_motion_wait
- alias: "Turn off the light"
service: switch.turn_off
target: !input switch_target