mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-02-19 07:47:27 +00:00
180 lines
6.4 KiB
YAML
Executable File
180 lines
6.4 KiB
YAML
Executable File
######################################################################################################
|
|
###Script to send notifications to the ChromeCast Audios during normal hours and only when we are home! Call like this:
|
|
# action:
|
|
# service: script.Voice_notify
|
|
# data_template:
|
|
# value1: 'Startup: Home Assistant is Up and Running!'
|
|
# OR
|
|
# value1: "{{ trigger.to_state.state }}"
|
|
|
|
######################################################################################################
|
|
|
|
voice_notify:
|
|
sequence:
|
|
- condition: and
|
|
conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: group.family
|
|
state: 'home'
|
|
- condition: state
|
|
entity_id: input_boolean.guest_mode
|
|
state: 'on'
|
|
- condition: or
|
|
conditions:
|
|
- condition: time
|
|
after: '09:00:00'
|
|
before: '22:00:00'
|
|
- condition: state
|
|
entity_id: input_boolean.alert_mode
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.medicine
|
|
state: 'off'
|
|
- condition: or
|
|
conditions:
|
|
- condition: template
|
|
value_template: >
|
|
{% if is_state('media_player.livingroomCC', 'playing') %}
|
|
false
|
|
{% else %}
|
|
true
|
|
{% endif %}
|
|
- condition: state
|
|
entity_id: input_boolean.alert_mode
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.medicine
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.speech_notifications
|
|
state: 'on'
|
|
- service: switch.turn_on
|
|
entity_id: switch.living_room_amp
|
|
# - delay: '00:00:05'
|
|
|
|
- service: media_player.turn_on
|
|
entity_id: media_player.livingroomCC
|
|
|
|
- service: media_player.volume_set
|
|
entity_id:
|
|
- media_player.livingroomCC
|
|
data_template:
|
|
volume_level: >
|
|
{% if now().strftime("%H")|int < 12 and now().strftime("%H")|int > 6%}
|
|
0.4
|
|
{% elif now().strftime("%H")|int > 12 and now().strftime("%H")|int < 20%}
|
|
0.6
|
|
{% else %}
|
|
0.3
|
|
{% endif %}
|
|
|
|
- service: tts.amazon_polly_say
|
|
entity_id: media_player.livingroomCC
|
|
data_template:
|
|
message: >
|
|
{% if now().strftime("%H")|int < 12 and now().strftime("%H")|int > 6%}
|
|
"Good morning.
|
|
{% elif now().strftime("%H")|int > 12 and now().strftime("%H")|int < 17%}
|
|
"Good afternoon.
|
|
{% else %}
|
|
"Good evening.
|
|
{% endif %}
|
|
|
|
{%- macro responsibilities() -%}
|
|
{%if now().strftime("%a") == 'Wed' or now().strftime("%a") == 'Sun'%}
|
|
Today is {{now().strftime("%A")}} and {{now().strftime("%A")}} is garbage day.
|
|
{%endif%}
|
|
{%if now().strftime("%a") == 'Wed'%}
|
|
Both Recycling and regular Garbage goes out. Please take out all of the garbage cans tonight.
|
|
{%endif%}
|
|
{% if now().strftime("%j")|int % 2 != 0 %}
|
|
Today is Justin's day to do the chores.
|
|
{% else %}
|
|
Today is Paige's day to do the chores.
|
|
{%endif%}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro inside_weather() -%}
|
|
Inside the house, it is {{ states.climate.downstairs.attributes["current_temperature"]}} degrees with around {{states('sensor.downstairs_thermostat_humidity')}} percent humidity.
|
|
{%- endmacro -%}
|
|
|
|
{%- macro outside_weather() -%}
|
|
Outside, it is going to be {{states('sensor.dark_sky_minutely_summary')}}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro lights_status() -%}
|
|
. There are
|
|
{% for state in states.light if state.state == 'on' -%}
|
|
{%- if loop.last -%}
|
|
{{ loop.index }}
|
|
{%- endif -%}
|
|
{%- endfor %} lights on right now.
|
|
{% set comma = joiner(', ') %} The
|
|
{% for group in states.group|groupby('state') -%}
|
|
{%- for entity in group.list if entity.state == 'on' and entity.name.split(' ')[1]|lower == 'lights' and entity.name.split(' ')[0]|lower != 'all' and entity.name.split(' ')[0]|lower != 'interior' -%}
|
|
{{ ' and' if loop.last and not loop.first else comma() }}
|
|
{{ entity.name }}
|
|
{%- endfor -%}
|
|
{%- endfor %}
|
|
{%- endmacro -%}
|
|
|
|
{% macro garage_check() %}
|
|
{% if is_state('cover.large_garage', 'open') -%}
|
|
The Large Garage Door is still open
|
|
{% endif -%}
|
|
{% if is_state('cover.small_garage', 'open') -%}
|
|
{% if is_state('cover.large_garage', 'open') -%}and
|
|
{%- endif %} The small Garage Door is still open.
|
|
{% endif %}
|
|
{%- endmacro -%}
|
|
|
|
{% macro medicine() %}
|
|
{% if is_state('input_boolean.medicine', 'off') -%}
|
|
It looks like Carlo has not taken his medicine yet. Please make sure Carlo takes his medicine now.
|
|
{% endif -%}
|
|
{%- endmacro -%}
|
|
|
|
{{ personarriving }}
|
|
|
|
{% if is_state('input_boolean.responsibilities', 'on') %}
|
|
{{responsibilities()}}
|
|
{%endif%}
|
|
{{ NestStatus}}
|
|
{% if is_state('input_boolean.inside_weather', 'on') %}
|
|
{{inside_weather()}}
|
|
{%endif%}
|
|
{% if is_state('input_boolean.outside_weather', 'on') %}
|
|
{{outside_weather()}}
|
|
{%endif%}
|
|
|
|
{{ DoorOpened }}
|
|
{{ DoorClosed }}
|
|
{% if is_state('input_boolean.garage_check', 'on') %}
|
|
{{garage_check()}}
|
|
{%endif%}
|
|
{{ NewDevice}}
|
|
{% if is_state('input_boolean.lights_status', 'on') %}
|
|
{{lights_status()}}
|
|
{%endif%}
|
|
{% if is_state('input_boolean.responsibilities', 'on') %}
|
|
{{responsibilities()}}
|
|
{%endif%}
|
|
{% if now().strftime("%H")|int > 22 %}
|
|
{{Medicine()}}
|
|
{%endif%}
|
|
|
|
{{ value1 }}"
|
|
cache: true
|
|
|
|
- service: input_boolean.turn_off
|
|
entity_id:
|
|
- input_boolean.alert_mode
|
|
- input_boolean.home_stats
|
|
- input_boolean.responsibilities
|
|
- input_boolean.inside_temp
|
|
- input_boolean.outside_weather
|
|
- input_boolean.lights_status
|
|
- input_boolean.garage_check
|