It’s changed a bit since then.
But here’s the current code:
type: vertical-stack
cards:
- type: conditional
conditions:
- entity: sensor.weather_alerts
state_not: '0'
card:
type: markdown
card_mod:
style:
.: |
ha-card {
--mdc-icon-size: 40px;
}
ha-markdown:
$: |
td {
vertical-align: top;
}
content: |
{% if state_attr('sensor.weather_alerts','entries') != 0 %}
{% for item in state_attr('sensor.weather_alerts','entries') %}
{% for type, icon in [('rain', 'weather-pouring'), ('thunderstorms', 'weather-lightning-rainy'),
('wind', 'weather-windy'), ('snow', 'weather-snowy-heavy'), ('snow, ice', 'weather-snowy-heavy'),
('lightning', 'weather-lightning'), ('ice', 'car-traction-control'),
('fog', 'weather-fog'), ('extreme heat', 'weather-sunny-alert'), ('thunderstorm', 'weather-lightning')] if type == item.summary | regex_findall_index('.*warning of (.*) affecting.*', ignorecase=True) %}
{% set color = item.summary.split(' ')[0] %}
{% set summary = item.summary | regex_findall_index('(.*) affecting South West England: (.*) valid from (.*) to (.*)', ignorecase=True) %}
{% set time_from = as_timestamp(strptime(summary[2], "%H%M %a %d %b")) | timestamp_custom("%H:%M %d/%m") %}
{% set time_to = as_timestamp(strptime(summary[3], "%H%M %a %d %b")) | timestamp_custom("%H:%M %d/%m") %}
| | | |
| --- | --- | --- |
| <font color = {%- if 'Yellow' == color %}'gold'
{%- elif 'Amber' == color %}'darkorange'
{%- else %}'firebrick'
{%- endif %}><ha-icon icon={{ "'mdi:" + icon + "'" }}></ha-icon></font> | | **{{ summary[0] | title }}**<br />{{ time_from }} - {{ time_to }}<br />{{ summary[1] }} |
{% endfor %}
{% endfor %}
{% endif %}
- type: horizontal-stack
cards:
- type: weather-forecast
entity: weather.met_office_blandford_forum_3_hourly
- show_current: true
show_forecast: true
type: weather-forecast
entity: weather.met_office_blandford_forum_daily
- type: horizontal-stack
cards:
- type: entity
entity: sensor.blandford_forum_wind_speed_3_hourly
name: Wind speed
- type: entity
entity: sensor.blandford_forum_wind_gust_3_hourly
name: Wind gust
- type: entity
entity: sensor.blandford_forum_feels_like_temperature_3_hourly
name: Feels like...
- type: entity
entity: sensor.blandford_forum_probability_of_precipitation_3_hourly
name: Chance of rain
- type: horizontal-stack
cards:
- type: custom:vertical-stack-in-card
cards:
- type: entity
name: 'Outside temperature:'
entity: sensor.outdoor_temperature
- type: custom:mini-graph-card
name: 'Last 5 days:'
hours_to_show: 120
entities:
- entity: sensor.outdoor_temperature
- color: gray
entity: counter.night_time
name: Night
show_line: false
show_points: false
show_legend: false
y_axis: secondary
line_width: 2
font_size_header: 12
show:
labels: true
points: true
state: false
icon: false
- type: custom:vertical-stack-in-card
cards:
- type: entity
name: 'Outside humidity:'
entity: sensor.humidity
- type: custom:mini-graph-card
name: 'Last 5 days:'
hours_to_show: 120
entities:
- entity: sensor.humidity
- color: gray
entity: counter.night_time
name: Night
show_line: false
show_points: false
show_legend: false
y_axis: secondary
line_width: 2
font_size_header: 12
show:
labels: true
points: true
state: false
icon: false
- type: custom:vertical-stack-in-card
cards:
- type: entity
name: 'Rainfall:'
entity: sensor.hourly_rain_rate
- type: custom:mini-graph-card
name: 'Last 5 days:'
hours_to_show: 120
entities:
- entity: sensor.hourly_rain_rate
- color: gray
entity: counter.night_time
name: Night
show_line: false
show_points: false
show_legend: false
y_axis: secondary
line_width: 2
font_size_header: 12
show:
labels: true
points: true
state: false
icon: false
- type: custom:vertical-stack-in-card
cards:
- type: entity
entity: sensor.relative_pressure
name: 'Barometer:'
- type: custom:mini-graph-card
name: 'Last 5 days:'
hours_to_show: 120
entities:
- entity: sensor.relative_pressure
- color: gray
entity: counter.night_time
name: Night
show_line: false
show_points: false
show_legend: false
y_axis: secondary
line_width: 2
font_size_header: 12
show:
labels: true
points: true
state: false
icon: false
- type: horizontal-stack
cards:
- type: horizontal-stack
cards:
- type: entity
entity: sensor.sunrise
name: Sunrise
icon: mdi:weather-sunset-up
- type: entity
entity: sensor.sunset
name: Sunset
icon: mdi:weather-sunset-down
- type: entity
entity: sensor.today
name: Today
icon: mdi:calendar
Data in the top two rows come from the UK Met Office.
There’s a conditional card that appears at the top (not in this image) when the Met Office issues a severe weather warning. There’s a how-to post about it here.
Data in the third row comes from an Ecowitt weather station.