WTH no entity and friendly names freedom when creating mqtt entities

Dude, are you not reading my explanations?

You have the device name in your entity name, it will duplicate it. Remove the device name from the enitty name.

i.e. this:

should just be

        name: "Phase 5 Power"

keep everything else the same.

No matter what your FriendlyName will always be DeviceName EntityName. All of HA does this, not just MQTT

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.

again, the friendly name in HA determines the entity_id. So yes, we are talking about the identifiers.

But once we enforcing identifier providing object_id, it’s not the case anymore.

That doesn’t matter, the naming does not come from the MQTT integration, it comes from HA as a whole.

All the integration sets is device name, entity name. MQTT has the unique ability to set the object_id, which no other integration is allowed to set.

HA (not mqtt) assigns entity_id’s and friendly names based on the 2 inputs, device name and entity name.

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.

Again… if object_id is provided, entity_id is created after object_id.
So all requirements are fullfiled.

BTW Friendly name being concatenation of device name and entity name is just BAD design decision. It gives 2 uncomfortable options.

  1. either you have very long friendly names, mostly not fitting GUI), or
  2. friendly names which are indistinct from other ones.

… until you change it manually using the GUI. No option to automate setting friendly name is the problem.

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.

Different approach:

  • is it possible to get service changing friendly name?
  • could be possible to call such a service from the package?

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.

Then we face consequences of wrong design decisions from the past (the complexity you mention unveils that)

I’m sure it could be done, however it wouldn’t be added to core. Frenck would likely add it to spook.

It already has a service to change the entity_id.

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.

Thank you for your assistance.

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?