Updated config from video on trigger ids

This commit is contained in:
Jeffrey Stone 2021-08-15 16:47:35 -04:00
parent 07a7a8c616
commit 5773d65279
2 changed files with 189 additions and 90 deletions

View File

@ -86,46 +86,95 @@ automation:
# 1. You can test the haunted house piece without kicking having to be on Halloween # 1. You can test the haunted house piece without kicking having to be on Halloween
# 2. It gives you the ability to kill the show if things go horribly wrong... # 2. It gives you the ability to kill the show if things go horribly wrong...
# #
- id: operation_haunted_house_on # - id: operation_haunted_house_on
alias: Operation Haunted House On # alias: Operation Haunted House On
initial_state: true # initial_state: true
# If this_is_halloween switch is turned on then we start the show. # # If this_is_halloween switch is turned on then we start the show.
# trigger:
# - platform: state
# entity_id: input_boolean.this_is_halloween
# to: 'on'
# action:
# # First up we play This is Halloween from Nightmare Before Christmas. Change this to what ever audio you want, or comment this one out.
# - service: script.local_audio
# data:
# media: "/media/disney/This_is_Halloween.mp3"
# volume: .5
# # And turn on the haunted House script.
# - service: script.turn_on
# entity_id: script.haunted_house
# # Haunted House Kill Switch. If the this_is_halloween switch is turned off, the stop everything.
# - id: operation_haunted_house_off
# alias: Operation Haunted House Off
# initial_state: true
# trigger:
# - platform: state
# entity_id: input_boolean.this_is_halloween
# to: 'off'
# action:
# # This stops the media player. Besure to change it to match your music player
# - service: media_player.media_stop
# entity_id: media_player.ha_speaker
# # this kills the local_audio script if its running.
# - service: script.turn_off
# entity_id: script.local_audio
# # This kills the youtube audio script if it is running.
# - service: script.turn_off
# entity_id: script.youtube_audio
# # And finally we turn off the haunted house script so no more sounds play.
# - service: script.turn_off
# entity_id: script.haunted_house
- id: operation haunted house
alias: Operation Haunted House
trigger: trigger:
# If this_is_halloween switch is turned on then we start the show.
- platform: state - platform: state
entity_id: input_boolean.this_is_halloween entity_id: input_boolean.this_is_halloween
to: 'on' to: 'on'
action: from: 'off'
# First up we play This i sHalloween from Nightmare Before Christmas. Change this to what ever audio you want, or comment this one out. id: start
- service: script.local_audio # If this_is_halloween switch is turned off then we stop the show.
data_template:
media: "/media/disney/This_is_Halloween.mp3"
volume: .5
# And turn on the haunted House script.
- service: script.turn_on
entity_id: script.haunted_house
# Haunted House Kill Switch. If the this_is_halloween siwtch is turned off, the stop everything.
- id: operation_haunted_house_off
alias: Operation Haunted House Off
initial_state: true
trigger:
- platform: state - platform: state
entity_id: input_boolean.this_is_halloween entity_id: input_boolean.this_is_halloween
id: stop
from: 'on'
to: 'off' to: 'off'
action: action:
# This stops the media player. Besure to change it to match your mecia player # Choose provides decision logic
- service: media_player.media_stop - choose:
entity_id: media_player.ha_speaker # Start the show
# this kills the local_audio script if its running. - conditions:
- service: script.turn_off - condition: trigger
entity_id: script.local_audio id: start
# This kills the youtube audio script if it is running. sequence:
- service: script.turn_off # First up we play This is Halloween from Nightmare Before Christmas. Change this to what ever audio you want, or comment this one out.
entity_id: script.youtube_audio - service: script.local_audio
# And finally we turn off the haunted house script so no more sounds play. data:
- service: script.turn_off media: "/media/disney/This_is_Halloween.mp3"
entity_id: script.haunted_house volume: .5
# And turn on the haunted House script.
- service: script.turn_on
target:
entity_id: script.haunted_house
# Stop the show
- conditions:
- condition: trigger
id: stop
sequence:
# And finally we turn off the haunted house script so no more sounds play.
- service: script.turn_off
target:
entity_id: script.haunted_house
# This stops the media player. Besure to change it to match your music player
- service: media_player.media_stop
target:
entity_id: media_player.ha_speaker
default: []
initial_state: true
mode: single
script: script:

View File

