]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Added laura_voice script
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Sat, 2 Mar 2019 10:33:59 +0000 (11:33 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Sat, 2 Mar 2019 10:33:59 +0000 (11:33 +0100)
customizations/script.yaml
script/audio.yaml [new file with mode: 0644]
script/notify.yaml
www/audio/laura/1.mp3 [new file with mode: 0644]
www/audio/laura/2.mp3 [new file with mode: 0644]
www/audio/laura/3.mp3 [new file with mode: 0644]

index b4c6f82eeea790a1119c8a7b0f42344449a29d2a..dfa4dc4f5cb5f4e483dbadc19ef993ed4549dc07 100644 (file)
@@ -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 (file)
index 0000000..78726ef
--- /dev/null
@@ -0,0 +1,36 @@
+######################################################################\r
+# Script: Laura\r
+# Inputs: \r
+# - type:\r
+#         1 -> bell'affare\r
+#\r
+# Operations:\r
+# - media_player.play_media\r
+######################################################################\r
+\r
+laura_voice:\r
+  alias: Voce Laura\r
+  sequence:\r
+    - condition: state\r
+      entity_id: input_boolean.speech_notifications\r
+      state: 'on'\r
+  \r
+    - service: script.notify_volume_manager\r
+      data_template:\r
+        media_player: "{{ media_player }}"\r
+        volume_level: "{{ volume_level }}"\r
+\r
+    - service: media_player.play_media\r
+      data_template:\r
+        entity_id: >-\r
+          {# Check Null Input #}\r
+          {% if media_player | length == 0 %}\r
+            {% set media_player = 'media_player.google_home' %}\r
+          {% endif %}\r
+          {{ media_player }}\r
+        media_content_type: 'audio/mp4'\r
+        media_content_id: >-\r
+          {% if type is not defined %}\r
+            {% set type = 1 %}\r
+          {% endif %}\r
+          https://home.giorgioravera.it/local/audio/laura/{{type}}.mp3\r
index db996bfd354adad7d69daa52129bf3e53e18afd1..c6e8d3ea9326dc39e2ce337185a46c6238aeec60 100644 (file)
@@ -60,25 +60,18 @@ notify_text:
         enable_persistent: "{{ enable_persistent }}"\r
 \r
 ######################################################################\r
-# Script: Voice Notification\r
+# Script: Volume Manager\r
 # Input:\r
 # - media_player\r
 # - volume_level\r
-# - language\r
-# - message\r
 #\r
 # Operations:\r
 # - media_player.volume_set\r
-# - tts.google_say\r
 ######################################################################\r
 \r
-notify_voice:\r
-  alias: Notifiche vocali\r
+notify_volume_manager:\r
+  alias: Gestione Volume\r
   sequence:\r
-    - condition: state\r
-      entity_id: input_boolean.speech_notifications\r
-      state: 'on'\r
-  \r
     - service: media_player.volume_set\r
       data_template:\r
         entity_id: >-\r
@@ -90,7 +83,7 @@ notify_voice:
         volume_level: >-\r
           {# Default Values #}\r
           {% set defaultVolume = 0.30 %}\r
-          {% set maxDayVolume = 0.50 %}\r
+          {% set maxDayVolume = 0.60 %}\r
           {% set maxNightVolume = 0.20 %}\r
           \r
           {# Check Null Input #}\r
@@ -113,6 +106,31 @@ notify_voice:
             {% endif %}\r
           {% endif %}\r
 \r
+######################################################################\r
+# Script: Voice Notification\r
+# Input:\r
+# - media_player\r
+# - volume_level\r
+# - language\r
+# - message\r
+#\r
+# Operations:\r
+# - script.notify_volume_manager\r
+# - tts.google_say\r
+######################################################################\r
+\r
+notify_voice:\r
+  alias: Notifiche vocali\r
+  sequence:\r
+    - condition: state\r
+      entity_id: input_boolean.speech_notifications\r
+      state: 'on'\r
+  \r
+    - service: script.notify_volume_manager\r
+      data_template:\r
+        media_player: "{{ media_player }}"\r
+        volume_level: "{{ volume_level }}"\r
+\r
     - service: tts.google_say\r
       data_template:\r
         entity_id: >-\r
diff --git a/www/audio/laura/1.mp3 b/www/audio/laura/1.mp3
new file mode 100644 (file)
index 0000000..ff9d22c
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 (file)
index 0000000..f6cbd2c
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 (file)
index 0000000..b062b36
Binary files /dev/null and b/www/audio/laura/3.mp3 differ