xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"

Home Page:https://xzetsubou.github.io/hass-localtuya/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Renaming *Device Name does NOT rename already configured entities.

LoznOz opened this issue · comments

LocalTuya Version

3.2.5.2

Home Assistant Version

HAOS Core 2024.5.1

Environment

  • Does the device work using the Home Assistant Tuya Cloud component?
  • Is this device connected to another local integration, including Home Assistant and any other tools?
  • The devices are within the same HA subnet, and they get discovered automatically when I add them

What happened?

A bug I think is the right term I've observed, if not a feature request / suggestion. I've been learning how to add new devices to LocalTuya over past weeks on HA. I add a new T & H sensor (for example):
Name device "TH1 Master Bed Local"
then add and configure each entity for this device eg

  1. Temperature, 2. Humidity, and 3. Battery Level.
    Resulting Entities exposed to HA are named "sensor.th1_master_bed_local_temperature" etc as I would expect.

The Issue is when I decide / realise a problem with Naming and change original name I used:
say "TH1 Master Bed Local" to just "TH1" - done via LocalTuya 'Reconfigure existing device" - and then ONLY changing the 'Device name*' field, and accepting as is all other settings as the are till done (as they are correct).

Resulting Entities exposed to HA REMAIN previous name eg "sensor.th1_master_bed_local_temperature" NOT "sensor.th1_temperature" as I logically expected.

I have further found if one deletes a configured entity (by unticking in LocalTuya > Configure device connectivity , (first screen) then complete then go back into LocalTuya Configure existing device and add back same, just deleted entity with exactly same information as it was setup with before deleting, LocalTuya now correctly picks up the current 'Device name*' and correctly names the newly recreated Configured Entity as it should, eg using my example "sensor.th1_temperature".

Steps to reproduce.

with Naming and change original name I used:
say "TH1 Master Bed Local" to just "TH1" - done via LocalTuya 'Reconfigure existing device" - and then ONLY changing the 'Device name*' field, and accepting as is all other settings as the are till done (as they are correct).

Resulting Entities exposed to HA REMAIN previous name eg "sensor.th1_master_bed_local_temperature" NOT "sensor.th1_temperature" as I logically expected.

I have further found if one deletes a configured entity (by unticking in LocalTuya > Configure device connectivity , (first screen) then complete then go back into LocalTuya Configure existing device and add back same, just deleted entity with exactly same information as it was setup with before deleting, LocalTuya now correctly picks up the current 'Device name*' and correctly names the newly recreated Configured Entity as it should, eg using my example "sensor.th1_temperature".

Relevant log output

I can add log and diagnostics but should not be necessary as one readily duplicate issue from my notes above I trust.
Needless to say happy to offer any and all information needed to assist, greatly appreciate world being done on this and extend my thanks.

Diagnostics information.

No response

I know about this, why not change the name from Home Assistant UI better? the reason I didn't think of this it because HA already providing this from UI and handle it much better.

Thanks for reply. I'd be happy to use any programmatic way to change multiple devices and each and all of their respective entities.
I HA I can obviously change a device name, when I do so the change asks
"Do you also want to rename the entity IDs of your entities?"
I confirm yes BUT the entity names are NOT changed. (Rebooted HA etc etc).

[Note to be clear] Entity Friendly name appears to be changed but not the entity name.

Please try this yourself. I did read if the entity names match the Device name they will change, but most of mine do not.

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.