Snow forecast notification help

I want to create an automation to alert me if there is snow expected in the next 5 days. Don’t know how to write yaml and used chatgpt. I’m unable to get the notification to tell me what day(s) snow is expected. I am using weather.com. This is the closest I’ve come

alias: Snow in Next 5 Days (Weather.com)
triggers:
  - at: "4:00:00"
    trigger: time
conditions:
  - condition: template
    value_template: |
      {% for day in forecast[:5] %}
        {% if day.condition in ['snowy', 'snowy-rainy'] %}
          {{ true }}
        {% endif %}
      {% endfor %} {{ false }}
actions:
  - action: notify.mobile_app_iphone
    data:
      title: Weather Alert!
      message: Snowy conditions expected in the next 5 days.
variables:
  forecast: >
    {% set f = state_attr('weather.home', 'forecast') %} {{ f if f is not none
    else [] }}
mode: single

Are you sure your weather.home has an attribute forecast? Unless that’s a Template weather entity that you created, it is very unlikely. The forecast attribute was removed well over a year ago.

Weather.com is not covered by a core integration, so you need to tell us what custom integration you are using for us to help.

If it is the one by jaydeethree, its docs show the following:

The link in that screenshot leads to a post in this forum explaining the use of the weather.get_forecasts action.

alias: Snow in Next 5 Days (Weather.com)
triggers:
  - at: "4:00:00"
    trigger: time
conditions: []
actions:
  - action: weather.get_forecasts
    target:
      entity_id:
        - weather.home
    data:
      type: daily
    response_variable: forecasts
  - condition: template
    value_template: |
      {{ merge_response(forecasts)[:5]
      | selectattr('condition', 'in', ['snowy', 'snowy-rainy']) 
      | list | count > 0 }}
  - action: notify.mobile_app_iphone
    data:
      title: Weather Alert!
      message: Snowy conditions expected in the next 5 days.
mode: single

Thanks for your help. Yes that is the correct integration. Both automations work to notify me of snow in the next 5 days. Is there a way to have the notification say specifically what day the snow is expected on (monday, saturday ect.)?

With templates basically anything is possible…

alias: Snow in Next 5 Days (Weather.com)
triggers:
  - at: "4:00:00"
    trigger: time
conditions: []
actions:
  - action: weather.get_forecasts
    target:
      entity_id:
        - weather.home
    data:
      type: daily
    response_variable: forecasts
  - variables:
      days: |
        {%macro weekday(dt)%}{{- dt.strftime('%A')-}}{%endmacro%}
        {{ merge_response(forecasts)[:5] | selectattr('condition', 'in', ['snowy', 'snowy-rainy']) 
        | map(attribute='datetime') | map('as_datetime') | map('as_local') | map('apply', weekday) | list }}
  - condition: template
    value_template: |
      {{ days | count > 0 }}
  - action: notify.mobile_app_iphone
    data:
      title: Weather Alert!
      message: Snowy conditions expected on {{' and '.join((days|join(', ')).rsplit(', ', 1))}}.
mode: single

Fantastic thank you so much for your help!!

Hi Guys,

How do you test the notification that work and sending mobile notification. When i run it, do not send anything to the phone?

You can find and test actions that are available on your HA instance using the Action tab of the Tools dashboard. Once you have found the action/service that corresponds to your device, use that ID to replace notify.mobile_app_iphone in the automation.

Also, keep in mind that your weather entity may have a different entity ID than weather.home, so you’ll need to check that as well by searching for it in the States tab of Tools or the Entities dashboard.