I have a pair of automations that set the level of light in my bathroom based on time and motion. It seems to me that I should be able to combine them into one, but for the life of me cannot figure out how to do a conditional if with a default fall thru based on time. Additionally I wait a static amount of time in a third automation to turn off the lights. I would think I could add that to the same automation.
Here are the 3 involved automations…
- id: "Bathroom motion on bright"
alias: Bathroom motion on bright
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d0001644ca3
from: 'off'
to: 'on'
condition:
- condition: time
after: '08:00:00'
before: '23:00:00'
action:
- service: light.turn_on
entity_id: light.bathroom_1,light.bathroom_2,light.toolbox
data:
brightness: 254
- id: "Bathroom motion on dim"
alias: Bathroom motion on dim
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d0001644ca3
from: 'off'
to: 'on'
condition:
- condition: time
after: '23:00:00'
before: '05:30:00'
action:
- service: light.turn_on
entity_id: light.bathroom_1,light.bathroom_2,light.toolbox
data:
brightness: 30
- id: "Bathroom motion off"
alias: Bathroom motion off
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d0001644ca3
from: 'on'
to: 'off'
for:
minutes: 15
condition:
- condition: time
after: '08:00:00'
before: '05:30:00'
action:
- service: light.turn_off
entity_id: light.bathroom_1,light.bathroom_2,light.toolbox
The static window in the off automation allows for a longer shower as the sensor is not in the room with the lights because our cats trigger it to often.
Any ideas?
6 posts - 2 participants