Sensor state is today as a condition

Hi all,
I have several sensors showing the date of next cycle of garden watering. I need a help how to create a condition for automation. Condition should be: if the state of this sensor is today then do some actions. Watering is always scheduled at 8 pm (sometimes stopped due to weather). So I would to ask before if watering is planned for today or not.

Thanks

You can use a Template condition:

....
trigger:
  - YOUR_TRIGGER...
condition:
  - condition: template
    value_template:  >-
      {{ (states('sensor.doln_trvnk_do_next_cycle') | as_datetime).date() 
      == today_at().date() }}
action: ....
2 Likes

Thank you very much. I have one more question - easy for you I suppose.
How about if the condition should be: is not today.

You would use the same general template, but instead of == (equal to) you use != (not equal to)…

....
trigger:
  - YOUR_TRIGGER...
condition:
  - condition: template
    value_template:  >-
      {{ (states('sensor.doln_trvnk_do_next_cycle') | as_datetime).date() 
      != today_at().date() }}
action: ....

Thank you. It works :slight_smile: