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.81k stars 30.06k forks source link

Kasa bulbs report incorrect state when IP address gets reassigned #127012

Open sellison2 opened 9 hours ago

sellison2 commented 9 hours ago

The problem

If you have multiple Kasa bulbs, and one of them gets assigned an IP address that had been previously in use by another, the old device will show an incorrect state.

So for example, I turned on the overhead light in a room in my house, all the bulbs report in with their state: image

The thing is, a bulb in a completely different room erroneously reports that it's on as well: image

The reason is because Kitchen Table Northeast had last used the IP address that Bonus Room Northeast is now using. You can see that by finding it in ~/config/.storage/core.config_entries: image image

This can present several problems. For example, it may cause an area or light to report there's a light active when there isn't one. The biggest frustration is if you have your lights in a group. In this example, if I decide to change all the lights in the kitchen to green, it'll change the single bulb in the bonus room as well.

If I turn on the offending bulb, once it reports in that fixes the status. So if I turned on all the lights in the kitchen, Kitchen Table Northeast will report in with a new IP address, at which point it will no longer mirror Bonus Room Northeast.

I would assume a fix could be to clear out the IP address from the core.config_entries when a new device checks in with that same IP address. It seems there's no issue updating the IP address when the bulb comes online with a new one.

What version of Home Assistant Core has the issue?

core-2024.9.0

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

TP-Link Smart Home

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 9 hours ago

Hey there @rytilahti, @bdraco, @sdb9696, 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!

Code owner commands Code owners of `tplink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tplink` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tplink documentation tplink source (message by IssueLinks)

sellison2 commented 9 hours ago

I want to point out this can also prevent adding a new Kasa device. If I bring a brand new Kasa device online, and it gets assigned the IP address of an existing device, HA will fail to add it with "device already exists". So then I have to pop into core.config_entries, find what HA currently thinks should use that IP address, turn that device on, wait for it to get a new IP address, and then I can successfully add the new device.