Friends,
I am trying to create an automation that implements the following actions:
- When motion detected in dresser, lights turned on at 20% brightness
- When motion continues to be detected in dresser for 15 seconds, brightness of lights increased to 80%
- When there is no motion detected for 20 seconds, lights turned off.
The problem is that when the second trigger (motion detected for 15 seconds) is triggered, still option 1 with 20% brightness is triggered.
Secondly, can somebody help me made a custom template sensor that is on when the sensor is in detected mode with a duration of more than 15 or more seconds, and off otherwise.
Thanks in advance.
alias: GF Kavya Dresser and Study Motion Light Automation
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.gf_kavya_dresser_any_motion_sensor
to: "on"
- platform: state
entity_id:
- binary_sensor.gf_kavya_dresser_any_motion_sensor
to: "on"
for:
hours: 0
minutes: 0
seconds: 15
- platform: state
entity_id:
- binary_sensor.kavya_dresser_all_presence_sensors
to: "off"
for:
hours: 0
minutes: 0
seconds: 20
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.gf_kavya_dresser_any_motion_sensor
state: "on"
sequence:
- service: light.turn_on
data:
kelvin: 2700
brightness_pct: 20
target:
entity_id: light.gf_kavya_dresser_all_lights
- conditions:
- condition: state
entity_id: binary_sensor.gf_kavya_dresser_any_motion_sensor
state: "on"
for:
hours: 0
minutes: 0
seconds: 15
sequence:
- service: light.turn_on
data:
kelvin: 2700
brightness_pct: 80
target:
entity_id:
- light.gf_kavya_dresser_all_lights
- light.gf_kavya_study_ll_2
- conditions:
- condition: state
entity_id: binary_sensor.kavya_dresser_all_presence_sensors
state: "off"
for:
hours: 0
minutes: 0
seconds: 20
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.gf_kavya_dresser_all_lights
default:
- service: light.turn_off
data: {}
target:
entity_id:
- light.gf_kavya_dresser_all_lights
mode: restart