esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
411 stars 26 forks source link

Request for friendly name for ESPHOME devices to use HA feature to reduce entity names #1741

Open Bascht74 opened 2 years ago

Bascht74 commented 2 years ago

Describe the problem you have/What new integration you would like I can assign the esphome device a name with:

substitutions:
  upper_devicename: "Lampe Aussen Hausbeleuchtung"
  devicename: "lampe-aussen-hausbeleuchtung" #(upper case and space not allowed)
esphome:
  name: $devicename

but I cannot assign a friendly name for Home Assistant: friendly_name: ${upper_devicename} #--> doesn't work

If I give e.g. a light entity a name:

light:
  - platform: binary
[...]
    name: "${upper_devicename} Balkon"

It doesn't show the right way in Home Assistant: image

If I rename the device name into the "friendly one" it works: image

So it would be nice to have a "friendly" device name with uppercase and spaces via the yaml code. That way the look in HA would be much cleaner

Anything in the logs that might be useful for us?

nothing

Additional context It would be an alternative, if the esphome name accepts upper case and spaces and translates to lowe case and "-" were needed.

If you would be able to set an uppercase device name via the yaml you can make use of the truncating in Home Assistant (would be much clearer) Please describe your use case for this integration and alternatives you've tried:

Example YAML snippet

substitutions:
  upper_devicename: "Lampe Aussen Hausbeleuchtung"
  devicename: "lampe-aussen-hausbeleuchtung"

esphome:
  name: $devicename
#  friendly_name: ${upper_devicename} --> missing?

light:
  - platform: binary
    id: light1
    output: relay1
    name: "${upper_devicename} Balkon"
PanicRide commented 2 years ago

+1 x 1000

Most Home Assistant integrations are able to specify a separate entity_id and friendly_name for each entity and it would be very helpful if we could take advantage of that with our ESPHome devices as well.

Of course Home Assistant allows you to override the integration's default friendly name, but it would be much easier to specify that with the rest of the device's ESPHome config so that overriding all of the entities doesn't have to be manually done when connecting it to Home Assistant.

The other way around that is to name the ESPHome entity what you want the friendly name to be instead of a unique identifier. However, when updates need to be made to that name to describe the devices' latest purpose, the entity_id changes as well which breaks dashboard and automation configurations.

I hope this is doable. :)

robloh commented 1 year ago

It looks like this is coming in the next release: https://github.com/esphome/esphome/pull/4296

nagyrobi commented 1 year ago

hooraaayy

vincekovacs commented 1 year ago

As I see, this pull request only allow to add friendly name to device but not for individual entities (switches, lights, inputs, etc).

It is possible to have an entity identifier used in HA regardless of the name?

Like this:

light:
  - platform: binary
[...]
    name: "${upper_devicename} Balkon" // <-- display name in HA
    entity_id: "${devicename}_balkon" // <-- used in HA
bonzai86 commented 1 year ago

+1

I'd love to rename a entity without breaking all dashboards/automations or manually rename within HA.

EmhyrVarEmreis commented 9 months ago

+1 I see that sth was merged. Any idea when it will become available?

functionpointer commented 9 months ago

Friendly name is also used if you set

light:
  - platform: binary
    [...]
    name: None

This marks the entity as the primary for the device. HA will show the friendly name as the name. ESPHome also uses the friendly name as unique_id. HA will use the friendly name as entity id.

This pattern isn't continued when an actual string is set as name. ESPHome will use the string as unique_id. This means we still can't re-use a name on different devices, as the unique_id will clash.

The result is inconistent behaviour: name: None can be set on many devices and works great.
Any other name can't be re-used, even though Lovelace leads you to believe you can (as entity ID and name both include the friendly_name, but the underlying unique_id doesn't).