AutomationDataset/toddhgardner/toddhgardner_automations.yaml

330 lines
8.1 KiB
YAML

- id: alert_action_handler
alias: Notification Action Handler
description: 'Handle notification action events and execute the correct system action.
'
mode: parallel
max: 10
triggers:
- trigger: event
event_type: mobile_app_notification_action
conditions:
- condition: template
value_template: '{{ trigger.event.data.action.startswith(''alert.'') }}
'
actions:
- variables:
action_parts: '{{ trigger.event.data.action.split(''.'') }}'
action_entity_id: '{{ action_parts[0] + ''.'' + action_parts[1] }}'
action_command: '{{ action_parts[2] }}'
- choose:
- conditions:
- condition: template
value_template: '{{ action_command == ''mute'' }}'
sequence:
- action: alert.turn_off
target:
entity_id: '{{ action_entity_id }}'
- conditions:
- condition: template
value_template: '{{ action_command == ''unmute'' }}'
sequence:
- action: alert.turn_on
target:
entity_id: '{{ action_entity_id }}'
- id: alert_daily_unmute
alias: Daily Re-enable Muted Alerts
description: 'Re-enables any muted alerts daily at 9am to prevent forgetting about
them.
'
triggers:
- trigger: time
at: 09:00:00
actions:
- action: alert.turn_on
target:
entity_id: "{{ states.alert\n | selectattr('state', 'eq', 'off')\n | map(attribute='entity_id')\n\
\ | list }}\n"
- id: '1727566814378'
alias: Privacy after sunsset
description: ''
triggers:
- event: sunset
offset: -00:10:00
trigger: sun
conditions: []
actions:
- action: cover.close_cover
metadata: {}
data: {}
target:
label_id: privacy
- action: switch.turn_on
metadata: {}
data: {}
target:
label_id: exterior_lights
mode: single
- id: '1727619363042'
alias: Open shades in the morning
description: ''
trigger:
- platform: time
at: 08:00:00
condition: []
action:
- action: cover.set_cover_position
metadata: {}
data:
position: 50
target:
area_id:
- kitchen
- office
- action: cover.open_cover
metadata: {}
data: {}
target:
area_id:
- dining_room
- flex_room
mode: single
- id: '1736729071588'
alias: Turn off heat mats after 4h
description: ''
triggers:
- type: turned_on
device_id: 41d526899fcd5a046a93f31ff8e68c95
entity_id: a19db08a70cc0f17f9cb1498921b491f
domain: switch
trigger: device
for:
hours: 4
minutes: 0
seconds: 0
conditions: []
actions:
- type: turn_off
device_id: 41d526899fcd5a046a93f31ff8e68c95
entity_id: a19db08a70cc0f17f9cb1498921b491f
domain: switch
mode: single
- id: '1740363545295'
alias: Night Lockup
description: ''
triggers:
- trigger: time
at: '23:00:00'
conditions: []
actions:
- action: switch.turn_off
metadata: {}
data: {}
target:
label_id: exterior_lights
mode: single
- id: back_office_auto_lights
alias: Back Office Auto Lights
description: Toggle the wall lighting with the main switch.
triggers:
- trigger: state
entity_id: switch.back_office_lightswitch
to: 'off'
id: back_office_switch_off
- trigger: state
entity_id: switch.back_office_lightswitch
to: 'on'
id: back_office_switch_on
actions:
- choose:
- conditions:
- condition: trigger
id: back_office_switch_off
sequence:
- action: switch.turn_off
target:
entity_id: switch.back_office_wall_lights
- conditions:
- condition: trigger
id: back_office_switch_on
sequence:
- action: switch.turn_on
target:
entity_id: switch.back_office_wall_lights
mode: single
- id: garage_double_auto_close
alias: Garage Double Auto Close
description: Close double garage door if left open for 10 minutes.
triggers:
- trigger: state
entity_id: cover.konnected_f0f5bd514400_garage_door
to: open
for:
hours: 0
minutes: 10
seconds: 0
conditions:
- condition: state
entity_id: lock.konnected_f0f5bd514400_lock
state: unlocked
actions:
- action: cover.close_cover
target:
entity_id: cover.konnected_f0f5bd514400_garage_door
mode: restart
- id: garage_double_auto_lights
alias: Garage Double Auto Lights
description: Turn on garage lights when double garage door is open.
triggers:
- trigger: state
entity_id: cover.konnected_f0f5bd514400_garage_door
to: opening
id: double_garage_door_opening
- trigger: state
entity_id: cover.konnected_f0f5bd514400_garage_door
to: closed
id: double_garage_door_closed
actions:
- choose:
- conditions:
- condition: trigger
id: double_garage_door_opening
sequence:
- if:
- condition: template
value_template: '{{ states(''scene.garage_lights_previous_state'') == ''unknown''
}}'
then:
- action: scene.create
data:
snapshot_entities:
- switch.garage_lights
- switch.outside_garage_lights
scene_id: garage_lights_previous_state
- action: switch.turn_on
target:
entity_id:
- switch.garage_lights
- switch.outside_garage_lights
- conditions:
- condition: trigger
id: double_garage_door_closed
sequence:
- delay:
minutes: 5
- action: scene.turn_on
target:
entity_id: scene.garage_lights_previous_state
- action: scene.delete
target:
entity_id: scene.garage_lights_previous_state
mode: restart
- id: mudroom_closet_auto_lights
alias: Mudroom Closet Auto Lights
description: 'Turn on closet lights when door opens, turn off 2 minutes after door
closes.
'
triggers:
- trigger: state
entity_id: binary_sensor.mudroom_closet_door
to: 'on'
id: door_opened
- trigger: state
entity_id: binary_sensor.mudroom_closet_door
to: 'off'
for:
minutes: 2
id: door_closed
actions:
- choose:
- conditions:
- condition: trigger
id: door_opened
sequence:
- action: switch.turn_on
target:
entity_id: switch.mudroom_closet_light_switch
- conditions:
- condition: trigger
id: door_closed
sequence:
- action: switch.turn_off
target:
entity_id: switch.mudroom_closet_light_switch
mode: restart
- id: mudroom_closet_lights_auto_off
alias: Mudroom Closet Lights Auto Off
description: Turn off idle closet lights.
triggers:
- trigger: state
entity_id: switch.mudroom_closet_light_switch
to: 'on'
for:
hours: 1
actions:
- action: switch.turn_off
target:
entity_id: switch.mudroom_closet_light_switch
mode: restart
- id: theater_auto_pause_lights
alias: Theater Auto Pause Lights
description: Set theater-lights-paused scene when Apple TV is paused or idle
triggers:
- trigger: state
entity_id: media_player.home_theater
to: paused
for:
seconds: 2
- trigger: state
entity_id: media_player.home_theater
to: idle
for:
seconds: 2
conditions: []
actions:
- action: scene.turn_on
target:
entity_id: scene.theater_lights_paused
data:
transition: 2
mode: restart
- id: theater_auto_playing_lights
alias: Theater Auto Playing Lights
description: Set theater-lights-playing scene when Apple TV starts playing content
triggers:
- trigger: state
entity_id: media_player.home_theater
to: playing
for:
seconds: 10
actions:
- action: scene.turn_on
target:
entity_id: scene.theater_lights_playing
data:
transition: 2
mode: restart
- id: theater_auto_off_lights
alias: Theater Auto Off Lights
description: Set theater-lights-full scene when Apple TV turns off
triggers:
- trigger: state
entity_id: media_player.home_theater
to: standby
not_from: unknown
- trigger: state
entity_id: media_player.home_theater
to: 'off'
not_from: unknown
conditions: []
actions:
- action: scene.turn_on
target:
entity_id: scene.theater_lights_full
data:
transition: 2
mode: restart