WTH no entity and friendly names freedom when creating mqtt entities

It basically is:

also:

Integrations that communicate with devices and/or services are only configured via the UI. In rare cases, we can make an exception.

Tell me how can I create mqtt entity using GUI. None? Then it’s space to make the exception.

4 years after this document was created, yaml-based mqtt entities still are supported. If supported, and some shortcomings are found, they deserve to be worked on. This is what I’m asking for.

A lot of things were stated as impossible in the past, but then changed (or at least some of them changed their mind about impossibility). So let this question open, please.

You can only upvote a WTH, there’s no downvote button. And anyone can voice their opinion, no? That doesn’t necessarily affect what the devs do with the request.

Maybe I’m taking crazy pills here but I’ve never had a problem with this, I always supply unique_id, object_id, device name, and name. The configuration always takes all 4 and properly uses them without overwriting anything.

unique_id: 832389f9zs8dflaehf9pafeialjhfnalskeejhf
object_id: shelly_3em_phase_6_power
name: MainHouse
state_topic: "shellies/shelly3em/emeter/1/power"
unit_of_measurement: "W"
device_class: power
device:
  connections: [["mac", "xxxxxxxxxx"]]
  name: Shelly 3EM

Will result in a device name of Shelly 3EM an entity name of Shelly 3EM Mainhouse with an entity_id of sensor.shelly_3em_phase_6_power.

I have a number of entities where I alter all 3 and all 3 have different values. They aren’t “ignored”.

e.g. Here’s my discovery info

{
  "name": "Day Cycle",
  "unique_id": "front_yardds",
  "object_id": "front_yard_day_cycle",
  "state_topic": "homeassistant/number/front_yardds/state",
  "command_topic": "homeassistant/number/front_yardds/state",
  "command_template": "{{ value }}",
  "min": 1,
  "max": 10,
  "unit_of_measurement": "days",
  "device": {
    "name": "Front Yard Sprinker Cycle",
    "identifiers": [
      "front_yard"
    ],
    "manufacturer": "Petro"
  },
  "retain": true
}

Here’s my resulting entity:

Showing device name as Front Yard Sprinker Cycle and an entity name of Day Cycle

With the entity_id matching my configured object_id number.front_yard_day_cycle

maybe this is why the mqtt portion of my configuration is the longest part of my configuration

Discovery? Where can I get this info from to verify?

You know… I’ve never had problems with yaml mqtt. I started to used devices not long ago. And didn notice such thing. but with this particular device HA makes up unexpected names. (stripping phase X out of initial text)

So this is real example. I’m adding just another yaml entries to existing device (see unrealistic phase number).

here are 3 combinations

pck_power_metering:
  mqtt:
    sensor:
      - object_id: "shelly_3em_phase_1_power"
        name: "Shelly 3EM Phase 1 Power"
        unique_id: shelly_3em_phase_1_power
        state_topic: "shellies/shelly3em/emeter/0/power"
        unit_of_measurement: "W"
        device_class: power
        device:
          connections: [["mac", "XXXXXXXXX"]]
          name: "Shelly 3EM MainHouse"
          configuration_url: "http://192.168.107.75"
          manufacturer: "Allterco Robotics"
          model: Shelly 3EM
          model_id: SHEM-3

      - object_id: "shelly_3em_phase_5_power"
        name: "Shelly 3EM Phase 5 Power"
        unique_id: shelly_3em_phase_5_power
        state_topic: "shellies/shelly3em/emeter/1/power"
        unit_of_measurement: "W"
        device_class: power
        device:
          connections: [["mac", "XXXXXXXXX"]]

      - 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", "XXXXXXXXX"]]

      - name: "Shelly 3EM Phase 7 Power"
        unique_id: shelly_3em_phase_7_power
        state_topic: "shellies/shelly3em/emeter/1/power"
        unit_of_measurement: "W"
        device_class: power
        device:
          connections: [["mac", "XXXXXXXXX"]]

So it’s either build the friendly name from device name and entity name, or just makes up the name from unknown pattern (without phase X - see example with phase 6)

Or it’s me who hallucinating?

Here is another entity with the device definition


You aren’t providing device name in any of them…

It also looks like you overwrote the friendly name manually.

Added device definition to above post.

no, I’m not touching GUI. Those entities are just created by hitting reaload of “Manually configured mqtt entities”

The result of this would be:

entity_id of sensor.shelly_3em_phase_1_power because of object_id: "shelly_3em_phase_1_power". The device name will be Shelly 3EM MainHouse because of device: name: "Shelly 3EM MainHouse" and the friendly_name will be Shelly 3EM MainHouse Shelly 3EM Phase 1 Power because of name: "Shelly 3EM Phase 1 Power"

What you should have done was…

pck_power_metering:
  mqtt:
    sensor:
      - object_id: "shelly_3em_phase_1_power"
        name: "Phase 1"
        unique_id: shelly_3em_phase_1_power
        state_topic: "shellies/shelly3em/emeter/0/power"
        unit_of_measurement: "W"
        device_class: power
        device:
          connections: [["mac", "XXXXXXXXX"]]
          name: "Shelly 3EM Mainhouse"
          configuration_url: "http://192.168.107.75"
          manufacturer: "Allterco Robotics"
          model: Shelly 3EM
          model_id: SHEM-3

and you’d end up with:

entity_id: sensor.shelly_3em_phase_1_power
device name: Shelly 3EM Mainhouse
name: Shelly 3EM Mainhouse Phase 1

And when you looked at the device page, it would show Phase 1.

TLDR: You odd naming comes from the fact you’re putting the device name in the entity name.

The naming structure in all of HA, not just MQTT is:

DeviceName EntityName for friendly names of entities. If the DeviceName is in the EntityName, your entity_id and Friendly Name will have double DeviceName. The entity_id is derived from the resulting Friendly Name.

MQTT has the unique ability to override the entity_id in all cases by supplying object_id.

First to say: I really appreciate you entered discussion about this problem. Thank you.

Yes I know that.
It’s all might be generalized to a request to allow overriding the friendly name from yaml too. (I remember there were such requests in the past)

Still we don’t know answer, why Phase X is being stripped from friendly name. It seems like a bug. it looks like Device Name Device Class. Or I’m overlooking something.

PS. I have no certainty about phase 1 entity is not touched through GUI. This is why I’m creating examples with further phase numbers.

That won’t happen. Sorry.

Show me the config entry for the entity where you say phase x is being removed.

config/.storage/config_entries → then search for shelly_3em_phase_1_power

Also, share a screenshot of that entity in developer tools → states page.

It’s a few posts above:

See example for phase 6 (there is source code and screenshot from developer tools)

I need to see the config entry.

and just so you understand, you don’t have a name for that

      - 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", "XXXXXXXXX"]]

so at most it will get the name from the device.

Remember, object_id only overrides the entity_id, nothing else.

So to me, already there’s no mystery why phase 6 is missing, because you don’t have it in the name.

OK. But the name is given in excample “Phase 5”. And the name is ignored. Or rather… it’s concatenated with the device name.

Simply there is no way how to define final version of friendly name in yaml, if device name is set.

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.