From a18bb79322e0d383864bbe6ebcb8b3ab7f5e523e Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Thu, 14 Jun 2018 19:10:11 -0400 Subject: [PATCH] Move sonos tts script into the sonos package --- configuration.yaml | 1 - packages/sonos.yaml | 37 +++++++++++++++++++++++++++++++++++++ scripts.yaml | 31 ------------------------------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/configuration.yaml b/configuration.yaml index c21529e..0e93e07 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -82,5 +82,4 @@ device_tracker: zone: !include zones.yaml group: !include groups.yaml -script: !include scripts.yaml scene: !include scenes.yaml diff --git a/packages/sonos.yaml b/packages/sonos.yaml index 5f4daaa..b9d555f 100644 --- a/packages/sonos.yaml +++ b/packages/sonos.yaml @@ -18,6 +18,38 @@ binary_sensor: friendly_name: Sonos Den Night Mode value_template: >- {{ state_attr('media_player.den', 'night_sound') }} +script: + 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') }}" group: Sonos: @@ -27,6 +59,7 @@ group: - binary_sensor.den_night_mode - group.sonos_players - group.sonos_automations + - group.sonos_scripts sonos_players: name: Sonos entities: @@ -35,3 +68,7 @@ group: name: Automations entities: - automation.toggle_sonos_night_mode + sonos_scripts: + name: Scripts + entities: + - script.sonos_tts diff --git a/scripts.yaml b/scripts.yaml index c7154bd..e69de29 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -1,31 +0,0 @@ -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') }}"