home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.65k stars 29.94k forks source link

Problems with TP Link Kasa integration when devices are renamed #68603

Closed madbrain76 closed 1 year ago

madbrain76 commented 2 years ago

The problem

I have a number of Kasa smartplugs that I move around the house. I rename them in the Kasa app, since I use both HomeAssistant and the Kasa app.

HomeAssistant partially synchronizes the new device names from Kasa, but not in all places in the GUI, unfortunately. The name synchronization behavior is better after a restart of HAOS, vs if it is not restarted, but it is still incomplete, unfortunately. The old names persist in several locations. They can be fixed manually, but this is very tedious with numerous devices.

  1. Here is what happens when I first add the TP Link Kasa integration to Home Assistant. It discovers all the devices on my network. MAC addresses have been cut.. image
  2. Select the "Home theater left" device and assign it to the "Home theater" area
  3. This is how it looks under Configuration / Devices image
  4. I click on "1 device" and get the following screen . So far, so good. image
  5. Now, go to the Kasa app on Android, and rename this plug to "AP Master bathroom"
  6. Go to the Configuration / Devices screen again in HAOS. The device still looks exactly the same as it did in step 3, ie. it's called Home theater left
  7. Click on "1 device". Now, I get an updated screen. image As you can see, the name under Controls is still "Home theater left" . But the name of the sensors below now all start with "AP Master bathroom"
  8. Type "c" and select "Restart server"
  9. Go to Configuration / Devices again. The device is still called "Home theater left", just as in step 3 .
  10. Click on "1 device". I get yet another updated screen : image In this case, the name under "Controls" has now updated. The name under "sensors" no longer have a prefix.

So, HAOS updates the sensor names in step 7. HAOS updates the control name in step 9 after the reboot. HAOS never updates the device name under Configuration / Devices, unfortunately. I found out how to do it manually after clicking the ... vertical menu, but it took some Google searches to figure that out. It should update it in step 7 and/or 9.

From a user experience perspective, it's very confusing to have a time where the sensors get updated, but not the switch name, as happens in step 7. Those names percolate to other screens, such as Overview, and Automations . It's very confusing. IMO, these names should both be updated at the same time, not independently of each other.

Not having the name update automatically under the Devices screen at all is a serious usability issue if you have lots of Kasa devices. There should be a way to do so, and ideally it should happen at the same time as the switch name and sensor names update, too.

What version of Home Assistant Core has the issue?

core-2022.3.6

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

Kasa

Link to integration documentation on our website

