From 22f828c522e6eca639411afc61e1f23c59168a73 Mon Sep 17 00:00:00 2001 From: finity69x2 <32221243+finity69x2@users.noreply.github.com> Date: Sat, 29 Jan 2022 00:39:23 -0500 Subject: [PATCH] Create alerts_tab --- lovelace/alerts_tab | 151 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 lovelace/alerts_tab diff --git a/lovelace/alerts_tab b/lovelace/alerts_tab new file mode 100644 index 0000000..1321ade --- /dev/null +++ b/lovelace/alerts_tab @@ -0,0 +1,151 @@ +######################################################################################### +title: "Alerts" + +type: custom:vertical-layout +layout: + max_cols: 4 +cards: + - type: custom:stack-in-card + cards: + - type: entities + title: Severe Weather Alerts + show_header_toggle: false + entities: sensor.nws_alerts + - type: conditional + conditions: + - entity: sensor.nws_alerts + state_not: '0' + card: + type: markdown + content: > + --- + + # NWS First Active Alert + {% if state_attr('sensor.nws_alerts', 'title') != None and state_attr('sensor.nws_alerts', 'title').split(' - ')[0] is defined %} + + ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[0] }} + + {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[0] }} + + {% else %} + none + {% endif %} + - type: conditional + conditions: + - entity: sensor.nws_alerts + state_not: "0" + - entity: sensor.nws_alerts + state_not: "1" + card: + type: markdown + content: > + --- + + # NWS Second Active Alert + {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[1] is defined %} + + ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[1] }} + + {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[1] }} + + {% else %} + none + {% endif %} + - type: conditional + conditions: + - entity: sensor.nws_alerts + state_not: "0" + - entity: sensor.nws_alerts + state_not: "1" + - entity: sensor.nws_alerts + state_not: "2" + card: + type: markdown + content: > + --- + + # NWS Third Active Alert + {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[2] is defined %} + + ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[2] }} + + {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[2] }} + + {% else %} + none + {% endif %} + - type: conditional + conditions: + - entity: sensor.nws_alerts + state_not: "0" + - entity: sensor.nws_alerts + state_not: "1" + - entity: sensor.nws_alerts + state_not: "2" + - entity: sensor.nws_alerts + state_not: "3" + card: + type: markdown + content: > + --- + + # NWS Fourth Active Alert + {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[3] is defined %} + + ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[3] }} + + {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[3] }} + + {% else %} + none + {% endif %} + - type: conditional + conditions: + - entity: sensor.nws_alerts + state_not: "0" + - entity: sensor.nws_alerts + state_not: "1" + - entity: sensor.nws_alerts + state_not: "2" + - entity: sensor.nws_alerts + state_not: "3" + - entity: sensor.nws_alerts + state_not: "4" + card: + type: markdown + content: > + --- + + # NWS Fifth Active Alert + {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[4] is defined %} + + ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[4] }} + + {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[4] }} + + {% else %} + none + {% endif %} + + - type: entities + title: NWS Alerts History + show_header_toggle: false + state_color: true + entities: + - variable.nws_alerts_event_ids + - type: custom:entity-attributes-card + heading_name: Name + heading_state: State + entity: variable.nws_alerts_event_ids + filter: + include: + - variable.nws_alerts_event_ids.history_1 + - variable.nws_alerts_event_ids.history_2 + - variable.nws_alerts_event_ids.history_3 + - variable.nws_alerts_event_ids.history_4 + - variable.nws_alerts_event_ids.history_5 + - variable.nws_alerts_event_ids.history_6 + - variable.nws_alerts_event_ids.history_7 + - variable.nws_alerts_event_ids.history_8 + - variable.nws_alerts_event_ids.history_9 + - variable.nws_alerts_event_ids.history_10