Advertisement
dykandDK

HA - YAML - Markdown card with weather forecast data

May 22nd, 2023
1,101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.98 KB | None | 0 0
  1. type: markdown
  2. content: >
  3.  <table>
  4.   <tr><th width=35px></th><th align=left width=150px>Tidspunkt</th><th
  5.   align=right width=75px>Temperatur</th><th align=right
  6.   width=75px>Nedbør</th><th align=right width=75px>Vind</th></tr>
  7.   {% for w in  state_attr('weather.home_hourly','forecast') -%}
  8.   {% set h=w.datetime | as_datetime | as_local %}
  9.   {% if ((h.hour/2) | int) == (h.hour/2) %}
  10.   {% if h.day==now().day %} {% set d='I dag' %} {% else %} {% set d='I morgen'
  11.   %} {% endif %}
  12.   <tr><td><ha-icon icon='mdi:weather-{{w.condition | replace('partly','partly-')
  13.   | replace('clear','') | replace('lightning','lightning-') |
  14.   replace('snowyrainy','snowy-rainy')-}}'/></ha-icon></td>
  15.   <td>{{ d }} {{ w.datetime | as_timestamp | timestamp_custom('%H.00',
  16.   local=True) -}}</td>
  17.   <td align=right>{{ w.temperature }} °C</td>
  18.   <td align=right>{{ w.precipitation | int }} mm</td>
  19.   <td align=right>{{ w.wind_speed | int }} m/s</td></tr>
  20.   {% endif %}
  21.   {% endfor -%}
  22.   </table>
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement