How to remove renamed entities?

I set up esphome with a thermometre and then wanted to add another, in doing so i renamed the sensors of the first.

Now I get errors in the esphome logs about api disconnects like this: Home Assistant API keeps closing connection · Issue #3108 · esphome/issues · GitHub and I think it is related to the renamed sensors.

When I go to the integrations page, I cannot remove those entities…

You can only remove 0 of the selected 1 entities. Entities can only be removed when the integration is no longer providing the entities. Sometimes you have to restart Home Assistant before you can remove the entities of a removed integration. Are you sure you want to remove the removable entities?

I have tried restarting, to no avail.

Anyone can help please?

Try watchman. You can install it with hacs.

You have to remove the ESP integration for the device then restart before you can remove the entities. And if you do remove the Integration first the entities should be deleted too.

Unlikely.

Thanks for the quick replies. I really appreciate the support. I thought I had this figured out, but then I broke it adding a second sensor. Maybe you can see where I am going wrong?

I ran the watchman service, but it doesn’t show anything:

[core-ssh config]$ cat watchman_report.txt
-== Watchman Report
==
-== Congratulations, all 2 services from your config are available!
= No entities found in configuration files!
Report created on 13 Aug 2022 17:14:37
Parsed 14 files in 0.05s., ignored @ files
Generated in: 0.00s. Validated in: 0.00s.

This is what my entities looks like where I can’t remove them:

This is what my esphome logs loop on:

[17:17:02][C][mdns:084]: mDNS:
[17:17:02][C][mdns:085]:   Hostname: bureau
[17:17:02][C][ota:085]: Over-The-Air Updates:
[17:17:02][C][ota:086]:   Address: bureau.local:3232
[17:17:02][C][ota:089]:   Using Password.
[17:17:02][C][api:138]: API Server:
[17:17:02][C][api:139]:   Address: bureau.local:6053
[17:17:02][C][api:141]:   Using noise encryption: YES
[17:17:13][D][api:102]: Accepted ::FFFF:A00:10
[17:17:13][W][api.connection:068]: ::FFFF:A00:10: Socket operation failed: CONNECTION_CLOSED errno=128

This is my esphome config:

esphome:
  name: "bureau"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "XXX="

ota:
  password: "XXX"

esp32_ble_tracker:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

sensor:
  - platform: pvvx_mithermometer
    mac_address: "A4:C1:38:XXXX"
    temperature:
      name: "Bureau Temperature"
    humidity:
      name: "Bureau Humidity"
    battery_level:
      name: "Bureau Battery-Level"
    battery_voltage:
      name: "Bureau Battery-Voltage"
  - platform: pvvx_mithermometer
    mac_address: "A4:C1:38:YYYY"
    temperature:
      name: "de hors Temperature"
    humidity:
      name: "de hors Humidity"
    battery_level:
      name: "de hors Battery-Level"
    battery_voltage:
      name: "de hors Battery-Voltage"

Go to Settings → Devices & Services. Select your ESP device (I chose my bathroom DHT device)

Press the three dots icon then select delete

Restart Home Assistant.

Check that the old entities are gone. If not delete them (you should be able to now).

Add your ESP device back again. It should have been rediscovered, if not add it manually.

Thanks, that did it!

Unfortunately not. Those entities stubbornly remain despite deleting the integration, the ESPhome config, and rebooting ad-infinitum. Remove option in the entity dialog is grayed out. In my case the entities were removed from an ESP config, but even if that device is removed from ESPhome AND integrations, the orphaned entities still appear and cannot be removed.

The only time I had that issue was when I deleted a device before re-enabling some disabled entities.