triggers only fire when one of the triggers changes from not true to true. see this:
so if the allergy forecast is above 4, stays above 4, then it the automation won’t trigger.
you said:
However, when I test run the code, if skips the condition and ends.
do you mean when you hit ‘run’ for the automation? if so, when you force run an automation, it skips all the triggers and runs only the actions. this means trigger.id doesn’t get set.
see this: select the Run button. This will execute all of the actions , while skipping all triggers and conditions
what i think you want instead is for your trigger to be daily(?) … ie, “when” do you want something sent? i don’t think you want something sent on your current triggers. the “when” is daily or something like that, right?
also i’m not sure what entity (should be a sensor?) has the forecast, but it’s certainly not atuomation.allergy_forecast_for_tomorrow. that is this automation itself…
also you have “greater than 4” and “less than 4”
what if it’s 4?
this is not 100% right because i don’t know what entities you are trying to read and all, but this framework is right to solve the problems i’ve identified for you above:
alias: Allergy Forecast For Tomorrow
trigger:
- platform: time_pattern
hours: "8"
condition: []
action:
- service: notify.mobile_app_phone
data:
message: >
{% if states('sensor.whatever_sensor_really_has_the_forecast_for_tomorrow) > 4 %}
Allergy Forecast Greater Than 4
{% else %}
Allergy Forecast less than or equal to 4
{% endif %}
@armedad ok…let me take this observation/response in pieces…
First - I completely and I mean completely missed the “atuomation.allergy_forecast_for_tomorrow” aspect. Wow. Should have been: “sensor.allergy_index_tomorrow”.
oh, i think the sensor is coming in as a string. so my error is that it is comparing a string to a number. need to cast the string to a number… float right? i’m not familiar with what the sensor returns. if so, do the below. sorry about that.
alias: 1-Allergy Forecast For Tomorrow
description: ""
trigger:
- platform: time_pattern
hours: "2"
condition: []
action:
- service: notify.mobile_app_phone
data:
message: |
{% if states('sensor.allergy_index_tomorrow') | float > 4 %}
Allergy Forecast Greater Than 4
{% else %}
Allergy Forecast less than or equal to 4
{% endif %}
and yes, on the time. what you have sets it to send at 2am. i should have said above that i had set it to 8am… that would have clued you in more quickly on how to change it to whatever you want.