From: Giorgio Ravera Date: Sat, 2 Mar 2019 10:33:59 +0000 (+0100) Subject: Added laura_voice script X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=ae77e4cff67b5b9aee190f51111fe9077157edd1;p=homeassistant.git Added laura_voice script --- diff --git a/customizations/script.yaml b/customizations/script.yaml index b4c6f82e..dfa4dc4f 100644 --- a/customizations/script.yaml +++ b/customizations/script.yaml @@ -16,3 +16,6 @@ script.speech_engine: script.speech_status: icon: mdi:voice + +script.laura_voice: + icon: mdi:voice diff --git a/script/audio.yaml b/script/audio.yaml new file mode 100644 index 00000000..78726ef5 --- /dev/null +++ b/script/audio.yaml @@ -0,0 +1,36 @@ +###################################################################### +# Script: Laura +# Inputs: +# - type: +# 1 -> bell'affare +# +# Operations: +# - media_player.play_media +###################################################################### + +laura_voice: + alias: Voce Laura + sequence: + - condition: state + entity_id: input_boolean.speech_notifications + state: 'on' + + - service: script.notify_volume_manager + data_template: + media_player: "{{ media_player }}" + volume_level: "{{ volume_level }}" + + - service: media_player.play_media + data_template: + entity_id: >- + {# Check Null Input #} + {% if media_player | length == 0 %} + {% set media_player = 'media_player.google_home' %} + {% endif %} + {{ media_player }} + media_content_type: 'audio/mp4' + media_content_id: >- + {% if type is not defined %} + {% set type = 1 %} + {% endif %} + https://home.giorgioravera.it/local/audio/laura/{{type}}.mp3 diff --git a/script/notify.yaml b/script/notify.yaml index db996bfd..c6e8d3ea 100644 --- a/script/notify.yaml +++ b/script/notify.yaml @@ -60,25 +60,18 @@ notify_text: enable_persistent: "{{ enable_persistent }}" ###################################################################### -# Script: Voice Notification +# Script: Volume Manager # Input: # - media_player # - volume_level -# - language -# - message # # Operations: # - media_player.volume_set -# - tts.google_say ###################################################################### -notify_voice: - alias: Notifiche vocali +notify_volume_manager: + alias: Gestione Volume sequence: - - condition: state - entity_id: input_boolean.speech_notifications - state: 'on' - - service: media_player.volume_set data_template: entity_id: >- @@ -90,7 +83,7 @@ notify_voice: volume_level: >- {# Default Values #} {% set defaultVolume = 0.30 %} - {% set maxDayVolume = 0.50 %} + {% set maxDayVolume = 0.60 %} {% set maxNightVolume = 0.20 %} {# Check Null Input #} @@ -113,6 +106,31 @@ notify_voice: {% endif %} {% endif %} +###################################################################### +# Script: Voice Notification +# Input: +# - media_player +# - volume_level +# - language +# - message +# +# Operations: +# - script.notify_volume_manager +# - tts.google_say +###################################################################### + +notify_voice: + alias: Notifiche vocali + sequence: + - condition: state + entity_id: input_boolean.speech_notifications + state: 'on' + + - service: script.notify_volume_manager + data_template: + media_player: "{{ media_player }}" + volume_level: "{{ volume_level }}" + - service: tts.google_say data_template: entity_id: >- diff --git a/www/audio/laura/1.mp3 b/www/audio/laura/1.mp3 new file mode 100644 index 00000000..ff9d22c7 Binary files /dev/null and b/www/audio/laura/1.mp3 differ diff --git a/www/audio/laura/2.mp3 b/www/audio/laura/2.mp3 new file mode 100644 index 00000000..f6cbd2c4 Binary files /dev/null and b/www/audio/laura/2.mp3 differ diff --git a/www/audio/laura/3.mp3 b/www/audio/laura/3.mp3 new file mode 100644 index 00000000..b062b369 Binary files /dev/null and b/www/audio/laura/3.mp3 differ