Hi,
I have the following sensor which has been working for months (probably not the greatest way to do it but Im amateur). Currently on version 2024.3.1 but when updating to latest version the sensor no longer returns any values. How can I find out whats causing the problem? Ive restored a backup so working again for now.
Thanks
- platform: template
sensors:
wiser_forecast:
friendly_name: "Wiser Forecast"
value_template: >
{% set time = state_attr('weather.openweathermap', 'forecast')[0]['datetime'] %}
{% if (( time | as_datetime |as_local - now()).seconds / 60) |int >=120 %}
{% set temp = (state_attr('weather.openweathermap', 'temperature') | float + state_attr('weather.openweathermap', 'apparent_temperature') | float) /2 %}
{% else %}
{% set temp = (state_attr('weather.openweathermap', 'forecast')[0]['temperature'] | float + state_attr('weather.openweathermap', 'apparent_temperature') | float) /2 %}
{% endif %}
{% if temp <= states('input_number.winter_temp') | float %}
Winter
{% elif temp > states('input_number.winter_temp') | float and temp <= states('input_number.autumn_spring_temp') | float %}
{% set month = now().month %}
{% if month >1 and month <=6 %}
{% set temp2 = states('input_number.winter_temp') | float + (states('input_number.autumn_spring_temp') | float - states('input_number.winter_temp') | float )/2 %}
{% if temp <= temp2 %}
Early Spring
{% else %}
Spring
{% endif %}
{% else %}
{% set temp2 = states('input_number.winter_temp') | float + (states('input_number.autumn_spring_temp') | float - states('input_number.winter_temp') | float )/2 %}
{% if temp <= temp2 %}
Autumn
{% else %}
Early Autumn
{% endif %}
{% endif %}
{% else %}
Summer
{% endif %}
attribute_templates:
Actual_Temp: "{{ state_attr('weather.openweathermap', 'temperature') }}"
Feels_Like_Temp: "{{state_attr('weather.openweathermap', 'apparent_temperature')}}"
Forecast_Temp: " {{ state_attr('weather.openweathermap', 'forecast')[0]['temperature'] }}"
Wiser_Forecast_Temp: >
{% set diff = state_attr('weather.openweathermap', 'temperature') | float - state_attr('weather.openweathermap', 'apparent_temperature') | float %}
{% set temp = (state_attr('weather.openweathermap', 'forecast')[0]['temperature'] | float + state_attr('weather.openweathermap', 'apparent_temperature')) /2 %}
{{ temp | round(1) }}
Temp_From: >
{% set time = state_attr('weather.openweathermap', 'forecast')[0]['datetime'] %}
{% if (( time | as_datetime |as_local - now()).seconds / 60) |int >=120 %}
Feels Like Temp
{% else %}
Wiser Forecast
{% endif %}