Ok so this is what I have so far. This turns the lights on to the specified brightness at certain times but it still won’t wait the 4 minutes before turning off:
- alias: Bathroom On
trigger:
- platform: state
entity_id: switch.bathroom_motion
to: 'on'
condition:
- condition: time
after: '08:01:00'
before: '20:59:00'
action:
- service: scene.turn_on
entity_id: scene.bath_bright_x2
- delay: 00:04:00
- service: scene.turn_on
entity_id: scene.bath_lights_off
- alias: Nightlight
trigger:
- platform: state
entity_id: switch.bathroom_motion
to: 'on'
condition:
- condition: time
after: '21:00:00'
before: '08:00:00'
action:
- service: scene.turn_on
entity_id: scene.bath_low_x2
- delay: 00:04:00
- service: scene.turn_on
entity_id: scene.bath_lights_off
Having all those scenes handling different brightness levels didn’t look good to me so instead i call them up like below. As you have a motion sensor isn’t it better to use it instead of delay?
########## BATHROOM LIGHT ON
- alias: Bath light auto on
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_bath
from: 'off'
to: 'on'
action:
service: light.turn_on
entity_id: light.fibaro_system_fgd212_dimmer_2_level_2_0
data_template:
brightness: >
{%- if is_state("sensor.day_night", "Evening") %}
255
{%- elif is_state("sensor.day_night", "Night") %}
60
{%- else %}
255
{% endif %}
########## BATHROOM LIGHT OFF
- alias: Bath light auto off
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_bath
from: 'on'
to: 'off'
for:
minutes: 2
#The following condition uses a door sensor as well so light won't switch off
condition:
condition: state
entity_id: input_boolean.bathroom_occupancy
state: 'off'
action:
service: light.turn_off
entity_id: light.fibaro_system_fgd212_dimmer_2_level_2_0