Label: allow changing the label ID

When using the brand new labelling system (which is great :+1:) and creating a new label in the UI, HA obviously creates the label with a name (it’s the string you type in when creating) and an ID (which seems to be a cleaned and lowercased string based on the name you give).

When changing the name later on, the initially given ID remains unchanged.

Example:

  • create a label named “Heating”
  • HA creates label with name “Heating” and ID “heating”
  • change the name to “Heat”
  • label has now the name “Heat” and the ID “heating”

This behaviour is absolutely reasonable in most cases I guess.

But there may be situations where I create a label and stick it to many items (automations, entitites, whatever…).
When I now want to change the label, I only can change the name, not the ID. Especially when using the label in templates I always have to face a discrepancy between the ID I have to use and the real name (and maybe meaning) of the label.

I understand that an ID is nothing more than an unique thing without any further meaning but the ID is created from the initial name and so in practice it gets a meaning.

Possible solutions:

  • create a random ID which has nothing to do with the name (but this is probably not preferred since it may make templating more difficult)
  • allow changing the ID

Thank you for the great work.

Upvoted!

As a workaround for editing the label ID in the UI until there is another way to do this…

  1. Go to the page for managing Labels.
  2. Edit the name of the label you want to change and add “old” to the end of it.
  3. Create a new label with the correct name you wish to use.
  4. Go to the list of devices/entities/automations/etc you wish to re-label.
  5. Filter by the “old” label.
  6. Enter the selection mode and select all items.
  7. Add the new label.
  8. Do this for any other items that have the old label.
  9. Go to the page for managing labels and delete the “old” label.
2 Likes