From: Giorgio Ravera Date: Mon, 10 Feb 2020 20:16:16 +0000 (+0100) Subject: Fixed Alarm Level 2 X-Git-Url: http://git.giorgioravera.it/?a=commitdiff_plain;h=4b7679a1fbb22abc74abad09a48d27a0ca408e89;p=homeassistant.git Fixed Alarm Level 2 --- diff --git a/automation/alarms.yaml b/automation/alarms.yaml index fe3b623d..a682b90e 100644 --- a/automation/alarms.yaml +++ b/automation/alarms.yaml @@ -2,6 +2,7 @@ # Alarm: Aknowledge Alarms # # Actions: +# - persistent_notification.dismiss # - script.stop_alarm ###################################################################### - alias: "Alarms: Riconoscimento Allarmi" diff --git a/script/alarms.yaml b/script/alarms.yaml index 800b2dfc..990a6735 100644 --- a/script/alarms.yaml +++ b/script/alarms.yaml @@ -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" diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml index d9477142..4701e859 100644 --- a/ui-lovelace.yaml +++ b/ui-lovelace.yaml @@ -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 ######################################################################