Hi Everyone,
I’m trying to work out the best way of implementing a parameter that will allow me to specify how long after a motion sensor turns lights on before they should turn off. I’m not sure I’ve coded this up in the most efficient way, so please let me know if this needs a redesign.
The trigger is the motion sensor detecting some motion, with some conditions around time, illuminance and lights current state, before choosing some Philips Hue light scenes based on some other conditons. What I’d like to is have the lights turn off after a period of time.
I looked at using a timer, but this seemed like I might need several automations to implement which didn’t seem efficient.
Do you clever people have any suggestions.
Here’s the automation as it stands:
alias: 'Bedroom: Motion Sensor'
description: Programming for Bedroom Lights
trigger:
- type: motion
platform: device
device_id: f0ec9128644cdcd5b4ad1fcc07ccba98
entity_id: binary_sensor.hue_motion_sensor_1_motion
domain: binary_sensor
condition:
- type: is_illuminance
condition: device
device_id: f0ec9128644cdcd5b4ad1fcc07ccba98
entity_id: sensor.hue_motion_sensor_1_light_level
domain: sensor
below: 150
- condition: state
entity_id: light.master_bedroom
state: 'off'
action:
- choose:
- conditions:
- condition: time
after: '00:00:00'
before: '09:30:00'
sequence:
- service: hue.hue_activate_scene
data:
group_name: Master Bedroom Lights
scene_name: Night
- conditions:
- condition: or
conditions:
- type: is_plugged_in
condition: device
device_id: ea068aadbe01500374dc3cadb309e713
entity_id: binary_sensor.oneplus_a6013_is_charging
domain: binary_sensor
- type: is_plugged_in
condition: device
device_id: ba96ffd4a109f09daf521ecf48135566
entity_id: binary_sensor.frances_phone_is_charging
domain: binary_sensor
sequence:
- service: hue.hue_activate_scene
data:
group_name: Master Bedroom Lights
scene_name: Night
default:
- service: hue.hue_activate_scene
data:
group_name: Master Bedroom Lights
scene_name: Bright
mode: single