From d4e4450e1cf65fe56280c8101fbf3d27b7b8d50b Mon Sep 17 00:00:00 2001 From: roger <133084789+parrot-tailor@users.noreply.github.com> Date: Wed, 26 Feb 2025 22:46:11 -0800 Subject: [PATCH] updates alerts_tab.yaml This commit updates `lovelace/alerts_tab.yaml` to work with the latest versions of `nws_alerts` and Home Assistant, particularly changing from `nws_alerts` to `nws_alerts_alerts`. --- lovelace/alerts_tab.yaml | 41 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lovelace/alerts_tab.yaml b/lovelace/alerts_tab.yaml index 4dbf934..f4b9f90 100644 --- a/lovelace/alerts_tab.yaml +++ b/lovelace/alerts_tab.yaml @@ -1,23 +1,22 @@ -######################################################################################### -title: "Alerts" -visible: false +# Example of using a vertical-stack of cards to display NWS alerts +# on the condition that sensor.nws_alerts_alerts is not "0" +# +type: vertical-stack panel: true cards: - - type: vertical-stack - cards: - - type: conditional - conditions: - - entity: sensor.nws_alerts - state_not: "0" - card: - type: markdown - content: | - {% set num_alerts = states('sensor.nws_alerts') | int %} - {% for alert_num in range(num_alerts) %} - --- - # NWS Alert {{ alert_num + 1 }} - - ## {{ state_attr('sensor.nws_alerts', 'Alerts')[alert_num].Event }} - - {{ state_attr('sensor.nws_alerts', 'Alerts')[alert_num].Description }} - {% endfor %} + - type: conditional + conditions: + - entity: sensor.nws_alerts_alerts + state_not: "0" + card: + type: markdown + content: > + {% set num_alerts = states('sensor.nws_alerts_alerts') | int %} + {% for alert_num in range(num_alerts) %} + # NWS Alert {{ alert_num + 1 }} + + ## {{ state_attr('sensor.nws_alerts_alerts', 'Alerts')[alert_num].Event }} + + {{ state_attr('sensor.nws_alerts_alerts', 'Alerts')[alert_num].Description }} + --- + {% endfor %}