hi i need some help with fixing some issues the new weather template causes the first couple errors i get i been try to fix is
Template variable error: 'dict object' has no attribute 'weather.peterborough_forecast' when rendering '{{ has_value(hourly['weather.peterborough_forecast'].forecast[0].temperature) }}'
Referenced entities weather.peterborough_forecast are missing or not currently available
Error rendering availability template for sensor.today_rain: AttributeError: 'float' object has no attribute 'lower'
Error rendering availability template for sensor.temperature_forecast_next_hour: UndefinedError: 'dict object' has no attribute 'weather.peterborough_forecast'
i been trying a float(0) default(0) etc but here is my code… what i trying to do is. if it doesnt get anything just place unavaliable or 0 etc… and not throw a log error
here is my code
template:
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: hourly
target:
entity_id:
- weather.peterborough_forecast
- weather.home
response_variable: hourly
sensor:
- name: Today Rain
unique_id: today_rain
state: "{{ hourly['weather.home'].forecast[0].precipitation |float(0)}}"
#state: "{{ forecast['weather.home'].forecast[0].precipitation }}"
availability: "{{ has_value(hourly['weather.home'].forecast[0].precipitation) }}"
unit_of_measurement: mm
- name: Temperature forecast next hour
unique_id: temperature_forecast_next_hour
state: "{{ hourly['weather.peterborough_forecast'].forecast[0].temperature | float(0)}}"
#state: "{{ forecast['weather.peterborough_forecast'].forecast[0].temperature }}"
availability: "{{ has_value(hourly['weather.peterborough_forecast'].forecast[0].temperature) }}"
unit_of_measurement: °C