Add new dashboard format to weather report macro

This commit is contained in:
2025-03-05 17:26:55 -05:00
parent 352e4f1ada
commit b459d78446

View File

@ -4,9 +4,9 @@
{% macro weatherInfo(type,method,time) %}
{% set time = time|default('day') %}
{% if method == 'text' %}
{% if method in ['text','dashboard'] %}
{% if type in ['current','full'] %}
The current weather is {{ states('weather.iron_nerd_weather_station') | lower }}. It is {{ state_attr('weather.iron_nerd_weather_station','temperature') | round }} degrees outside and feels like {{ states('sensor.stratton_ave_apparent_temperature') | round }} degrees.
The current weather is {{ states('weather.iron_nerd_weather_station') | lower }}. It is {{ state_attr('weather.iron_nerd_weather_station','temperature') | round }} degrees outside and feels like {{ states('sensor.home_temperature_feels_like') | round }} degrees.
{% endif %}
{% if type in ['forecast','full'] %}
{% if 14400 <= ct <= 61200 %}
@ -19,15 +19,17 @@
{% if type in ['alerts','full'] %}
{% if is_state('input_boolean.tornado_alarm','on') %}
We are under a tornado warning. If you are not already in shelter, you should be. Get on it!
{% elif states('sensor.weatheralerts_active_alerts') > '0' %}
{% elif states('sensor.weatheralerts_active_alerts') > '0' and method != 'dashboard' %}
Current weather alerts: {{ states('sensor.weather_alert_string') }}.
{% endif %}
{% if is_state('binary_sensor.lightning_warning','on') %}
{% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %}
There is lightning in the area. Nearest strike is {{ ltgdist }} miles away.
{% endif %}
{% if is_state('binary_sensor.raining','on') %}
It is currently raining. Make sure all doors and windows are closed!
{% if method != 'dashboard' %}
{% if is_state('binary_sensor.lightning_warning','on') %}
{% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %}
There is lightning in the area. Nearest strike is {{ ltgdist }} miles away.
{% endif %}
{% if is_state('binary_sensor.raining','on') %}
It is currently raining. Make sure all doors and windows are closed!
{% endif %}
{% endif %}
{% if state_attr('weather.iron_nerd_weather_station','visibility') | int < 3 %}
Caution: Current outdoor visibility is {{ state_attr('weather.iron_nerd_weather_station','visibility') }} miles.