forked from briis/weatherbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweather_alert_markdown.yaml
29 lines (23 loc) · 1.01 KB
/
weather_alert_markdown.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- type: markdown
style: 'ha-card { --iron-icon-width: 50px; --iron-icon-height: 50px; }'
content: >-
{% if states.sensor.weatherbit_weather_alerts.state | int > 0 %}
{% for item in state_attr('sensor.weatherbit_weather_alerts','alerts') %}
{% for type, icon in [('Advisory', 'shield-alert'), ('Watch', 'alert-circle'),
('Warning', 'alert')] if type == item['severity']|trim("[]'") %}
---
| | | |
| --- | --- | --- |
| <font color = {%- if 'Advisory' in item.severity|trim("'[]'")
%}'gold'
{%- elif 'Watch' in item.severity|trim("'[]'") %}'darkorange'
{%- else %}'firebrick'
{%- endif %}><ha-icon icon={{ "'mdi:" + icon + "'" }}></ha-icon></font> | |
From: {{ item.effective_local }} |
To: {{ item.expires_local }} |
More info: {{ item.uri }} |
{{ item.description|trim("'[]'") }} |
{% endfor %}
{% endfor %}
{% endif %}
title: Weather Alerts