]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Added Babu Frik voice
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Sat, 1 Feb 2020 16:21:38 +0000 (17:21 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Sat, 1 Feb 2020 16:21:38 +0000 (17:21 +0100)
script/audio.yaml
ui-lovelace.yaml
www/audio/babu/1.mp3 [new file with mode: 0644]
www/audio/babu/2.mp3 [new file with mode: 0644]

index 8efbfd1458c41dc474206ad05fdc0b50b3fe3b27..9dccc966f31688f29da520fd24c10026ac4068f8 100644 (file)
@@ -63,3 +63,61 @@ laura_voice_3:
   - service: script.laura_voice
     data:
       type: '3'
+
+######################################################################
+# Script: Babu Frik
+# Inputs: 
+# - type:
+#         1 -> I'm babu frik
+#         2 -> heheeee
+#
+# Operations:
+# - script.volume_manager
+# - media_player.play_media
+######################################################################
+
+babu_voice:
+  alias: Voce Babu
+  sequence:
+    - condition: state
+      entity_id: input_boolean.speech_notifications
+      state: 'on'
+  
+    - service: script.volume_manager
+      data_template:
+        media_player: >-
+          {# Check Null Input #}
+          {% if media_player | length == 0 %}
+            {% set media_player = 'media_player.google_home' %}
+          {% endif %}
+          {{ 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/babu/{{type}}.mp3
+
+babu_voice_1:
+  alias: Voce Babu 1
+  sequence:
+  - service: script.babu_voice
+    data:
+      type: '1'
+
+babu_voice_2:
+  alias: Voce Babu 2
+  sequence:
+  - service: script.babu_voice
+    data:
+      type: '2'
index a72aa0943aad9fd8f84795953a3f99988fbdef69..d9477142051cb711583bbf99058f687056a4e864 100644 (file)
@@ -1114,6 +1114,27 @@ views:
               service: script.turn_on
               service_data:
                 entity_id: script.laura_voice_3
+                
+        - type: horizontal-stack
+          cards:
+          - type: entity-button
+            name: I'm Babu
+            icon: mdi:numeric-1
+            entity: script.babu_voice
+            tap_action:
+              action: call-service
+              service: script.turn_on
+              service_data:
+                entity_id: script.babu_voice_1
+          - type: entity-button
+            name: Heheeeee
+            icon: mdi:numeric-2
+            entity: script.babu_voice
+            tap_action:
+              action: call-service
+              service: script.turn_on
+              service_data:
+                entity_id: script.babu_voice_2
 
 ######################################################################
 # People
diff --git a/www/audio/babu/1.mp3 b/www/audio/babu/1.mp3
new file mode 100644 (file)
index 0000000..38966cc
Binary files /dev/null and b/www/audio/babu/1.mp3 differ
diff --git a/www/audio/babu/2.mp3 b/www/audio/babu/2.mp3
new file mode 100644 (file)
index 0000000..a763fb5
Binary files /dev/null and b/www/audio/babu/2.mp3 differ