Recommended ways to manage devices and entities names

But I have replaced a device, delete the old entities, add the device, rename to the new, restart and you are good to go. 10 minutes if that.

All automations intact and working

I like the concept for specific entities that could benefit from it but I think having to write a customization for single every entity would be mind numbing. And maintenance would be horrible if you did it for every entity that you add in the future (or even worse the ones you might remove later) especially since the integration is easily accessible to you in the entities list.

But the battery type example is a perfect use case for that.

But to each their own and knowing that it’s even possible is good to know. Another tool in the toolbox.

So thanks for the info.

I understand your point. However it’s not always a case of extra effort. If someone invests the time to change an entity’s name so that it contains metadata, I believe that time is better served putting the metadata in a custom attribute. In other words it’s not necessarily more mind-numbing work just the same amount of it but with better results.

To your point, I agree that battery type is one of the better applications of this technique. Most people don’t have a need to use an entity’s integration in a template (so they don’t need it as an attribute). If they simply need to know an entity’s integration it’s available in the Entities view. Nevertheless it was used as an example of the kind of metadata one can include should one need it to, for example, create an inventory of installed gadgetry. :slightly_smiling_face:

1 Like

Does it require anything special to add a new attribute, e.g. do I have to edit a list of attributes or anything? Can I simply call a new attribute anything I want?

You can edit a list as described in the documentation or you can use Configuration > Customizations (one entity at a time).

You can name the new attributes whatever you want just avoid using existing names.


UPDATE

As of version 2021.12.0, Configuration > Customizations no longer exists. You can continue to create custom attributes via the customize.yaml file.

Thanks, I wasn’t sure if there was other required actions other than simply adding new. Super helpful!

Hi, I like this idea since the device has so many entities but where are you pasting to? and what is the syntax, if yaml seems to be missing headers and whatnot.

In this instance I was using the z-wave configuration manager, selecting the newly added node, and then selecting entities of this node.
But you can just as easily (well maybe not ‘quite’ as easily) do it from the frontend.
I use a lovelace frontent so I could select ‘unused entities’ from the 3 dot menu
But I suppose if you use an autogenerated frontend then it would just be the new items that appear.
Either way, click on them and choose the cog option to configure them

I’m guessing that these custom attributes can’t contain templates, is that correct?

Correct. It has the same limitations as customizing existing entities as described here (i.e. no mention of the ability to employ templates): Customizing entities

1 Like

Does that mean that I have to add every entity to customize.YAML manually?

Is there a way to do this automatically?

By going to Configuration > Entities > entity > Integration, it is possible to see what integration an entity belongs to. Is there no way to do this programmatically?

Created a new blueprint to help with groups. It doesn’t support adding entities by attribute (yet) but it is substantially easier to create groups, plus it can automatically add or remove entities! Might help those looking to organize their HA.

2 Likes

This convention seems to assume that no two different varieties of sensor will ever have a “type” field with the same value? That is, what happens if you have a battery sensor for AAA batteries, and also a (silly hypothetical) video game quality sensor for AAA games? Your attribute selection code wouldn’t be able to distinguish between them. Would you add a filter based on the entity id, or add another custom attribute for the type of sensor? And if you do the latter, how do you feel about it being redundant with part of the entity id?

Yes.