Labels: allow defining in yaml

So, adding a label won’t count as editing the automation (and hence having to migrate it)?

I should spin up my test instance and check this out. I just don’t want to risk anything dubious with my production instance.

The categories and label work also with old yaml files.

For me the move from many yaml files to GUI was impossible to grasp without a way to categorize them. In YAML I had multiple automations in one file and also sub-directories. With categories I can now organize them in a way that is logical to me. I will mainly use the GUI automation features to support me with the syntax. I am sure I will still write most in yaml mode.
I often use my iPad for doodling with HA so being able to edit yaml in the GUI is going to be nice for me.
I do not use packages.

I have yet to use labels.

Enjoy the new categories and labels with your good old yaml files. It works. It seems the label and category info is stored in .storage json files along with names and areas etc

1 Like

One of the reasons the request to be able to add labels to a entity using yaml, was in the situation of writing packages that expand/enhance the sensors that are available within HA, or added by another integration.

For example for a brand of solar inverters/batteries/meters the integration adds the ‘basic’ sensors, however beyond this to determine flows of power or how much energy went where / saved or cost how much, it requires writing a bunch of ‘addon’ custom sensors.

Given that an end user installing these yaml packages can filter and see the original integrations sensors (using the ability to now filter by the integration itself), but this will not include all the custom sensors that are part of their solar systems overall sensors/entities, as the custom sensors would be not part of the integration and instead show as ‘template’ or ‘utility meter’ etc.

Having the abilty to simply add a label into the package yaml code, allowing these custom sensors to be easily and quickly identified would be the easier way to go, than expecting end users having to be told how to manually identify and then allocate each sensor (that may be in one case 200-300) the required label via the GUI.

2 Likes

Thanks for the explanation, Kenneth.

From what I read here is that it’s not possible to add labels through YAML. So something like below is not possible now?

  - alias: "[home|vacuum] Update Alfred Map When Running"
    description: Update Alfred Map every 5 minutes when Alfred vacuum is running
    mode: restart
    labels:
      - vacuum
      - alfred
      - map
    categories:
      - vacuum_automations
    trigger:
      - platform: state
        entity_id: vacuum.alfred
        to: 'cleaning'
    condition: []
    action:
      - alias: "Start updating Alfred map"
        repeat:
          while:
            - condition: state
              entity_id: vacuum.alfred
              state: 'cleaning'
          sequence:
            - service: homeassistant.update_entity
              target:
                entity_id: camera.alfred_map
            - delay:
                minutes: 5

I think something like this is a must for us YAML users.

3 Likes

+1

I need to define template sensors in YAML since icon template does not work via de UI, but then I lose the hability to add labels

100% same issue for me.

+1 - Same for me.

The same, this feature needs to be implemented.

Still a big need from my part, same goes for categories if that’s possible.

1 Like