Naming Entities in Home Assistant
TL;DR
✅ Name your entities simply and generically:
<where>_<who>_<what>
These can come in any order or format, but keep them consistent.
e.g. living_room_lamp
, office_computer_plug
, bedroom_ceiling_light
, ross_phone
❌ Avoid entering software, protocols, or brands:
e.g. tasmota_office_light
, mqtt_shelly_1_hallway
, bedroom_hue_lamp
, ross_samsung_s8
all these are real examples regrets of my own
Why?
Keeping entity names simple and generic will allow you to change and upgrade your devices without the headache of searching through all your automations, configs, and apps to update entity names.
In the beginning
I started incorrectly naming my devices a year ago. I invented problems that I imagined I’d have in the future and pre-emptively fixed them.
I pre-pended mqtt_
and zigbee_
to device names, so I knew where I could configure them. This became annoying when I would search for "bedroom”, and I would completely overlook the mqtt_<x>
entities. It’s deeper down the list and I’ve pushed the useful information to the end of the string, so it’s easy to do. I would hastily and haphazardly go hunting down an entity before saying, "Damn, why’d I name it like that?”
I would write large sharpie letters (A
, B
, C
...) on plugs and name the entities tasmota_plug_a
, etc. I could now quickly identify my devices, should I ever need to move them. It turns out that once I had a few devices, I wouldn’t move them around like I did when I was first experimenting, so this was a classic preemptively fixed non-problem.
The sharpie letters have actually been helpful now and again, and I would recommend everyone naming their devices. Just don’t include that physical name in the entity name, and instead store it in extra metadata somewhere else. I keep a Notion database with my devices, IP addresses, and notes for this reason.
Snake case
I name everything with underscores, so there are no surprises when HA converts the name to snake case—allowing me to search quickly, finding my entities via HA’s e
shortcut without worrying about formats.
When needed in Lovelace, there is usually an option to provide a custom label on top of the name.
The only exception is when the config allows for an additional friendly name. In which case, I will provide that in a "Pretty format” to save an extra step when configuring in Lovelace.
Quick tip
If you’re struggling to name an entity and have a few choices, favour the that one you thought of first. It’s likely the one you’ll first search for later.