ah right, the trigger is currently on hourly (in the trigger it has hours: /1). for now, which means it will only get the forecast at the top of the hour.
just to test it temporarily, perhaps switch it to minutes: instead of hours: restart and wait until the top of the minute…
i see @code-in-progress also glanced at this thread… don’t hesitate to jump in if you see something i don’t!!!
apologies, it wasn’t clear to me if you had done this after the restart or not. however the hourly invocation is more likely the current culprit. also the fact that it say unavailable instead of unknown is an indicator that the sensor is created… but the value isn’t loaded.
ah ok and i rebooting…
like before the weather.petherborough_forecast was alot more full of settings or attritrbutes or states whatever you call them… but they are broken out seperately now so they no longer under the forecast… i did also try removing the enviromental canada… and re add it to see if it fix it… but it kept it seperate still
As always in YAML, indentation is important target and response_variable are not children of data… all three of them should be aligned with service.
# This should be added directly to configuration.yaml or a properly merged file.
# For merged files (AKA Split Configuration), if your configuration.yaml file contains a line like `template: !include THE_NAME_OF_THIS_FILE.yaml`,
# you need to remove the "template:" on the top line.
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
response_variable: hourly
- variables:
ptb_forecast: "{{ hourly['weather.peterborough_forecast'].forecast }}"
sensor:
- name: Temperature forecast next hour
unique_id: temperature_forecast_next_hour
state: "{{ ptb_forecast[0].temperature }}"
unit_of_measurement: °C
The sensors in Post #11 are a mash up of old format and new format and most do not have the required quote marks and delimiters. { is not the same as {{.
Where do you have these sensors configured… i.e. are they all directly in configuration.yaml or in some other file that is being merged using the !include tag?
The legacy format sensors need to be configured under the top-level key sensor. The current format needs to be configured under the top-level key template.
i was trying to convert my legacy to work new format… as legacy was only 3 lines of code new format is like 15 lines of code… but also the sensors are no longer part of forecast that im trying to use as i mentioned… which i been trying to to convert
sensor into template sensor but i havent had any luck
and they are configure under the weather.yaml under packages folder… as it worked fine and dandy orginally as you see in the orginal code
i figured if i could just re code just the 1 line it fix it from
weather.peterborough_forecast.condition to sensor.peterborough_current_condition
and so on as the forecasts dont match weather page as there is no longer
a weather.peterborough_forecast.condition that weather page would make you believe you can do
so thats why i been frustrated
and your code didnt work it didnt create sensor Temperature forecast next hour
but gonna try a total reboot of HA and my internet see if your code works then
You are overwriting the corrected version with the prior version because you did not change the unique ID. And all of the other sensors are still a mess.