Files
fresh-home/automations/house/update_automatic_light_profile.yaml
T
2024-04-14 14:08:56 -04:00

219 lines
8.7 KiB
YAML

alias: 'Update Automatic Light Profile'
id: automation_update_automatic_light_profile
trigger:
- platform: state
entity_id:
- input_select.time_of_day
- input_select.early_morning_mode
- input_select.morning_mode
- input_select.late_morning_mode
- input_select.early_afternoon_mode
- input_select.late_afternoon_mode
- input_select.early_evening_mode
- input_select.evening_mode
- input_select.late_evening_mode
- input_select.night_mode
- input_select.early_morning_kids_mode
- input_select.morning_kids_mode
- input_select.late_morning_kids_mode
- input_select.early_afternoon_kids_mode
- input_select.late_afternoon_kids_mode
- input_select.early_evening_kids_mode
- input_select.evening_kids_mode
- input_select.late_evening_kids_mode
- input_select.night_kids_mode
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.have_custody
state: 'off'
sequence:
- choose:
# Set to Energize during Early Morning (04:00 - 06:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Early Morning'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.early_morning_mode')}}"
# Set to Energize during Morning (06:00 - 09:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Morning'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.morning_mode')}}"
# Set to Energize during Late Morning (09:00 - 12:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Late Morning'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.late_morning_mode')}}"
# Set to Concentrate during Early Afternoon (12:00 - 15:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Early Afternoon'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.early_afternoon_mode')}}"
# Set to Concentrate during Late Afternoon (15:00 - 17:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Late Afternoon'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.late_afternoon_mode')}}"
# Set to Read during Early Evening (17:00 - 19:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Early Evening'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.early_evening_mode')}}"
# Set to Relax during Evening (19:00 - 22:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Evening'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.evening_mode')}}"
# Set to Dimmed during Late Evening (22:00 - 00:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Late Evening'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.late_evening_mode')}}"
# Set to Nightlight during Night (00:00 - 04:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Night'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.night_mode')}}"
- conditions:
- condition: state
entity_id: binary_sensor.have_custody
state: 'on'
sequence:
- choose:
# Set to Energize during Early Morning (04:00 - 06:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Early Morning'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.early_morning_kids_mode')}}"
# Set to Energize during Morning (06:00 - 09:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Morning'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.morning_kids_mode')}}"
# Set to Energize during Late Morning (09:00 - 12:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Late Morning'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.late_morning_kids_mode')}}"
# Set to Concentrate during Early Afternoon (12:00 - 15:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Early Afternoon'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.early_afternoon_kids_mode')}}"
# Set to Concentrate during Late Afternoon (15:00 - 17:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Late Afternoon'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.late_afternoon_kids_mode')}}"
# Set to Read during Early Evening (17:00 - 19:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Early Evening'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.early_evening_kids_mode')}}"
# Set to Relax during Evening (19:00 - 22:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Evening'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.evening_kids_mode')}}"
# Set to Dimmed during Late Evening (22:00 - 00:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Late Evening'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.late_evening_kids_mode')}}"
# Set to Nightlight during Night (00:00 - 04:00)
- conditions:
- condition: state
entity_id: input_select.time_of_day
state: 'Night'
sequence:
- service: input_select.select_option
data:
entity_id: input_select.automatic_light_profile
option: "{{states('input_select.night_kids_mode')}}"