#Using weather.get_forecasts in timed automation?

1 messages · Page 1 of 1 (latest)

real crest
#

I want to use my weather entity weather.smhi_home in a 06:00 notification to all mobile devices stating the min and max temperature of the day and its corresponding time. But I have no idea how to combine the action with the automation and ChatGPT is completely unable to help.

minor blaze
real crest
#

I don't manage to get this working so any help is really appreciated.

minor blaze
#

Then share what you've done

real crest
#

This did work previously, now it doesn't render in a notification but it also does not render in an error:

weather_notification_smhi:
  alias: Weather notification SMHI
  sequence:
    - action: weather.get_forecasts
      data:
        type: hourly
      target:
        entity_id: weather.smhi_home
      response_variable: hourly
    - variables:
        temp_low: "{{ hourly['weather.smhi_home'].forecast|selectattr('templow')|map(attribute='templow')|min()|default(0)|round(0) }} {{ state_attr('weather.smhi_home','temperature_unit') }}"
        temp_high: "{{ hourly['weather.smhi_home'].forecast|selectattr('temperature')|map(attribute='temperature')|max()|default(0)|round(0) }} {{ state_attr('weather.smhi_home','temperature_unit') }}"
    - action: notify.mobile_app_daniel_iphone
      data:
        message: >-
          {{ temp_low }} to {{ temp_high }}. {{hourly['weather.smhi_home'].forecast }}
        data:
          icon: "{{ weather_icon }}"
          duration: 40
          repeat: 2
          pushIcon: 1
minor blaze
#

Have you checked the trace?

real crest
#

I can’t find a trace. I’m testing by executing the action in developer tools.

minor blaze
#

Run the script and then you'll have a trace

real crest
#

Seems like I'm missing an important part of HA here

steep lark
#

In the UI, go to settings -> automations and scenes -> scripts.
Then find that script, select the three vertical dots to the right of it, and in the dropdown select “traces”.

After the trace window opens, look to the top right for the three vertical dots again and click them. In that dropdown, select “download trace”.

Now copy the contents of that file and share it using a code share site

real crest
#

Looks like it's stuck trying to send an enormous notification to my iphone 🙂

real crest
#

This is THE GOLDEN DITCH I've been looking for the whole time! AWESOME! Feeding Claude.ai (through VSCode Copilot) with trace output makes it very accurate also. YEEEES!