I’ve got a light that turns on (and off) correctly based on a motion detector.
Unfortunately, it is too good. It turns off as soon as the detector says there is no longer motion. I need this to stay on for 10 minutes regardless of motion once triggered.
but that’s essentially useless. Nothing in this can I get to work at all. Here are the current yaml for my on/off automations:
alias: Lights On - Pantry - Daytime
description: Turn on under cabinet pantry lights to 80% during the daytime (7am-7pm)
trigger:
- platform: device
domain: binary_sensor
entity_id: binary_sensor.samjin_motion_fad40c01_ias_zone
device_id: 2675990a33b0745b10e7288e4ecb1be6
type: motion
condition:
- condition: time
after: '07:00'
before: '19:00'
action:
- type: turn_on
device_id: e741a53117757bda89df624de422b911
entity_id: light.zen27_s2_dimmer_wall_switch_level_2
domain: light
brightness_pct: 80
mode: single
alias: Lights Off - Pantry
description: ''
trigger:
- type: no_motion
platform: device
device_id: 2675990a33b0745b10e7288e4ecb1be6
entity_id: binary_sensor.samjin_motion_fad40c01_ias_zone
domain: binary_sensor
condition: []
action:
- type: turn_off
device_id: e741a53117757bda89df624de422b911
entity_id: light.zen27_s2_dimmer_wall_switch_level_2
domain: light
mode: single
Another issue I tend to have is the GUI doesn’t really want me to save YAML. It rarely works…what am I doing wrong? So far I am batting 0.00 with YAML. It really seems far to difficult and I’m a sysadmin!
Sacriledge, I know, but HA doesn’t have to do everything. Sounds as if you already have SmartThings - if that makes it “super easy”, why not let Smartthings do it? No need to re-invent the wheel.
I use two automation too for this purpose. The second stays on for 10 minutes AFTER the last movement. Well actually between 10 and 12 minutes since the sensor only updates every 2 minutes once motion is detected.
This is a fairly basic thing that any automation system should be able to do though. If HA can’t do it properly, it should be pretty high on the “it should be implemented immediately” list.
Personally I find it easier to separate the turn on and turn off functions into different automations. Sure you wont get any plaudits for elegant solutions but it’s easier to maintain and implement and can give you greater flexibility.
I wish that worked…here is my attempt to make that behave at a basic level and it fails.
alias: Test Office On
description: ''
trigger:
- type: motion
platform: device
device_id: db12673d26ebb3845160a1463b163cc6
entity_id: binary_sensor.samjin_motion_3aa50b01_ias_zone
domain: binary_sensor
condition: []
action:
- domain: light
entity_id: light.office_fan
device_id: d2da70e04e94b64ae2e6f4a1942f5345
type: turn_on
mode: single
alias: Test Office Off after 2 min no motion
description: test
trigger:
- device_id: db12673d26ebb3845160a1463b163cc6
entity_id: binary_sensor.samjin_motion_3aa50b01_ias_zone
domain: binary_sensor
for:
hours: 0
minutes: 2
seconds: 0
platform: device
type: no_motion
condition: []
action:
- domain: light
entity_id: light.office_fan
device_id: d2da70e04e94b64ae2e6f4a1942f5345
type: turn_off
mode: single
This correctly turns on the light with motion. Then it promptly turns the light off after 2 minutes even with motion. Sometimes, when the light is on and it re-detects motion, it decides to turn off the light.
All I want is a simple way to turn a light on with motion, leave it on until motion is NOT detected (with a pad added to that) and to stay on if motion is re-detected during the pad time. If it turns a light on with motion and then the motion goes away and comes back while the light it still on, I do not want it to turn off the light. I’ve never had such trouble with an automation system doing this simple thing.
Note that your setup references something called “service light.turn_on”. This gives an error on my HA.
There’s a blueprint to turn a light on from motion and turn it off after a period of no detection. If detection is picked up during the on period the timer off resets.
This works fine as long as motion remains detected. Once motion drops and reappears in the 120 seconds, the light does not stay on, instead it immediately turns off…and from then on the automation works in reverse…
What I do is have one automation which is triggered from the motion sensor, this in turn starts a 5 min timer and turns on the lights. I then have a second automation that is triggered off of the expired timer to turn the lights off. This is flexible, there can be multiple ways to set the timer and when it goes off the lights will always be turned off. Just a suggestion…
The biggest issue I was having was testing with a light being controlled through a Bond Hub. There is obviously something not quite right with the Bond integration in relation to automation.