No response

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.3.6", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.9.9", "docker": true, "arch": "aarch64", "timezone": "America/Los_Angeles", "os_name": "Linux", "os_version": "5.10.92-v8", "supervisor": "2022.03.5", "host_os": "Home Assistant OS 7.5", "docker_version": "20.10.9", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.19.3", "requirements": [ "aiogithubapi>=21.11.0" ] }, "wyzeapi": { "version": "0.1.7", "requirements": [ "wyzeapy==0.5.6" ] } }, "integration_manifest": { "domain": "tplink", "name": "TP-Link Kasa Smart", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/tplink", "requirements": [ "python-kasa==0.4.1" ], "codeowners": [ "@rytilahti", "@thegardenmonkey" ], "dependencies": [ "network" ], "quality_scale": "platinum", "iot_class": "local_polling", "dhcp": [ { "registered_devices": true }, { "hostname": "k[lp]", "macaddress": "60A4B7" }, { "hostname": "k[lp]", "macaddress": "005F67" }, { "hostname": "k[lp]", "macaddress": "1027F5" }, { "hostname": "k[lp]", "macaddress": "403F8C" }, { "hostname": "k[lp]", "macaddress": "C0C9E3" }, { "hostname": "ep", "macaddress": "E848B8" }, { "hostname": "k[lp]", "macaddress": "E848B8" }, { "hostname": "k[lp]", "macaddress": "909A4A" }, { "hostname": "hs", "macaddress": "1C3BF3" }, { "hostname": "hs", "macaddress": "50C7BF" }, { "hostname": "hs", "macaddress": "68FF7B" }, { "hostname": "hs", "macaddress": "98DAC4" }, { "hostname": "hs", "macaddress": "B09575" }, { "hostname": "hs", "macaddress": "C006C3" }, { "hostname": "ep", "macaddress": "003192" }, { "hostname": "k[lp]", "macaddress": "003192" }, { "hostname": "k[lp]", "macaddress": "1C3BF3" }, { "hostname": "k[lp]", "macaddress": "50C7BF" }, { "hostname": "k[lp]", "macaddress": "68FF7B" }, { "hostname": "k[lp]", "macaddress": "98DAC4" }, { "hostname": "k[lp]", "macaddress": "B09575" }, { "hostname": "k[lp]", "macaddress": "C006C3" }, { "hostname": "lb", "macaddress": "1C3BF3" }, { "hostname": "lb", "macaddress": "50C7BF" }, { "hostname": "lb", "macaddress": "68FF7B" }, { "hostname": "lb", "macaddress": "98DAC4" }, { "hostname": "lb", "macaddress": "B09575" } ], "loggers": [ "kasa" ], "is_built_in": true }, "data": { "device_last_response": { "system": { "get_sysinfo": { "sw_ver": "1.0.18 Build 210910 Rel.141202", "hw_ver": "1.0", "model": "KP115(US)", "deviceId": "REDACTED", "oemId": "REDACTED", "hwId": "REDACTED", "rssi": -57, "latitude_i": "REDACTED", "longitude_i": "REDACTED", "alias": "REDACTED", "status": "configured", "obd_src": "tplink", "mic_type": "IOT.SMARTPLUGSWITCH", "feature": "TIM:ENE", "mac": "REDACTED", "updating": 0, "led_off": 0, "relay_state": 1, "on_time": 1538, "icon_hash": "", "dev_name": "Smart Wi-Fi Plug Mini", "active_mode": "none", "next_action": { "type": -1 }, "ntc_state": 0, "err_code": 0 } }, "emeter": { "get_realtime": { "current_ma": 77, "voltage_mv": 119863, "power_mw": 5230, "total_wh": 2, "err_code": 0 }, "get_monthstat": { "month_list": [ { "year": 2022, "month": 3, "energy_wh": 2161 } ], "err_code": 0 }, "get_daystat": { "day_list": [ { "year": 2022, "month": 3, "day": 1, "energy_wh": 131 }, { "year": 2022, "month": 3, "day": 2, "energy_wh": 355 }, { "year": 2022, "month": 3, "day": 3, "energy_wh": 540 }, { "year": 2022, "month": 3, "day": 4, "energy_wh": 53 }, { "year": 2022, "month": 3, "day": 5, "energy_wh": 14 }, { "year": 2022, "month": 3, "day": 6, "energy_wh": 2 }, { "year": 2022, "month": 3, "day": 15, "energy_wh": 107 }, { "year": 2022, "month": 3, "day": 16, "energy_wh": 112 }, { "year": 2022, "month": 3, "day": 17, "energy_wh": 123 }, { "year": 2022, "month": 3, "day": 18, "energy_wh": 124 }, { "year": 2022, "month": 3, "day": 19, "energy_wh": 111 }, { "year": 2022, "month": 3, "day": 20, "energy_wh": 124 }, { "year": 2022, "month": 3, "day": 21, "energy_wh": 125 }, { "year": 2022, "month": 3, "day": 22, "energy_wh": 125 }, { "year": 2022, "month": 3, "day": 23, "energy_wh": 115 } ], "err_code": 0 } } } } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

tplink documentation tplink source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @rytilahti, @thegardenmonkey, mind taking a look at this issue as it has been labeled with an integration (tplink) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

madbrain76 commented 2 years ago

Note that even if the device name is manually renamed under Configuration / Devices, the entity ID continue to show the old sensor names, even after a reboot of HAOS, also.

image

madbrain76 commented 2 years ago

Regardless of the bot's actions, the issue is not solved, and IMO, shouldn't be closed.

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

madbrain76 commented 2 years ago

This is not resolved.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

rytilahti commented 1 year ago

I hope the linked PR fixes this issue, at least my entities are now renamed properly when the name is changed in the UI. And if the name was not changed previously, the new name set using the kasa cli tool (or the app) seems to propagate correctly at least after rebooting homeassistant.

Note, that changing the device name outside homeassistant will only change the user-visible names inside homeassistant, the existing entities are not renamed (but would be, if you remove and re-add the device).

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

mydevpeeps commented 1 year ago

still an issue with latest build. renamed and now I have duplicate items...

rytilahti commented 1 year ago

The linked draft PR should fix this, but I haven't found time to figure out what needs to be changed and to fix it. If someone wants to step in and do that, that would be great!