mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-02-21 00:25:12 +00:00
72 lines
2.1 KiB
YAML
Executable File
72 lines
2.1 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: '21:00:00'
|
|
- condition: state
|
|
entity_id: input_boolean.alert_mode
|
|
state: 'on'
|
|
- 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 %}
|
|
0.20
|
|
{% elif now().strftime("%H")|int < 18 %}
|
|
0.50
|
|
{% else %}
|
|
0.25
|
|
{% endif %}
|
|
|
|
- service: tts.google_say
|
|
entity_id: media_player.livingroomCC
|
|
data_template:
|
|
message: >
|
|
{% if now().strftime("%H")|int < 12 %}
|
|
"Good morning.
|
|
{% elif now().strftime("%H")|int < 18 %}
|
|
"Good afternoon.
|
|
{% else %}
|
|
"Good evening.
|
|
{% endif %}
|
|
{{ value1 }}"
|
|
cache: true
|
|
|
|
|
|
|