Running automation alias template

Hi everybody.
Is there any way to retrieve the running automation alias?
I schedule Tado climate operations through automations. I wanted to manage temporary or permanent overrides, without missing scheduling events. This kind of behaviour is natively provided by the Tado cloud services. I just want to mimic them, without the cloud part. :wink:
I use an input_boolean to store the override state for each Tado device, and an input_text to store the last scheduled automation that was triggered. When the override ends, I trigger the automation stored in the input_text.
This is intended to be mainly integrated with Google Assistant through HA scripts.
Since the same action has to be integrated in every automation, it would be more elegant (and error prone!) to retrieve the running automation alias through a template call. Is there any way to achieve this?
Thanks a lot for your help.

- alias: climate_bagnobambini_off
  hide_entity: true
  trigger:
    - platform: time
      at: '07:45'
    - platform: time
      at: '21:00'
  action:
    - service: input_text.set_value
      data_template:
        entity_id: input_text.climate_bagnobambini_lasttrigger
        value: 'climate_bagnobambini_off'
    - condition: state
      entity_id: input_boolean.climate_bagnobambini_override
      state: 'off'
    - service: climate.turn_off
      entity_id: climate.tado_bagnobambini
    - service: climate.set_hvac_mode
      data:
        entity_id: climate.tado_bagnobambini
        hvac_mode: 'off'

- alias: climate_bagnobambini_restore
  hide_entity: true
  trigger:
    - platform: state
      entity_id: input_boolean.climate_bagnobambini_override
      from: 'on'
      to: 'off'
  action:
    - service: automation.trigger
      data_template:
        entity_id: "automation.{{ states('input_text.climate_bagnobambini_lasttrigger') }}"
2 Likes