Define a friendly name in esp home addionally to the entity-id ('name')

Hi there,

is it possible to define a friendly name addionally to the “name” in esp home?

I don’t mean the friendly name for the esp device, i mean all the switches, sensors etc. belonging to that esp.

I would like to have an entity id and a separate friendly name. At the moment there is only the possibility of “name” in esp home, which is both entity id and friendly name in home assistant.

Is there a solution yet?

I might be misunderstanding your question, but the screen grab you show is not from ESPHome but from Home Assistant: it shows the Properties in Home Assistant of a specific entity that comes from an ESPHome device.

When you leave the “Name” field in this Properties window empty Home Assistant will automatically use the name as defined in the ESPHome yaml file.
You can see this when you just click in the empty Name field: it will show the defined name.
When you fill this field with some other name it will be used instead of the ESPHome name.

In the ESPHome yaml file you can indeed define a friendly_name.
This can be used as name for the device, but it can also be used as pre-fix for the ESPHome entities. See: ESPHome Core Configuration variables.
You can also define a “id” for sensors in the ESPHome yaml file, which can be used internally in the ESPHome code. See: Base Sensor Configuration.

This is an example of how this could be done in the ESPHome yaml file:

esphome:
  name: espdevicename

substitutions:
  friendly_name: NiceName

sensor:
  - platform: bme280
    temperature:
      name: $friendly_name BME280 Temperature
      id: espdevicename_bme280_temp
      oversampling: 16x
    pressure:
      name: $friendly_name BME280 Pressure
      id: espdevicename_bme280_pres
    humidity:
      name: $friendly_name BME280 Humidity
      id: espdevicename_bme280_humi
    address: 0x76
    update_interval: 60s

  - platform: template
    name: $friendly_name BME280 Temperature Fahrenheit
    lambda: |-
      return (( id(espdevicename_bme280_temp).state * 1.8 ) + 32 );

For instance the entity for the BME280 temperature sensor will be named “NiceName BME280 Temperature“ in this case.
The id in the yaml file is used to define an extra sensor giving the temperature in Fahrenheit.

Is this what you are looking for?

1 Like

What @thusassistint said - a name defined on the ESP sensor is the friendly name:

binary_sensor:
  - platform: gpio
    pin: D6
    name: "Office PIR"  
    device_class: motion

I understand what you are saying, but I thing I didn’t describe the problem clear enough.

In HomeAssistance I have an Entity ID and a friendly name. I would like to have the same possibilities with ESP Home, so that when I’m integrating the esp in home assistant, I don’t need to rename every entitie.

Explanation:
I have a bigger garden with around 40 water valves. All of them are controlled by different ESP-Home-Devices (same software-code, just different name), which have each around 50 entities (switches, time-sensors / duration-templates etc. for each water valve etc.)

All of them are prefixed with the name of the ESP like “irrigation_south_valve_01”, “irrigation_south_valve_02”… etc.

In my homeassistant-dashboard, I don’t want to have shown all those long names with the prefixed name, I just want to have a dashboard-tab for lets say irrigation south and in that tab alle the Valves with a short or friendly name: “Valve 1”, “Valve 2” etc.

At the moment I have to give all of the 200+ entities in home assistant a friendly name to change the name from “irrigation_south_valve_01” to “Valve 01”.

I would like to give all of the entities friendly names inside of esp home, which would be much more easier instead of having the trouble of renaming each entites with a friendly name within home assistant.

Do you understand what I mean?

image

Does the suggestion of @zoogara work for you? Use your ESPHome name as the friendly input. I can see your problem where you have multiple entities on one zone; but not all those entities will show up on your dashboard as they WILL need unique names for background automations etc. Somebody might have a better solution

unfortunately it does not work, because than I have the same name three or four times in home assistant.

Thats why I have the espname prefixed on every entity, so I know which entity belongs to which esp device.

Why Isn’t possible to add to every sensor, switch, binary etc. component in esp home another optional possibility with ‘friendly name’?

It would be similiar to the other settings like ‘icon’, ‘unit of measurement’ or ‘category’

Ok - so you have the same name on several ESPhome devices, so HA is forced to create a unique ID because it can’t handle duplicates.

Do what @thusassistint said and use substitutions. Prefix the name: in ESPhome with the name of the device, or some other unique identifier. Your code will be the same on every device except for the substitution value.

If you think the suggested methods don’t provide what you want put a feature request in…