Figured out how to template the weather forecasts too

This commit is contained in:
2023-07-29 16:47:12 -04:00
parent 9c12f64586
commit a6eb6e3d43

View File

@ -28,15 +28,13 @@ weather:
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
forecast_template: >
{% if state_attr('weather.iron_nerd_studios','forecast') %}
{{ state_attr('weather.iron_nerd_studios','forecast') }}
{% elif state_attr('weather.kdfi_daynight','forecast') %}
{{ state_attr('weather.kdfi_daynight','forecast') }}
{% elif state_attr('weather.openweathermap','forecast') %}
{{ state_attr('weather.openweathermap','forecast') }}
{% else %}
{{ state_attr('weather.weatherapi_stratton_ave','forecast') }}
{% endif %}
{% set forecasts = [
states.weather.iron_nerd_studios.attributes,
states.weather.kdfi_daynight.attributes,
states.weather.openweathermap.attributes,
states.weather.weatherapi_stratton_ave.attributes
] %}
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
pressure_template: >
{% set pressures = [
states.sensor.kdfi_barometric_pressure,
@ -111,11 +109,11 @@ weather:
{% set result = humidity | selectattr('state','ne','unavailable') | selectattr('state','ne','unknown') | map(attribute='entity_id') | list | first %}
{{ states(result) | float }}
forecast_template: >
{% if state_attr('weather.kdfi_hourly','forecast') %}
{{ state_attr('weather.kdfi_hourly', 'forecast') }}
{% else %}
{{ state_attr('weather.iron_nerd_studios_hourly','forecast') }}
{% endif %}
{% set forecasts = [
states.weather.kdfi_hourly.attributes,
states.weather.iron_nerd_studios_hourly
] %}
{{ forecasts | selectattr('forecast','defined') | map(attribute='forecast') | list | first }}
pressure_template: >
{% set pressures = [
states.sensor.kdfi_barometric_pressure,