Proposal: "next_trigger" attribute for automations

It would be useful to have an additional attribute for automations which would contain a timestamp value that is equal to the next time the automation will be triggered.

There is currently an attribute which says when the automation was last triggered. The “next trigger” value would be in the same format.

Open question: If the time is not able to be discerned (many automations are not time-based, but instead triggered on events) what should the value be?

Tell me the next time this will trigger:

trigger:
- platform: state
  entity_id: binary_sensor.front_door
  to: 'on'

I agree with you, some cannot be discerned. It would be useful to have a way to discern the ones that are knowable, however; other automation software (specifically, Google’s) provides the user a way to know when the next time-specific automation will fire.

This would be very limited. The only places I can think it would have a value are for time triggers, time pattern triggers and sun event triggers.

All of these you can calculate yourself.

time trigger: you already know what time it will trigger. Use the literal value.

time pattern trigger: last triggered + interval.

sun event: use the next rise/set attribute.

1 Like

It should be called the tardis sensor.

1 Like

Because it’s bigger on the inside than the outside?

You said it would be useful to have this “next_trigger” attribute. Can you provide a few examples of its usefulness?

1 Like

The idea of time travel does expand minds and spaces :slight_smile:

I think this would be really useful in the automations dashboard.
Like if you want to know when a timed automation will happen then you go look at the automations page. If you go there and only see “sunset + 20 minutes” then you still have to look up somewhere else when sunset will/did happen.

It was very useful for me for managing a lot of automations that were related to large scale irrigation systems. With different irrigation zones we were triggering by relative events like sunrise, sunrise+1h or 6:00AM plus 2 hours. Having a column that showed the calculated time for those relative events is very useful to see, next to the “last triggered” column. And for automations that were not related to time, the “next trigger” column would either show nothing, a dash or “event” or some other text that kept the screen clean and understandable (like for example "soil humidity=10%).

Using the same timing criteria, you can create a Trigger-based Template Sensor to display the next trigger time. In fact you could probably use it to also trigger the automation (thereby centralizing the time calculations in one place).

Otherwise, waiting for this FR to be implemented may be a very, very long wait (two votes in 2.5 years suggests it has attracted very little interest).

1 Like

The next trigger of this FR implementation seems to be null, then?