]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Fixed Alarm Level 2
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Mon, 10 Feb 2020 20:16:16 +0000 (21:16 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Mon, 10 Feb 2020 20:16:16 +0000 (21:16 +0100)
automation/alarms.yaml
script/alarms.yaml
ui-lovelace.yaml

index fe3b623da52617077624a97d512e3e3f9ffb0f22..a682b90ed0946fe900fd44309eb0b3de75ded51f 100644 (file)
@@ -2,6 +2,7 @@
 # Alarm: Aknowledge Alarms\r
 #\r
 # Actions:\r
+# - persistent_notification.dismiss\r
 # - script.stop_alarm\r
 ######################################################################\r
 - alias: "Alarms: Riconoscimento Allarmi"\r
index 800b2dfc820580d7012f39db15397f972e2738eb..990a67354f1ef201742514b46d3212f7ff520f4e 100644 (file)
@@ -52,6 +52,19 @@ stop_alarm_sound:
 start_alarm_level_1:
   alias: "Allarmi: Attiva Allarme 1"
   sequence:
+  
+    - condition: template
+      value_template: >-
+        {# Check Null Input #}
+        {% if level | length == 0 %}
+          {% set level = 1 %}
+        {% endif %}
+        {% if level | int >= 1 %}
+          true
+        {% else %}
+          false
+        {% endif %}
+
     - service: script.notify_all
       data_template:
         volume_level: 0.4
@@ -70,8 +83,33 @@ start_alarm_level_1:
           {{ message }}
         enable_persistent: 1
         notification_id: "alarm"
-#    - service: input_boolean.turn_on
-#      entity_id: input_boolean.{{ alarm_type }}
+        
+######################################################################
+# Alarm: Start Alarm Level 2
+# Inputs:
+# - level
+#
+# Operations:
+# - start_alarm_sound
+######################################################################
+
+start_alarm_level_2:
+  alias: "Allarmi: Attiva Allarme 2"
+  sequence:
+
+    - condition: template
+      value_template: >-
+        {# Check Null Input #}
+        {% if level | length == 0 %}
+          {% set level = 1 %}
+        {% endif %}
+        {% if level | int >= 2 %}
+          true
+        {% else %}
+          false
+        {% endif %}
+  
+    - service: script.start_alarm_sound
 
 ######################################################################
 # Alarm: Start Alarm
@@ -96,17 +134,27 @@ start_alarm:
       data_template:
         title: "{{ title }}"
         message:  "{{ message }}"
+        level: "{{ level }}"
+
+    - service: script.start_alarm_level_2
+      data_template:
+        title: "{{ title }}"
+        message:  "{{ message }}"
+        level: "{{ level }}"
 
 ######################################################################
 # Alarm: Stop Alarm
 #
 # Operations:
+# - stop_alarm_sound
 # - persistent_notification.dismiss
 ######################################################################
 
 stop_alarm:
   alias: "Allarmi: Disattiva Allarme"
   sequence:
+    - service: script.stop_alarm_sound
+
     - service: persistent_notification.dismiss
       data_template:
         notification_id: "alarm"
index d9477142051cb711583bbf99058f687056a4e864..4701e8596c2fd205a47cfe0b9881896a8fd4fe8b 100644 (file)
@@ -26,6 +26,7 @@ views:
       - binary_sensor.guard_mode
       - binary_sensor.speech_notifications
       - binary_sensor.text_notifications
+      - binary_sensor.alarms
       - sensor.potenza_istantanea
     cards:
     - type: picture-glance
@@ -1373,6 +1374,21 @@ views:
             --zigbee2mqtt-networkmap-node-router-color: rgba(0, 165, 255, .7);
           }
 
+######################################################################
+# Alarms
+######################################################################
+  - title: Allarmi
+    id: allarmi
+    icon: mdi:alarm-light-outline
+    badges:
+      - binary_sensor.alarms
+    cards:
+    - type: entities
+      title: Allarmi Casa
+      show_header_toggle: false
+      entities:
+      - input_boolean.alarms
+      
 ######################################################################
 # Weather
 ######################################################################