Question about device Names

I'm planning to write a meaningful and unique identity on each of my sensors, plugs etc. to help me recognise and manage the devices in HA and the physical space. I've based this on ideas from others who do similar.

My plan is to use these identifying strings to replace the default device Name in HA.

Does this make sense or are there any reasons not to do this?

If you also do this, what's your scheme and why?

Can you show an example of exactly what you mean and explain what the benefit (to you) would be?

I give my devices and entities functional names. It keeps everything readable.

After asking around I combined a few ideas I liked to come up with this form:

  <protocol>–<roompurposetype>[–<IP>]

The IP is optional, used when I set a fixed IP and is just the last octet in decimal. The first part is zigb, mqtt, esph etc, and the middle part gives location and purpose. For example:

  mqtt-G/K/WashingPlug-129
  zigb-G/LR/TempHumid

Where:

  G/K - ground floor kitchen
  G/LR - ground floor living room

I've not been 'managing' devices yet (I just have three and am about to add another 12) so my reasons may be off but based on what others said:

  • its handy to know the protocol, location and type/purpose of sensor
  • the IP is handy for pointing a browser for updates and configuration

That all makes sense to me. I've begun changing the names of Entities so they are more readable and meaningful in my first attempts at editing dashboards.

I'm not sure though how all of this will play when I get round to creating templates, automations etc. I'm guessing for entities you use the ID rather than name, so maybe it means looking up the ID for a given name? I've just not looked into this yet.

My plan is to maintain a spreadsheet with all these details so looking up IDs should be ok, and I can also record notes and reasons for changing things after initial setup.

Any comments and feedback from folk who actually know what they're doing is very welcome, as are more questions!

I'm not sure adding the protocol to the name is helpful, as it might look cluttered. Have you considered using Labels - Home Assistant?

Personally, I just use the exact function of the product in the name, and then assign a proper Areas - Home Assistant and any labels I need. And to keep it shorter I also use abbreviations. LR = Living Room / SR = Storage Room / DR = Dining Room.

So a final name for me might be "SR Main Light Strip" with labels WLED and WiFi and area Storage Room.

Of course, it sounds like you are doing a more "everything is in the name" while mine is more of a "user friendly name", so really two different subjective approaches. I do like how you can filter and target by labels without needing templates. However, having details in the name could make it easier if you write lots of YAML and templates, as the linters can auto suggest based on the name. It really depends on whether you want to target "the ESPHome plug under the counter" or the "Cabinet Lighting Plug" which would happen to be ESPHome.

Yes, good points. I've not used labels yet so hadn't considered them for this. Can you assign multiple labels to a device? If so that's nice. I may well be going over the top. It's hard to know what's the most useful approach without any experience using them.

So the comments and ideas from you and others are very helpful. Thanks

Yes you can have multiple labels on a device, and not just the device. You can have multiple labels on each entity for a device, as well.

My opinion is name your devices after their abstract functionality. The physical device controlling that functionality may change (or be replaced).

Then in your automations and dashboards, for example are "turn on the kitchen light" instead of "turn on the device that turns on the kitchen light". Don't add complexity.

Labels and areas can then be used for grouping/tagging. There's other meta data about a device that already identify the device type (or current IP address).

The "main" entity for a device is not set and then becomes named after your device -- another reason to just name the device based on what it controls.

More good points, thanks. :thinking:

As I tend towards the simple meaningful name approach suggested by @busman I have questions. I can research these but if anyone wishes to answer that'd be great...

  • what things depend on device and entity names (such as templates), and if I change a device or entity name, which things that depend on them are not automatically updated?

  • in general, what are the things that is best to get right first time because changing them later is a pain (not just names)?

  • when creating a label can you include a description to remind you what it's for, and is this accessible where these labels appear in the GUI (eg as a tooltip)?

