]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Created template folders and minor changes
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Fri, 8 Sep 2023 08:18:06 +0000 (10:18 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Fri, 8 Sep 2023 08:18:06 +0000 (10:18 +0200)
automations/speech.yaml
configuration.yaml
scripts/speech_engine.yaml
template_messages/speech.yaml [new file with mode: 0644]
template_messages/welcome.yaml [new file with mode: 0644]
templates/speech_message.yaml [deleted file]
templates/welcome_message.yaml [deleted file]

index c8cb268680ba13066028f6c672d7b30b2046eae1..0a1ab631cec73a9aa4a117619f2cfd8422fc6acb 100644 (file)
@@ -32,7 +32,7 @@
 
     - service: script.speech_engine
       data_template:
-        message: !include ../templates/welcome_message.yaml
+        message: !include ../template_messages/welcome.yaml
         enable_greeting: 0
 
 ######################################################################
index d7236ae47705d213c861a5ba5226082e46a616bf..1f3f9f12a5a48003158197e118f3239e904f78d7 100644 (file)
@@ -49,18 +49,12 @@ http:
 automation: !include automations.yaml
 automation manual: !include_dir_merge_list automations/
 
-# Assist pipeline
-# assist_pipeline:
-
 # Backup
 backup:
 
 # Enables configuration UI
 config:
 
-# Conversation
-conversation:
-
 # Counter
 counter: !include_dir_merge_named counters/
 
@@ -71,6 +65,9 @@ energy:
 frontend:
   themes: !include_dir_merge_named themes
 
+# Hardware
+# hardware:
+
 # Home Assistant Alerts
 homeassistant_alerts:
 
@@ -80,9 +77,6 @@ homeassistant_alerts:
 # Image upload
 image_upload:
 
-# Hardware
-# hardware:
-
 # Inputs
 input_boolean: !include_dir_merge_named input_boolean/
 input_button: !include_dir_merge_named input_button/
@@ -110,14 +104,14 @@ person:
 schedule:
 
 # Scene
-#scene: !include_dir_merge_list scenes.yaml
+# scene: !include_dir_merge_list scenes.yaml
 
 # Scripts
 script: !include scripts.yaml
 script manual: !include_dir_merge_named scripts/
 
 # Stream
-#stream:
+# stream:
 
 # Track the sun
 sun:
@@ -163,6 +157,9 @@ recorder: !include log/recorder.yaml
 # Discover DHCP requests for supported devices and services.
 dhcp:
 
+# Auto detection is based on the system routing next hop for the mDNS broadcast address
+network:
+
 # Simple Service Discovery Protocol (SSDP)
 ssdp:
 
@@ -172,6 +169,16 @@ ssdp:
 # Zero-configuration networking (zeroconf)
 zeroconf:
 
+######################################################################
+# Voice Interface
+######################################################################
+
+# Assist pipeline
+# assist_pipeline:
+
+# Allows you to issue voice commands from the frontend in enabled browsers
+# conversation:
+
 ######################################################################
 # Additional Components
 ######################################################################
@@ -182,9 +189,6 @@ binary_sensor: !include_dir_merge_list binary_sensor/
 # Covers
 cover: !include_dir_merge_list cover/
 
-# Allows you to issue voice commands from the frontend in enabled browsers
-#conversation:
-
 # Device Tracker
 device_tracker: !include_dir_merge_list device_tracker/
 
@@ -212,6 +216,9 @@ utility_meter: !include_dir_merge_named utility_meter/
 # Text to speech
 tts: !include components/tts.yaml
 
+# Templates
+template: !include_dir_merge_list template/
+
 # Wake on Lan
 wake_on_lan:
 
index f94b586385543602daae8a0ed9d926d15d885f99..f98939280159b60138120e36cf8e65f2c6c28f9a 100644 (file)
@@ -100,7 +100,7 @@ speech_engine:
       data_template:
         media_player: "{{ media_player }}"
         volume_level: "{{ volume_level }}"
-        message: !include ../templates/speech_message.yaml
+        message: !include ../template_messages/speech.yaml
 
 ######################################################################
 # Script: Speech Status
diff --git a/template_messages/speech.yaml b/template_messages/speech.yaml
new file mode 100644 (file)
index 0000000..6b4c67b
--- /dev/null
@@ -0,0 +1,221 @@
+######################################################################
+# Speech Engine Message
+######################################################################
+
+>-
+  {# *********************************************** #}
+  {# ***************** Check Input ***************** #}
+  {# *********************************************** #}
+  {% if enable_greeting is not defined %}
+    {% set enable_greeting=false %}
+  {% endif %}
+  {% if enable_status is not defined %}
+    {% set enable_status=false %}
+  {% endif %}
+  {% if enable_consumption is not defined %}
+    {% set enable_consumption=false %}
+  {% endif %}
+  {% if enable_location is not defined %}
+    {% set enable_location=false %}
+  {% endif %}
+  {% if location_people_start is not defined %}
+    {% set location_people_start=1 %}
+  {% endif %}
+  {% if location_people_num is not defined %}
+    {% set location_people_num=2 %}
+  {% endif %}
+  {% if enable_car is not defined %}
+    {% set enable_car=false %}
+  {% endif %}
+
+  {# *********************************************** #}
+  {# ******************** Macro ******************** #}
+  {# *********************************************** #}
+
+  {# Greeting Message #}
+  {%- macro greeting() -%}
+    {% if now().strftime('%H')|int >= 7 and now().strftime('%H')|int < 12 %}
+      Buongiorno.
+    {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
+      Buonpomeriggio.
+    {% elif now().strftime('%H')|int >= 17 and now().strftime('%H')|int < 23 %}
+      Buonasera.
+    {% else %}
+      Buonanotte.
+    {% endif %}
+  {%- endmacro -%}
+
+  {# Time & Date #}
+  {%- macro time_and_date() -%}
+    {% set hour = now().strftime('%H') %}
+    {% set min = now().strftime('%M') %}
+    {% set day = now().strftime('%d') %}
+    {% set mounth = now().strftime('%B')|replace('January', 'Gennaio')
+                                        |replace('February', 'Febbraio')
+                                        |replace('March', 'Marzo')
+                                        |replace('April', 'Aprile')
+                                        |replace('May', 'Maggio')
+                                        |replace('June', 'Giugno')
+                                        |replace('July', 'Luglio')
+                                        |replace('August', 'Agosto')
+                                        |replace('September', 'Settembre')
+                                        |replace('October', 'Ottobre')
+                                        |replace('November', 'Novembre')
+                                        |replace('December', 'Dicembre') %}
+    {% set year = now().strftime('%Y') %}
+    Sono le {{ hour }} e {{ min }} del {{ day }} {{ mounth }} {{ year }}
+  {%- endmacro -%}
+
+  {# Door Status #}
+  {%- macro status_door() -%}
+    {% for entity_id in states.group.doors.attributes.entity_id  %}
+      {% set name = state_attr(entity_id, 'friendly_name') %}
+      {% if is_state(entity_id, 'off') %}
+        La {{ name }} è chiusa.
+      {% else %}
+        La {{ name }} è aperta.
+      {% endif %}
+    {%- endfor %}
+  {%- endmacro -%}
+
+  {# Lights Status #}
+  {%- macro status_lights() -%}
+    {% for entity_id in states.group.lights.attributes.entity_id  %}
+      {% set name = state_attr(entity_id, 'friendly_name') %}
+      {% if is_state(entity_id, 'off') %}
+        La {{ name }} è spenta.
+      {% else %}
+        La {{ name }} è accesa.
+      {% endif %}
+    {%- endfor %}
+  {%- endmacro -%}
+
+  {# Covers Status #}
+  {%- macro status_covers() -%}
+    {% for entity_id in states.group.covers.attributes.entity_id %}
+      {% set name = state_attr(entity_id, 'friendly_name') %}
+      {% set perc = state_attr(entity_id, 'current_position') %}
+      {% if perc | int < 25 %}
+        La {{ name }} è chiusa.
+      {% else %}
+        La {{ name }} è aperta al {{ perc }} percento.
+      {% endif %}
+    {%- endfor %}
+  {%- endmacro -%}
+
+  {# Temperature Status #}
+  {%- macro status_temperature() -%}
+    {% for entity_id in states.group.temperature.attributes.entity_id %}
+      {% set name = state_attr(entity_id, 'friendly_name') %}
+      {% set temp = states(entity_id) %}
+      La {{ name }} è {{ temp }} gradi.
+    {%- endfor %}
+  {%- endmacro -%}
+
+  {# Consumption Status #}
+  {%- macro status_consumption() -%}
+  "Il consumo istantaneo è pari a {{ states.sensor.shelly_em_channel_1_power.state }} watt"
+  {%- endmacro -%}
+
+  {# Location Status #}
+  {%- macro status_location(start, num) -%}
+    {% for entity_id in states.group.people.attributes.entity_id %}
+      {% set name = state_attr(entity_id, 'friendly_name') %}
+      {% if is_state(entity_id, 'not_home') %}
+        {% set source = state_attr(entity_id, 'source') %}
+        {% set position = state_attr(source, 'address')|replace('Province of', 'Provincia di') %}
+      {% elif is_state(entity_id, 'home') %}
+        {% set position = "casa" %}
+      {% else %}
+        {% set position = states(entity_id) %}
+      {% endif %}
+
+      {% if (loop.index >= start|int) and (loop.index < num|int+start|int) %}
+        La posizione di {{ name }} è {{ position }}.
+      {% endif %}
+    {%- endfor %}
+  {%- endmacro -%}
+
+  {# Car Status #}
+  {%- macro status_car() -%}
+    {% if is_state('device_tracker.ff590mr_device_tracker', 'home') %}
+      {% set car_position = "in garage" %}
+    {% else %}
+      {% set car_position = "fuori" %}
+    {% endif %}
+    {% if is_state('binary_sensor.ff590mr_locked', 'off') %}
+      {% set car_lock = "chiusa" %}
+    {% else %}
+      {% set car_lock = "aperta" %}
+    {% endif %}
+    {% if is_state('binary_sensor.ff590mr_windows_closed_2', 'off') %}
+      {% set car_windows = "chiusi" %}
+    {% else %}
+      {% set car_windows = "aperti" %}
+    {% endif %}
+    La Mercedes si trova {{ car_position }}. è {{ car_lock }} con i finestrini {{ car_windows }}.
+    Il livello del carburante è {{ states('sensor.ff590mr_fuel_level') }} percento.
+    {% if is_state('binary_sensor.ff590mr_low_brake_fluid_warning', 'on') or
+          is_state('binary_sensor.ff590mr_low_coolant_level_warning', 'on') or
+          is_state('binary_sensor.ff590mr_low_wash_water_warning', 'on') or
+          is_state('binary_sensor.ff590mr_tire_warning', 'on') %}
+      Sono inoltre presenti allarmi.
+    {% endif %}
+  {%- endmacro -%}
+
+  {# End Message #}
+  {%- macro end_message() -%}
+    {% if enable_status == true %}
+      {{ [
+      "Spero che il report ti abbia soddisfatto!",
+      "Il report è concluso.",
+      "Alla prossima!",
+      "Buon proseguimento!",
+      "Non ho altro da comunicare."
+      ] | random }}
+    {% endif %}
+  {%- endmacro -%}
+
+  {# *********************************************** #}
+  {# ******************* Message ******************* #}
+  {# *********************************************** #}
+
+  {# Greeting Message #}
+  {% if enable_greeting == true %}
+    {{ greeting() }}
+  {% endif %}
+
+  {# Home Status #}
+  {% if enable_status == true %}
+
+    {{ time_and_date() }}
+
+    {{ status_door() }}
+
+    {{ status_lights() }}
+
+    {{ status_covers() }}
+
+    {{ status_temperature() }}
+
+  {% endif %}
+
+  {% if (enable_status == true) or (enable_consumption == true) %}
+    {{ status_consumption() }}
+  {% endif %}
+
+  {# Location Status #}
+  {% if (enable_status == true) or (enable_location == true) %}
+    {{ status_location(location_people_start, location_people_num) }}
+  {% endif %}
+
+  {# Car Status #}
+  {% if (enable_status == true) or (enable_car == true) %}
+    {{ status_car() }}
+  {% endif %}
+
+  {# generic message #}
+  {{ message }}
+
+  {# end message #}
+  {{ end_message() }}
diff --git a/template_messages/welcome.yaml b/template_messages/welcome.yaml
new file mode 100644 (file)
index 0000000..447e5c3
--- /dev/null
@@ -0,0 +1,26 @@
+######################################################################
+# Speech Engine Message
+######################################################################
+
+>-
+  {% set name = state_attr(trigger.entity_id, 'friendly_name') %}
+  {%- macro greeting_sentence(name) -%}
+  {{ [
+  "Ciao " ~ name + " è un piacere rivederti a casa",
+  "Finalmente a casa " ~ name + "!",
+  "Indovina chi è a casa? " ~ name + "!",
+  name + " è ora a casa!",
+  "Che bello! " ~ name + " è a casa",
+  name + " sei a casa!",
+  "Il sistema di domotica Casa Ravera-Testa notifica che " ~ name + " è a casa!",
+  "Annuncio: " ~ name + " è ora a casa!",
+  "Rilevo una presenza! " ~ name + " è a casa!",
+  "Ciao " ~ name + " che la forza sia con te",
+  "Sento un tremito nella forza! " ~ name + " è a casa",
+  "Sento un interferenza nella Forza! " ~ name + " è qui",
+  "Menomale che sei qui " ~ name + "! Mi sentivo solo",
+  "Menomale che sei qui " ~ name + "! La casa è vuota senza di te!",
+  "Ciao " ~ name + "! Casa è sempre la casa!"
+  ] | random }}
+  {%- endmacro -%}
+  {{ greeting_sentence(name) }}
diff --git a/templates/speech_message.yaml b/templates/speech_message.yaml
deleted file mode 100644 (file)
index 6b4c67b..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-######################################################################
-# Speech Engine Message
-######################################################################
-
->-
-  {# *********************************************** #}
-  {# ***************** Check Input ***************** #}
-  {# *********************************************** #}
-  {% if enable_greeting is not defined %}
-    {% set enable_greeting=false %}
-  {% endif %}
-  {% if enable_status is not defined %}
-    {% set enable_status=false %}
-  {% endif %}
-  {% if enable_consumption is not defined %}
-    {% set enable_consumption=false %}
-  {% endif %}
-  {% if enable_location is not defined %}
-    {% set enable_location=false %}
-  {% endif %}
-  {% if location_people_start is not defined %}
-    {% set location_people_start=1 %}
-  {% endif %}
-  {% if location_people_num is not defined %}
-    {% set location_people_num=2 %}
-  {% endif %}
-  {% if enable_car is not defined %}
-    {% set enable_car=false %}
-  {% endif %}
-
-  {# *********************************************** #}
-  {# ******************** Macro ******************** #}
-  {# *********************************************** #}
-
-  {# Greeting Message #}
-  {%- macro greeting() -%}
-    {% if now().strftime('%H')|int >= 7 and now().strftime('%H')|int < 12 %}
-      Buongiorno.
-    {% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
-      Buonpomeriggio.
-    {% elif now().strftime('%H')|int >= 17 and now().strftime('%H')|int < 23 %}
-      Buonasera.
-    {% else %}
-      Buonanotte.
-    {% endif %}
-  {%- endmacro -%}
-
-  {# Time & Date #}
-  {%- macro time_and_date() -%}
-    {% set hour = now().strftime('%H') %}
-    {% set min = now().strftime('%M') %}
-    {% set day = now().strftime('%d') %}
-    {% set mounth = now().strftime('%B')|replace('January', 'Gennaio')
-                                        |replace('February', 'Febbraio')
-                                        |replace('March', 'Marzo')
-                                        |replace('April', 'Aprile')
-                                        |replace('May', 'Maggio')
-                                        |replace('June', 'Giugno')
-                                        |replace('July', 'Luglio')
-                                        |replace('August', 'Agosto')
-                                        |replace('September', 'Settembre')
-                                        |replace('October', 'Ottobre')
-                                        |replace('November', 'Novembre')
-                                        |replace('December', 'Dicembre') %}
-    {% set year = now().strftime('%Y') %}
-    Sono le {{ hour }} e {{ min }} del {{ day }} {{ mounth }} {{ year }}
-  {%- endmacro -%}
-
-  {# Door Status #}
-  {%- macro status_door() -%}
-    {% for entity_id in states.group.doors.attributes.entity_id  %}
-      {% set name = state_attr(entity_id, 'friendly_name') %}
-      {% if is_state(entity_id, 'off') %}
-        La {{ name }} è chiusa.
-      {% else %}
-        La {{ name }} è aperta.
-      {% endif %}
-    {%- endfor %}
-  {%- endmacro -%}
-
-  {# Lights Status #}
-  {%- macro status_lights() -%}
-    {% for entity_id in states.group.lights.attributes.entity_id  %}
-      {% set name = state_attr(entity_id, 'friendly_name') %}
-      {% if is_state(entity_id, 'off') %}
-        La {{ name }} è spenta.
-      {% else %}
-        La {{ name }} è accesa.
-      {% endif %}
-    {%- endfor %}
-  {%- endmacro -%}
-
-  {# Covers Status #}
-  {%- macro status_covers() -%}
-    {% for entity_id in states.group.covers.attributes.entity_id %}
-      {% set name = state_attr(entity_id, 'friendly_name') %}
-      {% set perc = state_attr(entity_id, 'current_position') %}
-      {% if perc | int < 25 %}
-        La {{ name }} è chiusa.
-      {% else %}
-        La {{ name }} è aperta al {{ perc }} percento.
-      {% endif %}
-    {%- endfor %}
-  {%- endmacro -%}
-
-  {# Temperature Status #}
-  {%- macro status_temperature() -%}
-    {% for entity_id in states.group.temperature.attributes.entity_id %}
-      {% set name = state_attr(entity_id, 'friendly_name') %}
-      {% set temp = states(entity_id) %}
-      La {{ name }} è {{ temp }} gradi.
-    {%- endfor %}
-  {%- endmacro -%}
-
-  {# Consumption Status #}
-  {%- macro status_consumption() -%}
-  "Il consumo istantaneo è pari a {{ states.sensor.shelly_em_channel_1_power.state }} watt"
-  {%- endmacro -%}
-
-  {# Location Status #}
-  {%- macro status_location(start, num) -%}
-    {% for entity_id in states.group.people.attributes.entity_id %}
-      {% set name = state_attr(entity_id, 'friendly_name') %}
-      {% if is_state(entity_id, 'not_home') %}
-        {% set source = state_attr(entity_id, 'source') %}
-        {% set position = state_attr(source, 'address')|replace('Province of', 'Provincia di') %}
-      {% elif is_state(entity_id, 'home') %}
-        {% set position = "casa" %}
-      {% else %}
-        {% set position = states(entity_id) %}
-      {% endif %}
-
-      {% if (loop.index >= start|int) and (loop.index < num|int+start|int) %}
-        La posizione di {{ name }} è {{ position }}.
-      {% endif %}
-    {%- endfor %}
-  {%- endmacro -%}
-
-  {# Car Status #}
-  {%- macro status_car() -%}
-    {% if is_state('device_tracker.ff590mr_device_tracker', 'home') %}
-      {% set car_position = "in garage" %}
-    {% else %}
-      {% set car_position = "fuori" %}
-    {% endif %}
-    {% if is_state('binary_sensor.ff590mr_locked', 'off') %}
-      {% set car_lock = "chiusa" %}
-    {% else %}
-      {% set car_lock = "aperta" %}
-    {% endif %}
-    {% if is_state('binary_sensor.ff590mr_windows_closed_2', 'off') %}
-      {% set car_windows = "chiusi" %}
-    {% else %}
-      {% set car_windows = "aperti" %}
-    {% endif %}
-    La Mercedes si trova {{ car_position }}. è {{ car_lock }} con i finestrini {{ car_windows }}.
-    Il livello del carburante è {{ states('sensor.ff590mr_fuel_level') }} percento.
-    {% if is_state('binary_sensor.ff590mr_low_brake_fluid_warning', 'on') or
-          is_state('binary_sensor.ff590mr_low_coolant_level_warning', 'on') or
-          is_state('binary_sensor.ff590mr_low_wash_water_warning', 'on') or
-          is_state('binary_sensor.ff590mr_tire_warning', 'on') %}
-      Sono inoltre presenti allarmi.
-    {% endif %}
-  {%- endmacro -%}
-
-  {# End Message #}
-  {%- macro end_message() -%}
-    {% if enable_status == true %}
-      {{ [
-      "Spero che il report ti abbia soddisfatto!",
-      "Il report è concluso.",
-      "Alla prossima!",
-      "Buon proseguimento!",
-      "Non ho altro da comunicare."
-      ] | random }}
-    {% endif %}
-  {%- endmacro -%}
-
-  {# *********************************************** #}
-  {# ******************* Message ******************* #}
-  {# *********************************************** #}
-
-  {# Greeting Message #}
-  {% if enable_greeting == true %}
-    {{ greeting() }}
-  {% endif %}
-
-  {# Home Status #}
-  {% if enable_status == true %}
-
-    {{ time_and_date() }}
-
-    {{ status_door() }}
-
-    {{ status_lights() }}
-
-    {{ status_covers() }}
-
-    {{ status_temperature() }}
-
-  {% endif %}
-
-  {% if (enable_status == true) or (enable_consumption == true) %}
-    {{ status_consumption() }}
-  {% endif %}
-
-  {# Location Status #}
-  {% if (enable_status == true) or (enable_location == true) %}
-    {{ status_location(location_people_start, location_people_num) }}
-  {% endif %}
-
-  {# Car Status #}
-  {% if (enable_status == true) or (enable_car == true) %}
-    {{ status_car() }}
-  {% endif %}
-
-  {# generic message #}
-  {{ message }}
-
-  {# end message #}
-  {{ end_message() }}
diff --git a/templates/welcome_message.yaml b/templates/welcome_message.yaml
deleted file mode 100644 (file)
index 447e5c3..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-######################################################################
-# Speech Engine Message
-######################################################################
-
->-
-  {% set name = state_attr(trigger.entity_id, 'friendly_name') %}
-  {%- macro greeting_sentence(name) -%}
-  {{ [
-  "Ciao " ~ name + " è un piacere rivederti a casa",
-  "Finalmente a casa " ~ name + "!",
-  "Indovina chi è a casa? " ~ name + "!",
-  name + " è ora a casa!",
-  "Che bello! " ~ name + " è a casa",
-  name + " sei a casa!",
-  "Il sistema di domotica Casa Ravera-Testa notifica che " ~ name + " è a casa!",
-  "Annuncio: " ~ name + " è ora a casa!",
-  "Rilevo una presenza! " ~ name + " è a casa!",
-  "Ciao " ~ name + " che la forza sia con te",
-  "Sento un tremito nella forza! " ~ name + " è a casa",
-  "Sento un interferenza nella Forza! " ~ name + " è qui",
-  "Menomale che sei qui " ~ name + "! Mi sentivo solo",
-  "Menomale che sei qui " ~ name + "! La casa è vuota senza di te!",
-  "Ciao " ~ name + "! Casa è sempre la casa!"
-  ] | random }}
-  {%- endmacro -%}
-  {{ greeting_sentence(name) }}