I’m having an issue getting an automation to fire when I change the time on a datetime.
It works ok for boolean type entities but does not seem to be triggering datetime time entries, Im using the ‘state’ trigger but maybe thats not the right one, numeric_state does not seem to work either.
I’m still learning so sorry if this seems like a dumb question
TIA
- alias: Irrigation - Set Next Run Time When Schedule Enabled Or Time Changed
trigger:
- platform: state
entity_id:
- input_datetime.cycle_1_on_time
- input_datetime.cycle_2_on_time
You’re using the wrong type of trigger. What you want is a Time Trigger, not a State Trigger.
trigger:
- platform: time
at:
- input_datetime.cycle_1_on_time
- input_datetime.cycle_2_on_time
It will trigger at the times specified by the two input_datetimes, even if you change their values.
On the other hand, if you only want it to trigger when you modify the value of either input_datetime, but not trigger at the specified times, then I don’t believe that’s possible with a State Trigger. Maybe you can try using a Template Trigger to monitor the input_datetime’s last_changed property.EDIT: you can in fact use a State Trigger (see below).
EDIT
I just confirmed that you can indeed use a State Trigger to detect when an input_datetime’s state value has changed. I tested three different kinds of input_datetimes, time-only, date-only, time-and-date, and changing any one them caused the automation’s State Trigger to trigger.