FWIW, and this may or may not help your decision, but I simply name the device based on what room it is in, what type of device it is, and how many of the device exists in that particular room (eg - light.living_room_light_1, light.living_room_light_2, and light.dining_room_chandelier).

To help with your questions -

1 and 2. Any and all things are dependent on the device and entity names. However, I personally give precendence to the entity name, for 1 MAJOR REASON. That reason is because "devices" have peculiar and specific ID's. If you swap/replace a device later on your journey, the new device will have it's own device_id. For this reason alone, I always try to use entity_id's in my scripts and automations, so should a device be swapped/replaced, I can use the same entity_id and not worry about updating any scripts or automations.

  1. Yes, labels can have descriptions. You can access the label GUI in the frontend by going to Settings > Areas, labels & zones and clicking on the labels tab.

The names, like friendly name, or the IDs? Changing the name.is typically not an issue. Changing the entity ID is changing the main key, and typically that is what you'd be using everywhere. Steer away from using device IDs, because they're obscure and cannot be changed (e.g. when replacing a device).

So am I correct in thinking:

  • avoid referring to device IDs where possible because they are fixed and change if you replace a device
  • do script entity Name but try to get this right because if you change it later, anything depending on that name will need updating

I think a descriptive name augmented by labels seems a good approach.

Someone said that it's unnecessary to include device IP (last octet only) in a device name because this is available elsewhere. I expected that would be the case, but wonder if it's still useful to record it in a device name and/or on the device itself?

The reason I was given is that it makes it easier to point the browser at the IP for update and config. Is that much of an issue?

Thanks to everyone here and on Mastodon for your input.

Entities can live without a device. But, in general, a device is a collection (almost a grouping) of entities provided by that device. You are best to think about entities, not devices -- especially not device IDs.

If you use entity IDs in your automations, scripts and dashboards then if you ever change devices those don't have to be touched. I have z-wave devices that I swap out at times and the new device just replaces the old one and no changes needed.

The history and stats database all work based on entities, too. Which mean you can replace a device and retain history.

Pain is subjective. Are you asking in general for HA or related to entity naming? That's a big topic and there's a few "What I wish I knew.." topics you can search for.

(#1 thing for me was using packages.)

No, I don't bother to be honest. You can go to Devices & services -> Entities and filter by a given entity and see what's tagged with that label. And mine are like "Water Leak Sensors" or "Exterior Door Sensors" so it's kind of obvious. I mostly use them in automations to avoid listing out what entities I want to include.

In general, but I'm greedy so answer as fully as you like :rofl:

Although I have enough to get going, and some. :folded_hands:

FWIW everything I researched and implemented regarding entity/device naming I scrapped 1.5 years after starting with HA. My current takeaway is assign every device to a floor and a room (area) as you add them (I even have an area called 'Sky' for my weather devices/entities) and spend more time deciding what 'labels' to assign to the relevant devices/entities than what you name them. This is essentially the same as what you are trying to do but from a catagorisational perspective and, to me, makes template filtering later on so much easier.

YMMV, some will disagree, it's all good.

Script ID, i.e. the key under which the script is defined.

Under the device page for a specific device. Depending on the radio or protocols used, you'll find even more meta data there.

Depends on the device. Many devices now expose an update entity and the ability to update it from within HA. I find this argument moot.

Same boat as you. To add: when viewing an entity there's a "related" submenu that will show you everywhere it's used.

Actually I find it pretty elegant not to have to use the IP in the name: often when you are on a DHCP network and your device changes it's IP (which might happen), Home Assistant will just continue to work like nothing happened. Most of my IP devices use CoIoT/CoAP or MQTT, so HA will still find them.
If I want to check on a device, I usually just use the "Visit" button on the devices page - it's faster than finding the IP on the router e.g.

I have a handful devices on static IPs, notably my HA server and router (of course). Everything else is on DHCP without issues. Single, flat network (so no mDNS issues) using Unifi gear. Because I have multiple APs, I do fix some devices to stay on a specific one, but that's it.