I have a hue sensor that turns my bathroom light on / off and at the moment, I have it set up so that in the daytime, all lights go and stay on for 4 mins. and at night, only one light comes on (dimmed) and only stays on for 1 min.
I now want to give it a few more time periods -
06:30 - 09:00 - all lights 100% for 10 mins
09:00 - 20:00 - all lights 60% for 4 mins
20:00 - 10:30 - all lights 60% for 3 mins
10:30 - 06:30 - 1 light 1% for 1 min
I feel this automation could be a bit cleaner with some sort of templating with if / else statements. However, templating isn’t something that I have really got to grips with yet (not a coder).
Should I just continue adding more automations with time conditions, or is there another way to do this?
My current automation:
- id: 'ensuite_auto_off_day'
alias: 'Ensuite Auto Off Day'
trigger:
- platform: state
entity_id: sensor.hue_motion_motion_ensuite
to: 'off'
for:
minutes: 4
condition:
- condition: time
after: '05:30:00'
before: '23:59:59'
action:
- service: homeassistant.turn_off
entity_id: light.ensuite
- id: 'ensuite_auto_on_day'
alias: 'Ensuite Auto On Day'
trigger:
- platform: state
entity_id: sensor.hue_motion_motion_ensuite
to: 'on'
condition:
- condition: time
after: '05:30:00'
before: '23:59:59'
action:
- service: homeassistant.turn_on
entity_id: light.ensuite
data:
brightness_pct: 60
- id: 'ensuite_auto_off_night'
alias: 'Ensuite Auto Off Night'
trigger:
- platform: state
entity_id: sensor.hue_motion_motion_ensuite
to: 'off'
for:
minutes: 1
condition:
- condition: time
after: '00:00:01'
before: '05:29:59'
action:
- service: homeassistant.turn_off
entity_id: light.ensuite
- id: 'ensuite_auto_on_night'
alias: 'Ensuite Auto On Night'
trigger:
- platform: state
entity_id: sensor.hue_motion_motion_ensuite
to: 'on'
condition:
- condition: time
after: '00:00:01'
before: '05:29:59'
action:
- service: homeassistant.turn_on
entity_id: light.ensuite_3
data:
brightness_pct: 1