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.
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.)?