core: ESPHome does not handle the case where the name is set to "" and a friendly_name is defined

The problem

Consider the following ESPHome device:

esphome:
  name: portao
  friendly_name: Portão

binary_sensor:
  - platform: template
    name: ""
    device_class: garage_door
    lambda: 'return true;'

When added to Home Assistant, the entity id becomes:

binary_sensor.portao_port_o

Instead of:

binary_sensor.portao

Meaning I have to be aware and fix these inconsistencies by hand.

What version of Home Assistant Core has the issue?

core-2024.12.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ESPHome

Link to integration documentation on our website

https://www.home-assistant.io/integrations/esphome/

Diagnostics information

Notice the binary_sensor. The other entities I fixed already.

config_entry-esphome-01JDTNEKJ0CBYMEY53AAGTS95M.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you, @bdraco, I believe that’s going to fix my issue.