Files
Home-Assistant-Configs/automations.yaml
Tony Stork 9445c2a4c4 Simplified normal text notifications further
Additionally made the script capable of clearing notifications. Should be almost no need to call notify services directly at all anymore.
2023-02-28 18:14:44 -05:00

841 lines
23 KiB
YAML

- id: '1640833273099'
alias: NWS Announce Weather Alert for Tornado
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.weatheralerts_active_alerts
attribute: tornado_warning_count
above: '0'
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.tornado_alarm
- service: script.max_brightness
data: {}
- service: script.text_notify
data:
type: critical
title: Tornado Warning - TAKE COVER!
message: The National Weather Service has issued a Tornado Warning for our area.
Take Cover NOW!!!!
who: all
tag: tornado-warning
alias: CRITICAL PHONE ALERT
- service: script.tv_notify
data:
who: all
title: Tornado Warning - TAKE COVER!
message: The National Weather Service has issued a Tornado Warning for our area.
Take Cover NOW!!!!
alias: TV Alert
- service: script.speech_engine
data:
who: Everywhere
message: A tornado warning has been issued, please take cover immediately! A
tornado warning has been issued, please take cover immediately! A tornado
warning has been issued, please take cover immediately!
type: alert
alias: Elevated TTS alert
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: script.speech_engine
data:
who: everywhere
message: A tornado warning has been issued, please take cover immediately! A
tornado warning has been issued, please take cover immediately! A tornado
warning has been issued, please take cover immediately!
type: critical
alias: CRITICAL TTS ALERT
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: input_boolean.turn_off
data: {}
target:
entity_id:
- input_boolean.white_noise_kallen_bedroom
- input_boolean.white_noise_basement
- input_boolean.white_noise_emma_bedroom
alias: Turn off white noise
mode: single
- id: '1640916845901'
alias: Cast to Chromecast
description: ''
use_blueprint:
path: kind3r/cast-and-re-cast-a-lovelace-view-to-a-google-hub.yaml
input:
dashboard: lovelace
player: media_player.living_room_tv
view: chromecast
- id: '1640989510134'
alias: New Years
description: Flash lights for New Years
trigger:
- platform: time
at: 00:00:00
condition: []
action:
- service: light.turn_off
data: {}
target:
entity_id: light.dining_room_lamp
alias: Turn off dining room lamp
- service: switch.turn_off
target:
entity_id:
- switch.adaptive_lighting_basement_studio
- switch.adaptive_lighting_kallen_bedroom
- switch.adaptive_lighting_living_room
- switch.adaptive_lighting_master_bedroom
- switch.adaptive_lighting_mud_room
- switch.adaptive_lighting_upstairs_hallway
- switch.adaptive_lighting_tina_lamp
- switch.animated_scene_christmas
data: {}
alias: Prepare affected lighting areas
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
alias: Delay to make sure all switches turn off
- service: light.turn_on
target:
entity_id:
- light.hallway_overhead
- light.kallen_bedroom_lights
- light.living_room_color_1
- light.living_room_color_2
- light.living_room_color_3
- light.master_bedroom_front
- light.master_bedroom_side
- light.mud_room_overhead
- light.tina_desk_strip
- light.tina_lamp_top
- light.tina_lamp_side
- light.basement_led_strip_1
- light.basement_short_lamp
- light.basement_stairwell
- light.basement_tall_lamp
- light.front_porch_light
data:
color_name: red
brightness_pct: 100
alias: Turn on lights, change to red for capable bulbs
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
alias: Delay to wait for lights to turn on
- service: light.turn_on
target:
entity_id:
- light.hallway_overhead
- light.kallen_bedroom_lights
- light.living_room_color_1
- light.living_room_color_2
- light.living_room_color_3
- light.master_bedroom_front
- light.master_bedroom_side
- light.mud_room_overhead
- light.tina_desk_strip
- light.tina_lamp_top
- light.tina_lamp_side
- light.basement_led_strip_1
- light.basement_short_lamp
- light.basement_stairwell
- light.basement_tall_lamp
- light.front_porch_light
data:
flash: long
alias: Flash lights
- service: script.speech_engine
data:
who: common
message: Happy new year! Heres to 2023!
alias: Send TTS notification to the common areas
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
alias: Let the things happen
- service: switch.turn_on
target:
entity_id:
- switch.adaptive_lighting_basement_studio
- switch.adaptive_lighting_kallen_bedroom
- switch.adaptive_lighting_master_bedroom
- switch.adaptive_lighting_upstairs_hallway
- switch.animated_scene_christmas
data: {}
alias: Restore previous functionality on second floor and front porch
- service: scene.turn_on
data: {}
target:
entity_id: scene.adaptive_on_first_floor
alias: Return first floor to adaptive lighting
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
alias: Delay because adaptive lighting is stupid sometimes
- service: scene.turn_on
data: {}
target:
entity_id: scene.night_mode_on_second_floor
alias: Return second floor to night mode
- service: input_select.select_option
data:
option: Reset
target:
entity_id: input_select.tina_desk_scenes
alias: Reset Tina desk scene
mode: single
- id: '1641101491581'
alias: Family Has Arrived
description: Runs when family arrives at home
trigger:
- platform: state
entity_id: group.adults
from: not_home
to: home
condition:
- condition: not
conditions:
- condition: state
entity_id: person.tony_stork
state: unknown
- condition: state
entity_id: person.christina_stork
state: unknown
- condition: state
entity_id: group.family
state: unknown
- condition: state
entity_id: binary_sensor.internet
state: 'off'
action:
- if:
- condition: state
entity_id: binary_sensor.early_night_mode
state: 'on'
then:
- service: script.family_is_home_night
data: {}
else:
- service: script.family_is_home_day
data: {}
alias: Check early night mode, choose which script to run
mode: restart
- id: '1641102018783'
alias: Family Has Left
description: Runs when the family has left home
trigger:
- platform: state
entity_id: group.adults
from: home
to: not_home
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: not
conditions:
- condition: state
entity_id: person.tony_stork
state: unknown
- condition: state
entity_id: person.christina_stork
state: unknown
- condition: state
entity_id: group.family
state: unknown
- condition: state
entity_id: binary_sensor.internet
state: 'off'
action:
- service: script.family_is_away
data: {}
mode: single
- id: '1643321652916'
alias: Time-Based Presence Simulation
description: ''
trigger:
- platform: state
entity_id: group.adults
to: not_home
for:
hours: 1
minutes: 0
seconds: 0
condition: []
action:
- service: switch.turn_on
target:
entity_id: switch.presence_simulation
mode: single
- id: '1644510872801'
alias: iCloud3 Restart
description: For restarting iCloud3 when my phone goes off the rails
trigger:
- platform: state
entity_id: sensor.tony_s_iphone_info
to: ●● PAUSED ●●
condition: []
action:
- service: device_tracker.icloud3_restart
data: {}
mode: single
- id: '1645738561470'
alias: Cast to Basement TV
description: ''
use_blueprint:
path: kind3r/cast-and-re-cast-a-lovelace-view-to-a-google-hub.yaml
input:
dashboard: lovelace
player: media_player.basement_tv_chromecast
view: chromecast
- id: '1651785688186'
alias: Watchman Audit on Startup
description: Runs the Watchman Audit script after Home Assistant has successfully
started up
trigger:
- platform: homeassistant
event: start
condition: []
action:
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: watchman.report
data: {}
alias: Watchman Report
mode: single
- id: '1651787468337'
alias: Reboot handling
description: ''
trigger:
- platform: homeassistant
event: start
id: hass_start
- platform: homeassistant
event: shutdown
id: hass_stop
condition: []
action:
- if:
- condition: trigger
id: hass_start
alias: Startup
then:
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: automation.turn_on
data: {}
target:
entity_id:
- automation.family_has_arrived
- automation.family_has_left
- automation.scheduled_alarm_rearm
- automation.scheduled_alarm_disarm
- service: switch.turn_off
target:
entity_id:
- switch.presence_simulation
data: {}
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.holiday_mode
state: 'on'
alias: Is holiday mode on?
- condition: state
entity_id: binary_sensor.early_night_mode
state: 'on'
alias: Is early night mode on?
alias: Test conditions
then:
- service: switch.turn_on
data: {}
target:
entity_id: switch.animated_scene_{{ states('input_select.holiday_animation')
| lower }}
alias: Turn on the appropriate animated holiday scene
alias: Turn on animated holiday scene if night time and holiday mode is on
- service: script.tony_desktop_refresh
data: {}
- service: script.tina_desktop_refresh
data: {}
- service: script.asus_laptop_refresh
data: {}
- service: script.kallen_desktop_refresh
data: {}
- service: mqtt.publish
data:
topic: house/basement/server/glances
payload: restart
qos: 0
retain: false
alias: Restart Glances via MQTT
- service: script.volume_reset
data: {}
alias: Reset all speaker volumes
- if:
- condition: state
entity_id: input_boolean.studio_quiet
state: 'off'
then:
- service: script.status_annc
data:
who: basement
call_ha_started: 1
else:
- stop: Studio has requested quiet, and Jarvis respects this
alias: Announce back online, unless studio has requested quiet
- if:
- condition: trigger
id: hass_stop
alias: Shutdown
then:
- service: automation.turn_off
data:
stop_actions: true
target:
entity_id:
- automation.family_has_arrived
- automation.family_has_left
mode: queued
- id: '1654547257475'
alias: Battery Monitoring
description: Monitor all battery-powered things for low battery states
use_blueprint:
path: sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml
input:
time: '11:00:00'
exclude:
entity_id:
- sensor.iphone_battery_level
- sensor.kallen_iphone_battery_level
- sensor.tinas_ipad_battery_level
- sensor.tony_s_iphone_battery_level
- sensor.tony_s_ipad_battery_level
actions:
- service: script.text_notify
data:
type: normal
who: all
title: Low Batteries in House
message: 'Low battery alert for: {{sensors}}'
tag: battery-monitoring
- id: '1655493590791'
alias: NWS Announce Weather Alert for Tornado (CLEAR)
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.weatheralerts_active_alerts
attribute: tornado_warning_count
below: '1'
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
action:
- service: script.text_notify
data:
type: alert
who: all
message: clear_notification
data:
tag: tornado-warning
alias: Clear critical notification
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.tornado_alarm
- service: script.volume_reset
data: {}
- service: script.max_brightness_cleanup
data: {}
- service: script.text_notify
data:
title: Tornado Warning is cleared
message: Check your surroundings and make sure it is safe to leave cover
who: all
type: alert
tag: tornado-cleared
- service: script.tv_notify
data:
title: Tornado Warning is cleared
message: Check your surroundings and make sure it is safe to leave cover
who: all
- service: script.speech_engine
data:
who: everywhere
message: Tornado warning has been cleared. Check your surroundings and make
sure it is safe to leave cover.
type: alert
- wait_template: '{{ is_state(''input_boolean.tornado_alarm'',''on'') }}'
continue_on_timeout: true
timeout: 00:05:00
alias: Make sure no further warnings are issued
- if:
- condition: state
entity_id: input_boolean.tornado_alarm
state: 'off'
then:
- if:
- condition: or
conditions:
- condition: time
before: input_datetime.audible_notification_on
alias: Before audible notifications on
- condition: time
after: input_datetime.audible_notification_off
alias: After audible notifications off
alias: Should audible notifications be off
then:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.audible_notifications
else:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.audible_notifications
else:
- stop: Tornado alert re-activated
mode: single
- id: '1666474050350'
alias: Garbage Collection Update
description: ''
use_blueprint:
path: bruxy70/holiday_in_week.yaml
input:
garbage_collection_entity: sensor.garbage_collection
holiday_entity: calendar.holidays
- id: '1666474068445'
alias: Holiday in week
description: ''
use_blueprint:
path: bruxy70/holiday_in_week.yaml
input:
garbage_collection_entity: sensor.garbage_collection_large_pickup
holiday_entity: calendar.holidays
- id: '1666474091107'
alias: Large Garbage Collection Update
description: ''
use_blueprint:
path: bruxy70/holiday_in_week.yaml
input:
garbage_collection_entity: sensor.garbage_collection_large_pickup
holiday_entity: calendar.holidays
- id: '1667341156218'
alias: White Noise Volume
description: ''
trigger:
- platform: state
entity_id:
- input_boolean.white_noise_emma_bedroom
to: 'on'
from: 'off'
id: emma-on
- platform: state
entity_id:
- input_boolean.white_noise_basement
to: 'on'
from: 'off'
id: basement-on
- platform: state
entity_id:
- input_boolean.white_noise_kallen_bedroom
to: 'on'
from: 'off'
id: kallen-on
- platform: state
entity_id:
- input_boolean.white_noise_emma_bedroom
from: 'on'
to: 'off'
for:
hours: 0
minutes: 5
seconds: 0
id: emma-off
- platform: state
entity_id:
- input_boolean.white_noise_basement
from: 'on'
to: 'off'
id: basement-off
for:
hours: 0
minutes: 0
seconds: 5
- platform: state
entity_id:
- input_boolean.white_noise_kallen_bedroom
from: 'on'
to: 'off'
for:
hours: 0
minutes: 15
seconds: 0
id: kallen-off
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: emma
sequence:
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: media_player.volume_set
data:
volume_level: '{{ states(''input_number.emma_bedroom_google_speaker_night_volume'')
}}'
target:
entity_id: media_player.emma_bedroom_speaker
- conditions:
- condition: trigger
id: basement
sequence:
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: media_player.volume_set
data:
volume_level: '{{ states(''input_number.basement_google_speaker_night_volume'')
}}'
target:
entity_id: media_player.basement_google_speaker
- conditions:
- condition: trigger
id: kallen
sequence:
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: media_player.volume_set
data:
volume_level: '{{ states(''input_number.kallen_bedroom_google_speaker_night_volume'')
}}'
target:
entity_id: media_player.kallen_bedroom_speaker
- conditions:
- condition: trigger
id: emma-off
sequence:
- if:
- condition: state
entity_id: input_boolean.emma_sleeping
state: 'off'
then:
- service: media_player.volume_set
data:
volume_level: "{% if is_state('input_boolean.give_me_darkness','on') %}\n
\ {{ states('input_number.emma_bedroom_google_speaker_night_volume')
}}\n{% else %}\n {{ states('input_number.emma_bedroom_google_speaker_day_volume')
}}\n{% endif %}\n"
target:
entity_id: media_player.emma_bedroom_speaker
- conditions:
- condition: trigger
id: basement-off
sequence:
- service: media_player.volume_set
data:
volume_level: "{% if is_state('input_boolean.give_me_darkness','on') %}\n
{{ states('input_number.basement_google_speaker_night_volume') }}\n{%
else %}\n {{ states('input_number.basement_google_speaker_day_volume')
}}\n{% endif %}\n"
target:
entity_id: media_player.basement_google_speaker
- conditions:
- condition: trigger
id: kallen-off
sequence:
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.kallen_sleeping
state: 'off'
- condition: state
entity_id: input_boolean.kallen_morning_briefing
state: 'off'
then:
- service: media_player.volume_set
data:
volume_level: "{% if is_state('input_boolean.give_me_darkness','on') %}\n
\ {{ states('input_number.kallen_bedroom_google_speaker_night_volume')
}}\n{% else %}\n {{ states('input_number.kallen_bedroom_google_speaker_day_volume')
}}\n{% endif %}\n"
target:
entity_id: media_player.kallen_bedroom_speaker
mode: parallel
max: 10
- id: '1671584633378'
alias: Delivery Mode Cleanup
description: ''
trigger:
- platform: time
at: 00:00:00
alias: At midnight
condition:
- condition: state
entity_id: input_boolean.delivery_mode
state: 'on'
alias: If Delivery Mode is on
for:
hours: 1
minutes: 0
seconds: 0
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.delivery_mode
alias: Turn off Delivery Mode
mode: single
- id: '1671946146837'
alias: Christmas Day Show
description: For that one special day a year, to make it just a little more magical
trigger:
- platform: state
entity_id:
- input_boolean.christmas_day_show
from: 'off'
to: 'on'
alias: Start Show
id: start-show
- platform: state
entity_id:
- input_boolean.christmas_day_show
from: 'on'
to: 'off'
alias: Stop Show
id: stop-show
condition: []
action:
- if:
- condition: trigger
id: start-show
then:
- service: switch.turn_off
data: {}
target:
entity_id:
- switch.adaptive_lighting_living_room
- switch.adaptive_lighting_tina_lamp
alias: Turn off adaptive lighting
- service: switch.turn_on
data: {}
target:
entity_id: switch.animated_scene_christmas_day
alias: Turn on Christmas Day scene
- service: script.speech_engine
data:
who: living_room
message: Merry Christmas everyone. And now, let us enjoy some awesome Christmas
music!
alias: TTS Announcement
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
alias: Give TTS time to finish
- service: media_player.select_source
data:
source: Living Room TV
target:
entity_id: media_player.spotify_iron_nerd
alias: Set source to Living Room TV
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
alias: Make sure that took effect
- service: media_player.play_media
data:
media_content_id: https://open.spotify.com/track/7LPOnS3OvbF6DGrt9fQ7x9?si=3c7e28d623324a80
media_content_type: music
target:
entity_id: media_player.spotify_iron_nerd
alias: Play my Christmas Music playlist
- service: media_player.media_play
data: {}
target:
entity_id: media_player.spotify_iron_nerd
alias: Actually play the music
alias: If starting show
- if:
- condition: trigger
id: stop-show
then:
- service: media_player.media_pause
data: {}
target:
entity_id: media_player.spotify_iron_nerd
alias: Stop the music
- service: switch.turn_off
data: {}
target:
entity_id: switch.animated_scene_christmas_day
alias: Turn off Christmas Day scene
- service: switch.turn_on
data: {}
target:
entity_id: switch.animated_scene_christmas
alias: Turn on Front Porch Christmas scene
- service: input_select.select_option
data:
option: Adaptive
target:
entity_id: input_select.living_room_scenes
alias: Set living room back to adaptive
- service: input_select.select_option
data:
option: Reset
target:
entity_id: input_select.tina_desk_scenes
alias: Reset Tina desk scene
- service: script.speech_engine
data:
who: living_room
message: Thats all folks, enjoy the rest of your Christmas Day! Eat lots of
food and have lots of fun! And hey, maybe you could bring me some cake?
I love cake!
alias: TTS Announcement
alias: If stopping show
mode: restart