Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
homeassistant:
customize:
input_boolean.time_based_dimmers_enabled:
persistent: true
################################################
## Switches
################################################
input_boolean:
time_based_dimmers_enabled:
name: Time Based Lights
icon: mdi:weather-sunset
initial: on
################################################
## Group
################################################
group:
morning_devices:
entities:
- light.boys_bathroom_nightlight # Boys Bathroom Nightlight
- light.entry_light
#- light.porch_light
- light.porch_light_color
name: Morning Devices
view: no
################################################
## Scenes
################################################
scene:
## Time Based Scenes
- name: Morning Devices Off
entities:
group.morning_devices: off
################################################
## Scripts
################################################
script:
dusk:
alias: Dusk
sequence:
- service: light.turn_on
entity_id: light.porch_light_color
- service: light.turn_on
data:
entity_id: light.entry_light
brightness_pct: '60'
- service: light.turn_on
data:
entity_id: light.boys_bathroom_nightlight
brightness_pct: '30'
dusk_plus_1hr:
alias: Dusk Plus 1 Hour
sequence:
- service: light.turn_on
data_template:
entity_id: light.porch_light_color{% if is_state('light.entry_light', 'on') %}, light.entry_light{% endif %}{% if is_state('light.living_room_light', 'on') %}, light.living_room_light{% endif %}{% if is_state('light.family_room_light', 'on') %}, light.family_room_light{% endif %}{% if is_state('light.play_room_light', 'on') %}, light.play_room_light{% endif %}{% if is_state('light.computer_desk_light', 'on') %}, light.computer_desk_light{% endif%}{% if is_state('light.bed_room_light', 'on') %}, light.bed_room_light{% endif %}
brightness_pct: '80'
dusk_plus_15hrs:
alias: Dusk Plus 1 1/2 Hours
sequence:
- service: light.turn_off
entity_id:
- light.living_room_corner_lamp
- light.family_room_table_lamp
- service: light.turn_on
data_template:
entity_id: light.porch_light_color{% if is_state('light.entry_light', 'on') %}, light.entry_light{% endif %}{% if is_state('light.living_room_light', 'on') %}, light.living_room_light{% endif %}{% if is_state('light.family_room_light', 'on') %}, light.family_room_light{% endif %}{% if is_state('light.play_room_light', 'on') %}, light.play_room_light{% endif %}{% if is_state('light.computer_desk_light', 'on') %}, light.computer_desk_light{% endif%}{% if is_state('light.bed_room_light', 'on') %}, light.bed_room_light{% endif %}
brightness_pct: '60'
dusk_plus_2hrs:
alias: Dusk Plus 2 Hours
sequence:
- service: light.turn_off
entity_id:
- light.living_room_corner_lamp
- light.family_room_table_lamp
- service: light.turn_on
data_template:
entity_id: light.porch_light_color{% if is_state('light.entry_light', 'on') %}, light.entry_light{% endif %}{% if is_state('light.living_room_light', 'on') %}, light.living_room_light{% endif %}{% if is_state('light.family_room_light', 'on') %}, light.family_room_light{% endif %}{% if is_state('light.play_room_light', 'on') %}, light.play_room_light{% endif %}{% if is_state('light.computer_desk_light', 'on') %}, light.computer_desk_light{% endif%}{% if is_state('light.bed_room_light', 'on') %}, light.bed_room_light{% endif %}
brightness_pct: '50'
dusk_plus_25hrs:
alias: Dusk Plus 2 1/2 Hours
sequence:
- service: light.turn_off
entity_id:
- light.living_room_corner_lamp
- light.family_room_table_lamp
- service: light.turn_on
data_template:
entity_id: light.porch_light_color{% if is_state('light.entry_light', 'on') %}, light.entry_light{% endif %}{% if is_state('light.living_room_light', 'on') %}, light.living_room_light{% endif %}{% if is_state('light.family_room_light', 'on') %}, light.family_room_light{% endif %}{% if is_state('light.play_room_light', 'on') %}, light.play_room_light{% endif %}{% if is_state('light.computer_desk_light', 'on') %}, light.computer_desk_light{% endif%}{% if is_state('light.bed_room_light', 'on') %}, light.bed_room_light{% endif %}
brightness_pct: '40'
dusk_plus_3hrs:
alias: Dusk Plus 3 Hours
sequence:
- service: light.turn_off
entity_id:
- light.living_room_corner_lamp
- light.family_room_table_lamp
- service: light.turn_on
data_template:
entity_id: light.porch_light_color{% if is_state('light.entry_light', 'on') %}, light.entry_light{% endif %}{% if is_state('light.living_room_light', 'on') %}, light.living_room_light{% endif %}{% if is_state('light.family_room_light', 'on') %}, light.family_room_light{% endif %}{% if is_state('light.play_room_light', 'on') %}, light.play_room_light{% endif %}{% if is_state('light.computer_desk_light', 'on') %}, light.computer_desk_light{% endif%}{% if is_state('light.bed_room_light', 'on') %}, light.bed_room_light{% endif %}
brightness_pct: '30'
################################################
## Automations
################################################
automation:
##############################################
## Sunrise & Sunset Automations
##############################################
## 1 1/2 hours after sunrise.
- alias: Morning +1.5hrs
trigger:
- platform: sun
event: sunrise
offset: '+1:30:00'
action:
- service: homeassistant.turn_off
data:
entity_id: group.morning_devices
#- service: script.notify_engine
- service: script.notify_ios_engine
data_template:
title: 'Scene: Morning Devices'
message: "{{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d %b %Y', true) }}"
who: "brian"
#engines: "persistent, ios"
- service: persistent_notification.create
data:
message: "Scene: Morning Devices activated at {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d %b %Y', true) }}"
## 45 minutes before sunset = "Dusk"
- alias: Dusk
trigger:
- platform: sun
event: sunset
offset: "-00:45:00"
condition:
- condition: state
entity_id: input_boolean.time_based_dimmers_enabled
state: 'on'
action:
- service: script.turn_on
entity_id: script.dusk
- service: script.notify_ios_engine
data_template:
title: 'Scene: Dusk'
message: "Activated at {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d %b %Y', true) }}"
who: "brian"
- service: persistent_notification.create
data:
message: "Scene: Dusk activated at {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d %b %Y', true) }}"
## 1 hour after dusk.
- alias: Dusk +1hr
trigger:
- platform: sun
event: sunset
offset: +0:15:00
condition:
- condition: state
entity_id: input_boolean.time_based_dimmers_enabled
state: 'on'
action:
- service: script.turn_on
entity_id: script.dusk_plus_1hr
## 1 1/2 hours after dusk.
- alias: Dusk +1.5hrs
trigger:
- platform: sun
event: sunset
offset: +0:15:00
condition:
- condition: state
entity_id: input_boolean.time_based_dimmers_enabled
state: 'on'
action:
- service: script.turn_on
entity_id: script.dusk_plus_15hr
## 2 hours after dusk.
- alias: Dusk +2hrs
trigger:
- platform: sun
event: sunset
offset: '+1:15:00'
condition:
- condition: state
entity_id: input_boolean.time_based_dimmers_enabled
state: 'on'
action:
- service: script.turn_on
entity_id: script.dusk_plus_2hrs
## 2 1/2 hours after dusk.
- alias: Dusk +2.5hrs
trigger:
- platform: sun
event: sunset
offset: +0:15:00
condition:
- condition: state
entity_id: input_boolean.time_based_dimmers_enabled
state: 'on'
action:
- service: script.turn_on
entity_id: script.dusk_plus_25hr
## 3 hours after dusk.
- alias: Dusk + 3hrs
trigger:
- platform: sun
event: sunset
offset: '+2:15:00'
condition:
- condition: state
entity_id: input_boolean.time_based_dimmers_enabled
state: 'on'
action:
- service: script.turn_on
entity_id: script.dusk_plus_3hrs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.