Automation Alias and name?

Maybe i’m missing something but is there only an alias for automations and not a ‘name’? I want a friendly name like “Turn of garden lights at 8:00” or something but want to be able to trigger the automation (enable/disable whatever) with something like automation.turnoffgardenlights (all just example names). Right now everytime I want to rewrite the label for in the gui i have to rewrite my groups, triggers etc to match this new name it gets… am I missing something or is this just ‘stupid’

1 Like

From within the action: part of an automation you can turn on/off any automation using the alias but with “_”'s replacing the spaces…

 - service: automation.turn_off           
   entity_id: automation.turn_off_bedroom_lights_if_its_no_longer_needed
 - delay:
     minutes: 10
 - service: automation.turn_on           
   entity_id: automation.turn_off_bedroom_lights_if_its_no_longer_needed

Hope that helps.

Thanks for your reply! I do know that and it’s exactly the fact… ‘turn_off_bedroom_lights_if_its_no_longer_needed’ could be the label that you the user should be able to read… but changing just 1 letter and all your groups, scripts, etc etc linking to the automation don’t work anymore until you rename them.

Groups have an identifier (in example scriptart: ) which turns into group.scriptart and a name: “turn on my scriptart” which is the GUI label… And the same goes for scripts that offer an alias which is independent from the script.[id] that is used to call a script

I love what I can do with Home assistant but “Home inconsistent” is sometimes more like it :frowning:

1 Like

I’m still not entirely sure what you are saying, why would you change the alias of the automation? The user can turn on or off an automation from the front end anyway if you care to display them!

1 Like

Let me try this again, I’ll keep it simple since I tend to over complicate things.

The Alias is used for the ‘label’ in the front end, thus showing the user “Turn off lights whenever bla bla” but this is also used as the identifier that gets turned into automation.turn_off_lights_whenever_bla_bla. To my idea this is bad practice since the moment I want to rename the label for the user ‘Turn off lights whenever etc etc’ the identifier also changes to automation.turn_off_lights_whenever_etc_etc which in turn means that all my scripts/automations that do something with this automation (turn off when i’m not home for a few days whatever) have to be rewritten to match this new identifier.

Other parts of Home assistant offer things like an Alias where the alias is shown to the user and the identifier is derived from something completely different which just makes it easier to just rewite the label of the item without implications on the internals of the system.

1 Like

If you just want to change the label in the frontend, you can create a customize: entry for the automation and set its friendly_name just like any other entity.

So something like:

homeassistant:
  customize:
    automation.turn_off_lights_whatever_bla_bla:
      friendly_name: Turn Off Lights

Then the automation will still be named automation.turn_off_lights_whatever_bla_bla but the frontend label will be ‘Turn Off Lights’

1 Like

Aha! Awesome! that’s what I was looking for is this the best approach for all labels?

Yes this is the standard way to re-label entities in the frontend. As far as I know every entity can be renamed this way

Awesome! I might have just mist that part… So much to learn like 433mhz receiver (mqtt) + multiple switches (hint hint ha ha)

It seems very strange you can’t reference an automation by it’s ID. For example an automation like this:

- id: daily_nas_off
  alias: 'Switch off NAS power at 03:00'
  trigger:
    platform: time
    at: '03:00:00'
  condition:
    condition: state
    entity_id: switch.buffalo_nas
    state: 'on'
  action:
    service: switch.turn_off
    entity_id: switch.buffalo_nas

Can only be referenced elsewhere (e.g. customize.yaml) as automation.switch_off_nas_power_at_0300 instead of automation.daily_nas_off.

It would be great if the ID could be used if it was present, to prevent the above issue of having to rename it everywhere, every time you adjust the alias?

7 Likes

It seems like they quietly dropped support and use of automation ids - it’s still an attribute of every automation, but it’s the alias that serves its purpose now.
Have a look at examples - aliases everywhere, no ids.

So now aliases are our ids. And to change automation’s name you should use customisation or set anything as name in Lovelace (if used).

@AhmadK are you sure? Here it states id is required on automations for the automation editor to work:

IDs are for automation editor only, let’s put it that way.