#Help with new weather templating

1 messages · Page 1 of 1 (latest)

river ridge
#

My OpenHASP displays were all great until the last HA update where they changed the format. I'm not sure I fully understand the new method. The first thing I'm trying to get is the detailed forecast. I can create the service call and can see the info, but creating a template sensor is above my pay grade...

service: weather.get_forecasts
target:
  entity_id:
    - weather.keul_daynight
data:
  type: twice_daily

Results in this response. I want the detailed_description:

weather.keul_daynight:
  forecast:
    - detailed_description: Partly cloudy, with a low around 46. West wind around 9 mph.
      datetime: "2024-04-15T01:00:00-06:00"
      precipitation_probability: 0
      is_daytime: false
      condition: partlycloudy
      wind_bearing: 270
      temperature: 46
      dew_point: 40
      wind_speed: 9
      humidity: 74
    - detailed_description: >-
        Partly sunny, with a high near 66. West northwest wind 12 to 20 mph,
        with gusts as high as 29 mph.
      datetime: "2024-04-15T06:00:00-06:00"
Etc, etc, etc

So now I have to create a template sensor but this is where I'm stumbling. It will probably be something like this?

template:
  - trigger:
      - platform: time_pattern
        hours: /12              <-- is this right? 2x daily?
    action:
      - service: weather.get_forecasts
        data:
          type: twice_daily
        target:
          entity_id: weather.keul_daynight
        response_variable: hourly                 <--- what is this?
    sensor:
      - name: Detailed Description 
        unique_id: detailed_description 
        state: "{{ detailed['weather.home'].forecast[0].detailed }}" <- I'm am just guessing here...

If I can get it into a sensor I think I can figure out how to use it in HASP.

thin helm
#

Your response variable is hourly but in your state template you use detailed

#

And the key is detailed_description, not detailed

#
template:
  - trigger:
      - platform: time_pattern
        hours: /1
    action:
      - service: weather.get_forecasts
        data:
          type: twice_daily
        target:
          entity_id: weather.keul_daynight
        response_variable: detailed
    sensor:
      - name: Detailed Description 
        unique_id: detailed_description 
        state: "{{ detailed['weather.keul_daynight'].forecast[0].detailed_description }}"
#

I would also suggest making it trigger a bit more then only at noon and midnight

river ridge
#

This is SUPER helpful!! I've been battling with this for a week now.

#

The forums are littered with these questions... nobody has figured it out that I could find... and trust me I've been searching, and posting.... and posting, and searching.

river ridge
#

Ok, the sensor is there now but it's state is "unknown"