home-assistant/scripts.yaml
2018-04-25 07:28:51 -04:00

67 lines
2.5 KiB
YAML

sonos_tts:
alias: "Sonos TTS"
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') }}"
weather_report:
alias: Weather report
sequence:
- service: script.sonos_tts
data_template:
message: >-
{% if now().hour > 17 %}
Good evening!
{% elif now().hour > 12 %}
Good afternoon!
{% else %}
Good morning!
{% endif %}
{% if is_state('device_tracker.homeassistant_pixel', 'home') %}
Hi Correl!
{% endif %}
{% if is_state('device_tracker.stephaniesiphone', 'home') %}
Hi Stephanie!
{% endif %}
{% if is_state('device_trackerPhilsGalaxyS7Edge.', 'home') %}
Hi Phil!
{% 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 }}