home-assistant/scripts.yaml

59 lines
2.2 KiB
YAML

sonos_tts:
alias: "Sonos TTS script - Testing"
sequence:
- service: media_player.sonos_snapshot
data_template:
entity_id: "{{ sonos_entity|default('media_player.den') }}"
- service: media_player.sonos_unjoin
data_template:
entity_id: "{{ sonos_entity|default('media_player.den') }}"
- service: media_player.volume_set
data_template:
entity_id: "{{ sonos_entity|default('media_player.den') }}"
volume_level: "{{ volume|default(0.5) }}"
- service: media_player.play_media
data:
entity_id: media_player.den
media_content_id: https://hass.phoenixinquis.is-a-geek.org/local/chime.ogg
media_content_type: music
- delay: '00:00:03'
- service: tts.amazon_polly_say
data_template:
entity_id: "{{ sonos_entity|default('media_player.den') }}"
message: "{{ message }}"
- delay: "{{ delay|default('00:00:00') }}"
- wait_template: "{{ is_state(sonos_entity|default('media_player.den'), 'playing') }}"
timeout: '00:00:05'
- wait_template: "{{ not is_state(sonos_entity|default('media_player.den'), 'playing') }}"
timeout: '00:02:00'
- service: media_player.sonos_restore
data_template:
entity_id: "{{ sonos_entity|default('media_player.den') }}"
good_morning:
alias: Good morning!
sequence:
- service: script.sonos_tts
data_template:
message: >-
Good morning!
{% if is_state('device_tracker.homeassistant_pixel', 'home') %}
Hi Correl!
{% endif %}
{% if is_state('device_tracker.stephaniesiphone', 'home') %}
Hi Stephanie!
{% endif %}
Today's forecast is
{{ states.weather.dark_sky.attributes.daily_forecast_summary }}.
Right now, the weather is
{{ states.weather.dark_sky.state}} at
{{ states.weather.dark_sky.attributes.temperature }}
degrees,
{{ states.weather.dark_sky.attributes.hourly_forecast_summary }}.
{{ [ 'I hope you''re ready for an interesting day!',
'Get ready, today should be a fun one!',
'Get out there and kick some butt!',
] | random }}