Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label extensions #3

Open
codemunkie15 opened this issue Sep 1, 2024 · 4 comments
Open

Add label extensions #3

codemunkie15 opened this issue Sep 1, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@codemunkie15
Copy link

Are you requesting that a Home Assistant template extension be added? Which one?
Extensions for labels

Is your feature request related to a problem? Please describe.
I'm trying to define CSS styles based on a label being attached to an entity.

Describe the solution you'd like
'Presence activated light' in label_entities(config.entity)

Describe alternatives you've considered
I can do this (requires label_id):
'presence_activated' in hass.entities[config.entity].labels

But would prefer to do this (uses label name instead):
'Presence activated light' in label_entities(config.entity)

Many thanks

@codemunkie15 codemunkie15 added the enhancement New feature or request label Sep 1, 2024
@Nerwyn
Copy link
Owner

Nerwyn commented Sep 2, 2024

For my reference: https://www.home-assistant.io/docs/configuration/templating/#labels

I should work on the next minor version of this package once I'm done with v4 of my remote card.

@Nerwyn
Copy link
Owner

Nerwyn commented Sep 9, 2024

@codemunkie15 which frontend project do you want to test the new functions on? I've added a bunch of new functions to include in 1.3.0 and should be able to release a beta build of ha-nunjucks and a matching beta build on universal remote card or custom card features in a day or two. I forgot you posted a different issue to custom features, I'll make an alpha build there.

@Nerwyn
Copy link
Owner

Nerwyn commented Sep 9, 2024

Bad news - it turns out the hass object field I was using for a lot of labels logic _labelRegistry doesn't appear consistently and can't be used. I'm going to have to remove the label_id and label_name functions and limit label functions to just using the label ID, as the label name doesn't seem to be available otherwise.

@Nerwyn
Copy link
Owner

Nerwyn commented Sep 12, 2024

@codemunkie15 have you gotten around to trying this in the custom features project alpha?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants