Moving some automations to the audio package

This commit is contained in:
Jeffrey Stone 2020-05-28 14:58:38 -04:00
parent 05350be8e1
commit 63ded7ed88
2 changed files with 91 additions and 37 deletions

View File

@ -405,36 +405,6 @@
service: frontend.set_theme
data:
name: midnight-AH
- id: turn_off_audible_notifications
alias: Turn Off Audible Notifications
initial_state: true
trigger:
- platform: time
at: '19:30:00'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.audible_notifications
- id: turn_off_audible_notifications_guests
alias: Turn Off Audible Notifications at 7pm
initial_state: true
trigger:
- platform: time
at: '19:30:00'
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.audible_notifications
- id: turn_on_audible_notifications
alias: Turn On Audible Notifications at 7am
initial_state: true
trigger:
- platform: time
at: 06:40:00
action:
- service: script.turn_on_ha_speaker
- id: jeff_eta_home
alias: Jeff eta home
initial_state: true
@ -745,24 +715,26 @@
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.mail_fedex_delivered
entity_id: sensor.mail_fedex_delivered_2
- platform: state
entity_id: sensor.mail_ups_delivered
#send only if mail or packages are more than 0
condition:
- condition: or
conditions:
- condition: template
value_template: "{{ states('sensor.mail_fedex_delivered') | int > 0 }}"
value_template: "{{ states('sensor.mail_fedex_delivered_2') | int > 0 }}"
- condition: template
value_template: "{{ states('sensor.mail_ups_delivered') | int > 0 }}"
action:
- service: script.text_notify
data_template:
who: "jeff"
title: "Package Delivered"
message: "Fedex just made a delivery"
message: "Fedex/UPS just made a delivery"
- service: script.ah_report
data_template:
usps: >-
{%- if states.sensor.mail_fedex_delivered.state | int > 0 -%}
Federal Express just left something on the porch.
{%- endif -%}
A package was just left on the porch.
call_interuption: 1

View File

@ -12,7 +12,89 @@
# If you are running Hassio or Home Assistant as it is called now you will need a server that hosts local audio files if you want to leverage those
###############################################################################
# automation:
input_datetime:
audible_notification_on:
name: Audible Notifications On
has_date: false
has_time: true
audible_notification_off:
name: Audible Notifications Off
has_date: false
has_time: true
automation:
- id: turn_off_audible_notifications
alias: Turn Off Audible Notifications
initial_state: true
trigger:
platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_off', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.audible_notifications
# - id: turn_off_audible_notifications_guests
# alias: Turn Off Audible Notifications at 7pm
# initial_state: true
# trigger:
# - platform: time
# at: '19:30:00'
# condition:
# - condition: state
# entity_id: input_boolean.guest_mode
# state: 'on'
# action:
# - service: input_boolean.turn_off
# entity_id: input_boolean.audible_notifications
- id: turn_on_audible_notifications
alias: Turn On Audible Notifications at 7am
initial_state: true
trigger:
platform: template
value_template: "{{ states('sensor.time') == (state_attr('input_datetime.audible_notification_on', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
action:
- service: script.turn_on_ha_speaker
- id: set_audible_time_off_guest
alias: set audible time off guest
trigger:
- platform: state
entity_id: input_boolean.guest_mode
to: 'on'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.audible_notification_off
data_template:
time: >
{% if states.binary_sensor.school_tomorrow.state == 'on' %}
19:30
{% else %}
20:30
{% endif %}
- id: set_audible_time_off_normal
alias: set audible time off normal
trigger:
- platform: state
entity_id: input_boolean.guest_mode
to: 'off'
- platform: state
entity_id: binary_sensor.school_tomorrow
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.audible_notification_off
data_template:
time: >
{% if states.binary_sensor.school_tomorrow.state == 'on' %}
19:30
{% else %}
20:45
{% endif %}
# # Turn off Input Booleans when audio stops - Based on ha_speaker state.
# - id: reset_ib_when_stopped
# alias: Reset Input Booleans When Stopped