Get the ID of a label

I can’t for the life of me find a way to view the ID of a label. I know the general rule is lower case of name and _ for spaces and special chrs. So you can guess at it some times but its always a guess. Would be nice if in the Settings > Labels that it would tell you the ID in the UI when you click on the label.

Is there another way to get it?

For reverence I am trying to create an automation that will change the select of all utility meters that have a TOU tariff on them

IE:

action: select.select_option
metadata: {}
data:
  option: "{{ trigger.to_state.state }}"
target:
  label_id: utility_meter_tou

This way it will target and update all my Utility Meters that have the Label on them

{{ labels() }} will return a list of all label IDs.

1 Like

Thanks so much for this!!!

The pit you fall into is that the id is generated from the first creation of the label.
Any change in the name of that label after the creation will not change the id.

1 Like

great point, yes can be very annoying…