It’s conincidence.
I want to have device name, which describes the device, and want to have explanatory to my needs Friendly Name.
The fact that both names begins with Shelly 3EM is conincidence.
And yes… decission to ALWAYS create friendly names with concatenated device name and entity name, or at least giving no option to override that is just a flaw.
Do you know how many devices I have that will get this indistinct “Phase X” on dashboards and everywhere?
And that will not change, it’s the entire design system for devices & entities in HA, and it’s needed specifically to address issues with duplicate names in the thing you love, YAML.
Actually it’s not.
We are talking about friendly names, not identifiers.
Identifiers are already managed by object_id and nobody complained about that.
We cannot influence friendly name, which form does not any harm to the rest of the system.
This is very undistinct answer. Like it comes from atoms thus not gonna change.
You said that the name is source for entity_id. No - it’s not if object_id is provided.
So, it’s would be enough to not concatenate it with Device name to create Friendly Name.
Or if object id is given, and no name is given. Create a friendly name from object id -but it’s a dirty workaround I don’t like.
Now you get it. It’s not going to change. Largely because of yaml. Maybe when configuring via yaml is completely removed we might get something different. But because unique_id isn’t required, and the entities come from yaml, the entity_id is what matches the config to the entity and there’s nothing we can do about it.
Otherwise there be a wth with a huge amount of upvotes with the _# naming convention that rarely appears now. It would be way more prevalent if these restrictions were removed.
And just to clarify, the change would have to happen outside the MQTT integration for this to work for MQTT. And the change would be applied to all integrations, breaking everything.
I know what you think the problem is, I know the system and I know why it’s in place. You are ignoring my explanations. What you want is not going to happen. It’s either a massive breaking change for all yaml integrations, or a massive breaking change for UI entities, or a massive breaking change for both.
It cannot be applied just to the MQTT integration.
The design decision of the past was wanted by everyone. They did not want to manually set the object_id and name back in the beginning when only yaml was available. They wanted to only set the name. You can thank your fellow users for that one when HA first came out. To put this into perspective, I started using HA in december 2015/jan 2016 and this system was already in place. The first commit was end of 2013 IIRC.
I found a workaround, but satisfying at that moment.
I can use customize within packages.
So this way I have the ability to set a friendly name, just below sensor definitions. It’s not within the sensor definition but not far from this place.
example:
pkc_test:
mqtt:
sensor:
- object_id: "shelly_3em_phase_6_power"
unique_id: shelly_3em_phase_6_power
state_topic: "shellies/shelly3em/emeter/1/power"
unit_of_measurement: "W"
device_class: power
device:
connections: [["mac", "34:94:54:7b:97:16"]]
name: "Shelly 3EM MainHouse"
homeassistant:
customize:
sensor.shelly_3em_phase_6_power:
friendly_name: My Exclusive Entity Name
Obviously, if more sensors are declared in the file, homeassistant/customize section has to be below them all.
Like MQTT manually configured entities, customization yaml can be reloaded manually too.
…except the Device page doesn’t respect the customization of Friendly Name.
I declared the sensor with object_id and unique_id, intentionally without name. instead, I set friendly_name in the customize section. I can see in dev tools, that the friendly name is set. But the device page shows only “Voltage” or “Power” which is a result of a missing name in the entity declaration.
To make it clear: if I add name, then it’s shown on the device page but nowhere else.
I can add name just for the sake of showing names properly but the question is could it be considered as a bug to raise the issue against? Or it’s intentional?
Petro, what do you think?