Hi,
I am trying to get the temperature from the output of weather.get_forecast every third element.
Temperature is not changing so much, so I would like to safe some space on my display
I tried to use looping using a variable, according to this post: Counting simple variable in jinja (loop), but I donāt get the counter implemented in the .attribute.forecast[ ] the way it works correctly.
At the moment I am using this template to display the temperature of the next three hours
{% for state in states.sensor.weather_forecast_hourly.attributes.forecast[1:4] -%}
{{ as_timestamp(state.datetime)| timestamp_custom("%H") }}h;{{ state.temperature| round(0) }}Ā°#
{%- endfor %}
Great idea ā¦ I constructed this to show every 2nd oneā¦possibly some of the guruās have another idea
{% for s in range(0,states.sensor.weather_forecast_hourly.attributes.forecast|length) -%}
{% if s | int % 2 == 0 %}
{{ states.sensor.weather_forecast_hourly.attributes.forecast[s].temperature }}
{% endif %}
{%- endfor %}
i changed the line states.sensor.weather_forecast_hourly.attributes.forecast|lengthā to an integer to limit the number output values and added some more attributes to the output.
I really enjoy this community - 1h and some smart person has a solution and nobody tells you āweather is stupidā or āyou donāt need temperature, you need insert something totally differentā