I’m going a bit crazy trying to get ESPHome to set entities names how I would like. So, according to the light documentation, if I set name to none, I just get an entity as light.friendly_name, but I’m gett light.device_name_friendly_name. Any ideas what I’m doing wrong? Here’s my yaml:
This means that the friendly name is attached to ALL entity names. I suggest you delete the above friendly_name line and enter your name for this switch under the switch entity.
The instructions you posted doesnt make sense… I have probably missed something…
This will add dining room light to all the entities, and, as you have none (should be None) in the light name, the light entity will be Dining Room Light
This means that the friendly name is attached to ALL entity names. I suggest you delete the above friendly_name line and enter your name for this switch under the switch entity.
@JulianDH I thought this would do the trick, just tried it. Deleting the friendly name results in the light being named light.none . And then the device has the less than ideal switch-dining-room as the device name as well (but I could live with that if the light was named correctly.
This will add dining room light to all the entities, and, as you have none (should be None) in the light name, the light entity will be Dining Room Light
@Holdestmade that was the behavior I expected too and is why I’m left scratching my head. Just tried what you posted and I get an entity of light.switch_dining_room_dining_room_light. Actually, testing with other entities, it appears device_name is being added to all names, and when name: none is set, the name is just replaced with friendly_name resulting in device_name_friendly_name. This isn’t expected behavior is it?
And I get light.switch_dining_room_switch_dining_room… Could there be a bug in light entities? Seems unlikely. Idk why I’d be having different behavior. Running esphome 2023.8.3.
Maybe this will help. The Entity ID is built from the domain, name and friendly name.
Valid characters for names are: abcdefghijklmnopqrstuvwxyz0123456789-_ (lowercase, no spaces). Friendly Names must only consist of upper/lowercase characters, the underscore character and numbers. Spaces will be converted to underscore characters.
Is the prepending of <device_name> in the entity name a recent change? I can’t seem to find anything about it in the documentation and there seems to be a lot of conflicting information about online.
If this is the new norm, is there any way to achieve light.<device_name> or light.<friendly_name>? It seems awfully redundant to have to do light.<device_name>_<friendly_name> as the device name and friendly name are generally close to identical.
It seems to be more than that – some things work, some do not, with the use of “name: None”. It is as though that usage was put into some platforms but not others. I have a light that keeps coming out as Flood1_Flood1, no matter what combination of None, none, etc. I put in.
Is this just a flawed implementation, or am I misunderstanding?
This continues to yield entity_id.flood1_flood1 and name “Flood1 Flood1”. I’m trying not to do it by removing the friendly name from esphome as I have a number of git sourced packages that use a friendly name, so my templates (used in both those packages and not) need to be consistent.
“None” just does not seem to consistently work, nor “none”, nor omitting the name field (it disappears from home assistant), nor using an empty quoted string.
Am I missing a syntax?
Linwood
PS. Correction, an empty string gives a name “Flood1” but entity_id of light.flood1_flood1 so not even quite consistent.
PPS. Well, I may have found a workaround. A blank (single character space) in the name field, i.e. ’ ', seems to work. Which is a bit weird. I bet I’m stumbling on a bug in syntax where it’s not empty, but later being blank trimmed. But … for now… it seems to work.
Well, this worked. The entity name did get renamed to nothing, just blank in the settings UI, but the entity id is now correctly populated, and the frontend all displays correctly. Thank you. Will use a space for future esphome configs. At least, until the devs break it again.