Skip to content

Commit

Permalink
Create alerts_tab
Browse files Browse the repository at this point in the history
  • Loading branch information
finity69x2 authored Jan 29, 2022
1 parent a7932c2 commit 22f828c
Showing 1 changed file with 151 additions and 0 deletions.
151 changes: 151 additions & 0 deletions lovelace/alerts_tab
Original file line number Diff line number Diff line change
@@ -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

1 comment on commit 22f828c

@gdg316
Copy link

@gdg316 gdg316 commented on 22f828c Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried adding this - says does not exist - went to add as a Manual card

Please sign in to comment.