Migrate lighting automations and scripts #154
This commit is contained in:
609
automations.yaml
609
automations.yaml
@ -1573,3 +1573,612 @@
|
||||
entity_id: alarm_control_panel.alexa_guard_9ee3b
|
||||
data: {}
|
||||
mode: restart
|
||||
- id: '1696286103061'
|
||||
alias: Living Room Night Lighting
|
||||
description: Provide lighting in case anyone needs to go downstairs in the middle
|
||||
of the night.
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.living_room_motion
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: motion-on
|
||||
- platform: state
|
||||
entity_id: binary_sensor.living_room_motion
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
id: motion-off
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.living_room_motion_timer
|
||||
id: timer-finished
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.people_present
|
||||
state: 'on'
|
||||
- condition: state
|
||||
entity_id: input_boolean.vacation_mode
|
||||
state: 'off'
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ (trigger.id == ''motion-on'' and is_state(''input_boolean.night_mode'',''on''))
|
||||
and (is_state(''input_boolean.kallen_sleeping'',''on'') or is_state(''input_boolean.kallen_overnight'',''on''))
|
||||
}}'
|
||||
alias: Motion On
|
||||
sequence:
|
||||
- service: timer.cancel
|
||||
target:
|
||||
entity_id: timer.living_room_motion_timer
|
||||
data: {}
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id: light.first_floor_lights
|
||||
data: {}
|
||||
- service: script.stairwell_led_strip
|
||||
data:
|
||||
color_temp_kelvin: 2000
|
||||
brightness: 255
|
||||
- service: input_select.select_option
|
||||
target:
|
||||
entity_id:
|
||||
- input_select.living_room_scenes
|
||||
- input_select.tina_lamp_scenes
|
||||
- input_select.mud_room_scenes
|
||||
- input_select.downstairs_bathroom_scenes
|
||||
- input_select.dining_room_lamp_scenes
|
||||
data:
|
||||
option: Adaptive
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ (trigger.id == ''motion-off'' and is_state(''input_boolean.night_mode'',''on''))
|
||||
and (is_state(''input_boolean.kallen_sleeping'',''on'') or is_state(''input_boolean.kallen_overnight'',''on''))
|
||||
}}'
|
||||
alias: Motion Off
|
||||
sequence:
|
||||
- service: timer.start
|
||||
target:
|
||||
entity_id: timer.living_room_motion_timer
|
||||
data:
|
||||
duration: '{% from ''time.jinja'' import timer_duration %} {{ timer_duration(''input_number.living_room_lights_off_delay'')
|
||||
}}
|
||||
|
||||
'
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: timer-finished
|
||||
alias: Timer Finished
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- light.living_room_lights
|
||||
- light.tina_desk_lights
|
||||
- light.mud_room_overhead
|
||||
- light.downstairs_bathroom_lights
|
||||
- light.dining_room_lamp
|
||||
data: {}
|
||||
- service: script.stairwell_led_strip
|
||||
data:
|
||||
color_temp_kelvin: 2000
|
||||
brightness: '{{ 50 if is_state(''binary_sensor.early_night_mode'',''on'')
|
||||
else 255 }}'
|
||||
- delay:
|
||||
seconds: 5
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.early_night_mode
|
||||
state: 'off'
|
||||
then:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id: light.stairwell_led_strip
|
||||
data: {}
|
||||
mode: restart
|
||||
- id: '1696286192013'
|
||||
alias: Tina Desk Lights Handler
|
||||
description: Handles turning on the desk lights with smart scene selection and also
|
||||
turning them off
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.tina_desk_lights
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: toggle-on
|
||||
- platform: state
|
||||
entity_id: input_boolean.tina_desk_lights
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
id: toggle-off
|
||||
- platform: state
|
||||
entity_id: input_select.tina_desk_scenes
|
||||
to: Reset
|
||||
id: reset
|
||||
- platform: state
|
||||
entity_id: light.tina_desk_lights
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
id: lights-off
|
||||
- platform: state
|
||||
entity_id: light.tina_desk_lights
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: lights-on
|
||||
- platform: state
|
||||
entity_id: binary_sensor.tina_desktop_on
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: computer-on
|
||||
condition: []
|
||||
action:
|
||||
- if:
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: trigger
|
||||
id: toggle-on
|
||||
- condition: trigger
|
||||
id: reset
|
||||
- condition: trigger
|
||||
id: computer-on
|
||||
then:
|
||||
- service: input_select.select_option
|
||||
target:
|
||||
entity_id: input_select.tina_desk_scenes
|
||||
data:
|
||||
option: '{{ states(''sensor.tina_desk_scene'') }}'
|
||||
- if:
|
||||
- condition: trigger
|
||||
id: toggle-off
|
||||
then:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id: light.tina_desk_lights
|
||||
data: {}
|
||||
- if:
|
||||
- condition: trigger
|
||||
id: lights-off
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.tina_desk_lights
|
||||
state: 'on'
|
||||
then:
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.tina_desk_lights
|
||||
data: {}
|
||||
- if:
|
||||
- condition: trigger
|
||||
id: lights-on
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: input_boolean.tina_desk_lights
|
||||
state: 'off'
|
||||
then:
|
||||
- service: input_boolean.turn_on
|
||||
target:
|
||||
entity_id: input_boolean.tina_desk_lights
|
||||
data: {}
|
||||
- delay:
|
||||
seconds: 2
|
||||
alias: Prevent script from re-triggering when boolean is turned on
|
||||
mode: single
|
||||
- id: '1696286403914'
|
||||
alias: Basement Lights Handling
|
||||
description: Handles the presence-related automation of lights in the basement
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.basement_studio_door
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: door-open
|
||||
- platform: state
|
||||
entity_id: binary_sensor.basement_studio_door
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
id: door-closed
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.basement_studio_door_timer
|
||||
id: timer-finished
|
||||
- platform: state
|
||||
entity_id: binary_sensor.basement_occupied
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: basement-occupied
|
||||
- platform: state
|
||||
entity_id: binary_sensor.basement_occupied
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
id: basement-unoccupied
|
||||
- platform: state
|
||||
entity_id:
|
||||
- input_boolean.studio_quiet
|
||||
- input_boolean.recliner_mode
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: studio-quiet
|
||||
- platform: state
|
||||
entity_id: sensor.twitch_ironnerd24
|
||||
from: offline
|
||||
to: streaming
|
||||
id: stream-started
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.studio_quiet
|
||||
state: 'off'
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: door-open
|
||||
sequence:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: light.basement_studio_lights
|
||||
state: 'off'
|
||||
then:
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id: light.basement_studio_lights
|
||||
data: {}
|
||||
- service: timer.cancel
|
||||
target:
|
||||
entity_id: timer.basement_studio_door_timer
|
||||
data: {}
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: door-closed
|
||||
sequence:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.basement_occupied
|
||||
state: 'off'
|
||||
then:
|
||||
- service: timer.start
|
||||
target:
|
||||
entity_id: timer.basement_studio_door_timer
|
||||
data:
|
||||
duration: '{% from ''time.jinja'' import timer_duration %} {{ timer_duration(''input_number.basement_studio_lights_off_delay'')
|
||||
}}
|
||||
|
||||
'
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- basement-occupied
|
||||
- studio-quiet
|
||||
- stream-started
|
||||
sequence:
|
||||
- service: timer.cancel
|
||||
target:
|
||||
entity_id: timer.basement_studio_door_timer
|
||||
data: {}
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: basement-unoccupied
|
||||
sequence:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: light.basement_studio_lights
|
||||
state: 'on'
|
||||
then:
|
||||
- if:
|
||||
- condition: state
|
||||
entity_id: timer.basement_studio_door_timer
|
||||
state: idle
|
||||
then:
|
||||
- service: timer.start
|
||||
target:
|
||||
entity_id: timer.basement_studio_door_timer
|
||||
data:
|
||||
duration: '{% from ''time.jinja'' import timer_duration %} {{ timer_duration(''input_number.basement_studio_lights_off_delay'')
|
||||
}}
|
||||
|
||||
'
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: timer-finished
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id: light.basement_studio_lights
|
||||
data: {}
|
||||
mode: restart
|
||||
- id: '1696286481890'
|
||||
alias: Recliner Mode
|
||||
description: For naptime in the basement
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: input_boolean.recliner_mode
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
id: recliner-on
|
||||
- platform: state
|
||||
entity_id: input_boolean.recliner_mode
|
||||
from: 'on'
|
||||
to: 'off'
|
||||
id: recliner-off
|
||||
condition: []
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: recliner-on
|
||||
sequence:
|
||||
- service: input_select.select_option
|
||||
target:
|
||||
entity_id: input_select.basement_studio_scenes
|
||||
data:
|
||||
option: Stairwell
|
||||
- service: input_boolean.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- input_boolean.white_noise_basement
|
||||
- input_boolean.studio_quiet
|
||||
data: {}
|
||||
- service: script.turn_on
|
||||
target:
|
||||
entity_id: script.asus_laptop_displays_off
|
||||
data: {}
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{% if is_state('media_player.basement_tv','playing') %}\n
|
||||
\ false\n{% elif is_state('media_player.basement_tv','paused') or is_state('media_player.basement_tv','idle')
|
||||
%}\n {{ state_attr('media_player.basement_tv','app_name') in ['TV','Android
|
||||
TV Launcher'] }}\n{% else %}\n false\n{% endif %}\n"
|
||||
then:
|
||||
- service: media_player.turn_off
|
||||
target:
|
||||
entity_id: media_player.basement_tv
|
||||
data: {}
|
||||
- if:
|
||||
- condition: not
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: media_player.tony_asus
|
||||
state: playing
|
||||
then:
|
||||
- service: script.turn_on
|
||||
target:
|
||||
entity_id: script.tony_desktop_displays_off
|
||||
data: {}
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: recliner-off
|
||||
sequence:
|
||||
- service: input_select.select_option
|
||||
target:
|
||||
entity_id: input_select.basement_studio_scenes
|
||||
data:
|
||||
option: Adaptive
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- input_boolean.white_noise_basement
|
||||
- input_boolean.studio_quiet
|
||||
data: {}
|
||||
- service: script.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- script.tony_desktop_displays_on
|
||||
- script.asus_laptop_displays_on
|
||||
data: {}
|
||||
- service: media_player.turn_on
|
||||
target:
|
||||
entity_id: media_player.basement_tv
|
||||
data: {}
|
||||
mode: restart
|
||||
- id: '1696286540644'
|
||||
alias: Basement Lights Adaptive Resync
|
||||
description: Deals with situations where the basement lights should be adaptive
|
||||
but end up out of sync
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.basement_lights_sync_issue
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.studio_quiet
|
||||
state: 'off'
|
||||
- condition: template
|
||||
value_template: '{{ is_state_attr(''light.basement_studio_lights'',''color_mode'',''color_temp'')
|
||||
}}'
|
||||
action:
|
||||
- service: adaptive_lighting.apply
|
||||
data:
|
||||
entity_id: switch.adaptive_lighting_basement_studio
|
||||
adapt_brightness: '{{ is_state(''switch.adaptive_lighting_adapt_brightness_basement_studio'',''on'')
|
||||
}}'
|
||||
adapt_color: '{{ is_state(''switch.adaptive_lighting_adapt_color_basement_studio'',''on'')
|
||||
}}'
|
||||
mode: restart
|
||||
- id: '1696286644401'
|
||||
alias: Basement LED Strip Reset
|
||||
description: Power cycle the LED strip when it goes unavailable
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: light.basement_led_strip_1
|
||||
to: unavailable
|
||||
for:
|
||||
minutes: 5
|
||||
id: offline
|
||||
- platform: state
|
||||
entity_id: input_button.basement_led_strip_reset
|
||||
not_to:
|
||||
- unavailable
|
||||
- unknown
|
||||
id: button
|
||||
- platform: time
|
||||
at: 00:00:00
|
||||
id: midnight
|
||||
condition: []
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: and
|
||||
conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- offline
|
||||
- button
|
||||
sequence:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: '{{ is_state(''input_boolean.studio_quiet'',''off'') and
|
||||
is_state(''sensor.twitch_ironnerd24'',''offline'') and states(''switch.basement_led_strip'')
|
||||
not in [''unknown'',''unavailable''] }}'
|
||||
then:
|
||||
- repeat:
|
||||
while:
|
||||
- condition: state
|
||||
entity_id: light.basement_led_strip_1
|
||||
state: unavailable
|
||||
- condition: template
|
||||
value_template: '{{ repeat.index <= 10 }}'
|
||||
sequence:
|
||||
- service: input_number.increment
|
||||
target:
|
||||
entity_id: input_number.basement_led_strip_resets
|
||||
data: {}
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: switch.basement_led_strip
|
||||
data: {}
|
||||
- delay:
|
||||
seconds: 20
|
||||
- service: switch.turn_on
|
||||
target:
|
||||
entity_id: switch.basement_led_strip
|
||||
data: {}
|
||||
- delay:
|
||||
seconds: 30
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: midnight
|
||||
sequence:
|
||||
- service: input_number.set_value
|
||||
target:
|
||||
entity_id: input_number.basement_led_strip_resets
|
||||
data:
|
||||
value: 0
|
||||
mode: single
|
||||
- id: '1696286732266'
|
||||
alias: Living Room Lights Adaptive Resync
|
||||
description: Deals with situations where the living room lights should be adaptive
|
||||
but end up out of sync
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.living_room_sync_issue
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: '{{ is_state_attr(''light.living_room_lights'',''color_mode'',''color_temp'')
|
||||
}}'
|
||||
action:
|
||||
- service: adaptive_lighting.apply
|
||||
data:
|
||||
entity_id: switch.adaptive_lighting_living_room
|
||||
adapt_brightness: '{{ is_state(''switch.adaptive_lighting_adapt_brightness_living_room'',''on'')
|
||||
}}'
|
||||
adapt_color: '{{ is_state(''switch.adaptive_lighting_adapt_color_living_room'',''on'')
|
||||
}}'
|
||||
mode: restart
|
||||
- id: '1696286814384'
|
||||
alias: Vacation Lighting
|
||||
description: Turns on lights for helpers who come over (such as to take care of
|
||||
the cats) while we are gone
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.front_door
|
||||
to: 'on'
|
||||
id: door
|
||||
- platform: event
|
||||
event_type: timer.finished
|
||||
event_data:
|
||||
entity_id: timer.vacation_helper
|
||||
id: timer-finished
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.vacation_mode
|
||||
state: 'on'
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: door
|
||||
sequence:
|
||||
- service: input_boolean.turn_on
|
||||
target:
|
||||
entity_id: input_boolean.audible_notifications
|
||||
data: {}
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- light.basement_studio_lights
|
||||
- light.first_floor_lights
|
||||
- light.second_floor_lights
|
||||
data: {}
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: switch.presence_simulation
|
||||
data: {}
|
||||
- delay:
|
||||
seconds: 3
|
||||
- service: input_select.select_option
|
||||
target:
|
||||
entity_id:
|
||||
- input_select.basement_studio_scenes
|
||||
- input_select.living_room_scenes
|
||||
- input_select.downstairs_bathroom_scenes
|
||||
- input_select.dining_room_lamp_scenes
|
||||
- input_select.mud_room_scenes
|
||||
- input_select.upstairs_hallway_scenes
|
||||
- input_select.upstairs_bathroom_scenes
|
||||
- input_select.master_bedroom_scenes
|
||||
- input_select.kallen_bedroom_scenes
|
||||
- input_select.emma_bedroom_scenes
|
||||
data:
|
||||
option: Adaptive
|
||||
- service: input_select.select_option
|
||||
target:
|
||||
entity_id: input_select.tina_desk_scenes
|
||||
data:
|
||||
option: Evening Mode
|
||||
- service: timer.start
|
||||
target:
|
||||
entity_id: timer.vacation_helper
|
||||
data:
|
||||
duration: 01:00:00
|
||||
- service: script.speech_engine
|
||||
data:
|
||||
who: living_room
|
||||
message: Welcome, vacation helper. I have turned on every light in the house
|
||||
for you. They will remain on for one hour. Thank you for your help.
|
||||
type: alert
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id: timer-finished
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- light.basement_studio_lights
|
||||
- light.first_floor_lights
|
||||
- light.second_floor_lights
|
||||
data: {}
|
||||
- service: switch.turn_on
|
||||
target:
|
||||
entity_id: switch.presence_simulation
|
||||
data: {}
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.audible_notifications
|
||||
data: {}
|
||||
mode: restart
|
||||
|
Reference in New Issue
Block a user