@ -393,8 +393,8 @@ automation:
############################################# #############################################
# Normal Notifications # Normal Notifications
# Door chime when doors are open to make sure we know when people are coming/going # Door chime when doors are open to make sure we know when people are coming/going
- id: door_chime - id: door_notifications
alias: Door Chine alias: Door Notifications
trigger: trigger:
- platform: state - platform: state
entity_id: entity_id:
@ -403,6 +403,17 @@ automation:
- binary_sensor.attic_door - binary_sensor.attic_door
- binary_sensor.back_door - binary_sensor.back_door
to: 'on' to: 'on'
id: chime
- platform: state
entity_id:
- binary_sensor.front_door
- binary_sensor.laundry_room_door
- binary_sensor.attic_door
- binary_sensor.back_door
from: 'off'
to: 'on'
for: '00:01:00'
id: door_still_open
condition: condition:
condition: and condition: and
conditions: conditions:
@ -421,48 +432,87 @@ automation:
entity_id: media_player.ha_speaker entity_id: media_player.ha_speaker
state: 'off' state: 'off'
action: action:
- service: script.door_chime - choose:
- conditions:
- condition: trigger
id: chime
sequence:
- service: media_player.turn_on
entity_id: media_player.ha_speaker
- service: media_player.volume_set
data_template:
entity_id: media_player.ha_speaker
volume_level: .5
- service: media_player.play_media
entity_id: media_player.ha_speaker
data:
media_content_id: /media/sounds/door_open.wav
media_content_type: "music"
- conditions:
- condition: trigger
id: door_still_open
sequence:
- service: script.speech_engine
data:
who: '{{ states.sensor.room_audio.state }}'
message: >
The {{ trigger.to_state.attributes.friendly_name }}
{{ [
' is standing open.',
' is open.',
' does not close on its own.',
' was left standing open.'
] | random }}
{{ [
'Can a human be so kind and close it?',
'The air quality in this house has actually improved.',
'Closing the door would improve the internal climate of the house.',
'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.',
'If at first you do not succeed in closing the door, please try again. Like, Right now seems like a good time to try again.',
'And the automatic door closer appears to be broken. So, you know what to do. Time to get physical.',
'I would close it for you. But I lack legs. And Arms.'
] | random }}
initial_state: true initial_state: true
# If door is open too long play message and identify open door. # # If door is open too long play message and identify open door.
- id: door_opened_long # - id: door_opened_long
alias: Door Opened Too Long # alias: Door Opened Too Long
trigger: # trigger:
- platform: state # - platform: state
entity_id: # entity_id:
- binary_sensor.front_door # - binary_sensor.front_door
- binary_sensor.laundry_room_door # - binary_sensor.laundry_room_door
- binary_sensor.attic_door # - binary_sensor.attic_door
- binary_sensor.back_door # - binary_sensor.back_door
from: 'off' # from: 'off'
to: 'on' # to: 'on'
for: '00:01:00' # for: '00:01:00'
condition: # condition:
- condition: state # - condition: state
entity_id: input_boolean.audible_notifications # entity_id: input_boolean.audible_notifications
state: 'on' # state: 'on'
action: # action:
- service: script.speech_engine # - service: script.speech_engine
data_template: # data_template:
who: '{{ states.sensor.room_audio.state }}' # who: '{{ states.sensor.room_audio.state }}'
message: > # message: >
The {{ trigger.to_state.attributes.friendly_name }} # The {{ trigger.to_state.attributes.friendly_name }}
{{ [ # {{ [
' is standing open.', # ' is standing open.',
' is open.', # ' is open.',
' does not close on its own.', # ' does not close on its own.',
' was left standing open.' # ' was left standing open.'
] | random }} # ] | random }}
{{ [ # {{ [
'Can a human be so kind and close it?', # 'Can a human be so kind and close it?',
'The air quality in this house has actually improved.', # 'The air quality in this house has actually improved.',
'Closing the door would improve the internal climate of the house.', # 'Closing the door would improve the internal climate of the house.',
'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.', # 'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.',
'If at first you do not succeed in closing the door, please try again. Like, Right now seems like a good time to try again.', # 'If at first you do not succeed in closing the door, please try again. Like, Right now seems like a good time to try again.',
'And the automatic door closer appears to be broken. So, you know what to do. Time to get physical.', # 'And the automatic door closer appears to be broken. So, you know what to do. Time to get physical.',
'I would close it for you. But I lack legs. And Arms.' # 'I would close it for you. But I lack legs. And Arms.'
] | random }} # ] | random }}
initial_state: true # initial_state: true
# If guest mode is enabled, notify the house # If guest mode is enabled, notify the house
- id: guest_mode_feedback - id: guest_mode_feedback
@ -872,22 +922,22 @@ script:
# door chime script, just plays sound anytime called. # door chime script, just plays sound anytime called.
door_chime: # door_chime:
sequence: # sequence:
- condition: state # - condition: state
entity_id: input_boolean.audible_notifications # entity_id: input_boolean.audible_notifications
state: 'on' # state: 'on'
- service: media_player.turn_on # - service: media_player.turn_on
entity_id: media_player.ha_speaker # entity_id: media_player.ha_speaker
- service: media_player.volume_set # - service: media_player.volume_set
data_template: # data_template:
entity_id: media_player.ha_speaker # entity_id: media_player.ha_speaker
volume_level: .5 # volume_level: .5
- service: media_player.play_media # - service: media_player.play_media
entity_id: media_player.ha_speaker # entity_id: media_player.ha_speaker
data: # data:
media_content_id: /media/sounds/door_open.wav # media_content_id: /media/sounds/door_open.wav
media_content_type: "music" # media_content_type: "music"
# Play Fire alarm Siren # Play Fire alarm Siren
# fire_alarm: # fire_alarm: