Is it possible to retrieve the scheduled start time of an automation?

Tags: #<Tag:0x00007f7394acf850> #<Tag:0x00007f7394acf760>

I have one automation which purpose it is to set the input_numbers in order to enable/trigger another automation.
In order to reduce the maintainance of this (and a set of similiar time based automatons) it would be nice to dynamically re-use the trigger info in the action part of the code rather than to manually have to adjust the entries (trigger:at and the two service entries).

Does there exist any state change information for when the automation was triggered, eg states.automation.name.last_changed (I have tested this particualar attribute)
that would be available within the automation itself?

  alias: 'Motorvärmare Flagga: Auto: 7.17 vardagar'
  description: ''
  trigger:
  - at: '7:17'
    platform: time
  action:
  - data_template:
      entity_id: input_number.mv_flagga_hour
      value: '7'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.mv_flagga_minute
      value: '17'
    service: input_number.set_value
  mode: single

try states.automation.name.attributes.last_triggered

You can use trigger.now:

  alias: 'Motorvärmare Flagga: Auto: 7.17 vardagar'
  description: ''
  trigger:
  - at: '7:17'
    platform: time
  action:
  - data_template:
      entity_id: input_number.mv_flagga_hour
      value: "{{ trigger.now.hour }}"
    service: input_number.set_value
  - data_template:
      entity_id: input_number.mv_flagga_minute
      value: "{{ trigger.now.minute }}"
    service: input_number.set_value
  mode: single
1 Like

Nice is there a list of these objects somewhere?

They’re documented under the Trigger State Object.

Here’s what’s available for the Time Trigger:

Time

Template variable Data
trigger.platform Hardcoded: time
trigger.now DateTime object that triggered the time trigger.
1 Like

This worked out nicely, thank you for pointing to the trigger state object - an obvious solution now that I know of it.