WTH Offset input_datetime automation trigger by input_number

Take the example of an alarm clock using an input_datetime to trigger an automation. Why can’t I trigger the automation with an offset from the input_datetime, using the value from an input_number rather than a fixed offset - i.e. 15 minutes before the alarm goes off, turn on the coffee machine; 30 minutes after my preset bedtime, turn down the heating.

To be clear: you are asking for the time trigger to support entities with a numeric value (or templates) in the offset option?

+1

Just gonna jump in with agreement here - I have already set this up by following someone’s guidelines to write some yaml in the config file, but for such a powerful and useful automation trigger it should not be locked behind manual yaml editing!

  • 15 minutes before alarm: fade lights on
  • 10 minutes before calendar event: turn entrance lights on
  • 20 minutes before calendar event tagged D&D: turn on guest mode
    etc.

Does offsets work at all for a time trigger wired to an input_datetime? Last I checked I am pretty sure they only worked when wired to a sensor.

was just about to open a new WTH, because this comes up systematically during the years, and it really feels underwhelming we cant (read: seems so natural to do, I was amazed we still cant)

to give a yaml example:

  - id: turn_on_quooker_before_alarmclock
    mode: queued
    triggers:
      trigger: time
      at:
        entity_id: input_datetime.alarmclock_wd
        offset: -00:15:00

Documentation is right, but you have to read carefully, including the placement of the comma:

requesting this feature is especially valid, since we’re told to move from eg template sensors all the time to use input_datetimes.
not being able to trigger off those with an offset is not very consistent from the point of view.

hope this will be considered

To extend this good idea, I’d like to provide a list of offsets.

Doesn’t offset from an input number, but it does allow input_datetimes to be used with a static offset.

Baby steps.

3 Likes

The logical thing would be if offset: works the same way as similar fields like delay: and timeout:, which can accept either a timestring, a number which then is interpreted as seconds, or a mapping which can contain values for hours:, minutes:, seconds: etc.

It does support that already.

That PR just allows us to use input_datetimes. Currently we can use an offset with timestamp sensors. The offset field from it’s inception supports seconds, a time string, or hours/minutes/seconds.

any idea, when this PR will go live? Currently I still can’t set any offset for a time based trigger

but does it allow datetimes with only time? That would be the biggest enhancement imho.

My alarm clock time doesn’t use a day… creating a template sensor for that doesnt work, as we cant set timestamp on that apparently.

the next_alarm (remember?) has states that cant be used as trigger (when both weekday and weekend days are off, the state is either 0 or unavailable, so not very useful in an automation).

yes it does

1 Like

great. Fingerscrossed then even more.

merged, next release

is this merged for 2025.2 now? since I didnt see any mention of it at all yet in the discord, or noteworthy etc etc

2 Likes

heck I missed it there.
imho it should be upgraded to the Noteworthy changes

Ill mention it in the Beta channel so we all can have a go at it
thx