]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Added Temperature speech and minor changes to Speech Engine
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 20 Aug 2020 14:11:27 +0000 (16:11 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 20 Aug 2020 14:11:27 +0000 (16:11 +0200)
groups/temperature.yaml [new file with mode: 0644]
scripts/speech_engine.yaml
templates/speech_message.yaml

diff --git a/groups/temperature.yaml b/groups/temperature.yaml
new file mode 100644 (file)
index 0000000..6270ac8
--- /dev/null
@@ -0,0 +1,10 @@
+######################################################################
+# Group Temperature
+######################################################################
+
+temperature:
+  name: Temperature
+  icon: mdi:home-thermometer
+  entities:
+    - sensor.front_balcony_temperature
+    - sensor.rear_balcony_temperature
index 3c55765063289ba5c5e88b809ea35200f66440d4..499ff0af1d7a81dd01b3dd3762e840367fc46c47 100644 (file)
@@ -50,6 +50,5 @@ speech_consumption:
   alias: Consumo Energetico
   sequence:
     - service: script.speech_engine
-      data_template:
-        message: >-
-          "Il consumo istantaneo è pari a {{ states.sensor.potenza_istantanea.state }} watt"
+      data:
+        enable_consumption: 1
index 46ee7b8809d435db7a06187004e3ed68d17386ab..771ffc3b42ef67c376c900cab29040719d7046f9 100644 (file)
@@ -12,6 +12,9 @@
   {% if enable_status is not defined %}\r
     {% set enable_status=0 %}\r
   {% endif %}\r
+  {% if enable_consumption is not defined %}\r
+    {% set enable_consumption=0 %}  \r
+  {% endif %}  \r
   {% if enable_location is not defined %}\r
     {% set enable_location=0 %}\r
   {% endif %}\r
@@ -55,7 +58,7 @@
   {# Door Status #}\r
   {%- macro status_door() -%}\r
     {% for entity_id in states.group.doors.attributes.entity_id  %}\r
-      {% set name = entity_id.split('.')[1]|replace('_', ' ') %}\r
+      {% set name = state_attr(entity_id, 'friendly_name') %}\r
       {% if is_state(entity_id, 'off') %}\r
         La {{ name }} è chiusa.\r
       {% else %}\r
@@ -67,7 +70,7 @@
   {# Lights Status #}\r
   {%- macro status_lights() -%}\r
     {% for entity_id in states.group.lights.attributes.entity_id  %}\r
-      {% set name = entity_id.split('.')[1]|replace('_', ' ') %}\r
+      {% set name = state_attr(entity_id, 'friendly_name') %}\r
       {% if is_state(entity_id, 'off') %}\r
         La {{ name }} è spenta.\r
       {% else %}\r
@@ -79,7 +82,7 @@
   {# Covers Status #}\r
   {%- macro status_covers() -%}\r
     {% for entity_id in states.group.covers.attributes.entity_id %}\r
-      {% set name = entity_id.split('.')[1]|replace('_', ' ') %}\r
+      {% set name = state_attr(entity_id, 'friendly_name') %}\r
       {% set perc = state_attr(entity_id, 'current_position') %}\r
       {% if perc | int < 25 %}\r
         La {{ name }} è chiusa.\r
     {%- endfor %}\r
   {%- endmacro -%}\r
   \r
+  {# Temperature Status #}\r
+  {%- macro status_temperature() -%}\r
+    {% for entity_id in states.group.temperature.attributes.entity_id %}\r
+      {% set name = state_attr(entity_id, 'friendly_name') %}\r
+      {% set temp = states(entity_id) %}\r
+      La {{ name }} è {{ temp }} gradi.\r
+    {%- endfor %}\r
+  {%- endmacro -%}\r
+  \r
   {# Consumption Status #}\r
   {%- macro status_consumption() -%}\r
   "Il consumo istantaneo è pari a {{ states.sensor.potenza_istantanea.state }} watt"\r
     {% for entity_id in states.group.people.attributes.entity_id %}\r
       {% set name = state_attr(entity_id, 'friendly_name') %}\r
       {% if is_state(entity_id, 'not_home') %}\r
-        {% set position = state_attr(entity_id, 'address') %}\r
+        {% set source = state_attr(entity_id, 'source') %}\r
+        {% set position = state_attr(source, 'address')|replace('Province of', 'Provincia di') %}\r
       {% else %}\r
         {% set position = states(entity_id) %}\r
       {% endif %}\r
   \r
   {# Home Status #}\r
   {% if enable_status | int == 1 %}\r
-      \r
+    \r
     {{ time_and_date() }}\r
     \r
     {{ status_door() }}\r
     \r
     {{ status_lights() }}\r
-      \r
+    \r
     {{ status_covers() }}\r
     \r
-    {{ status_consumption() }}\r
-                    \r
+    {{ status_temperature() }}\r
+    \r
   {% endif %}\r
+\r
+  {% if (enable_status | int == 1) or (enable_consumption | int == 1) %}\r
+    {{ status_consumption() }}\r
+  {% endif %}    \r
   \r
   {# Location Status #}\r
   {% if (enable_status | int == 1) or (enable_location | int == 1) %}\r
   {% endif %}\r
   \r
   {# Car Status #}          \r
-  {% if (enable_status | int == 1) or (enable_car | int == 1) %}              \r
+  {% if (enable_status | int == 1) or (enable_car | int == 1) %}\r
     {{ status_car() }}\r
   {% endif %}\r
   \r