Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIFX Integration - Multiple Devices Listed Under a Single Light Bulb #92955

Closed
tggman opened this issue May 11, 2023 · 12 comments · Fixed by #98783
Closed

LIFX Integration - Multiple Devices Listed Under a Single Light Bulb #92955

tggman opened this issue May 11, 2023 · 12 comments · Fixed by #98783
Assignees

Comments

@tggman
Copy link

tggman commented May 11, 2023

The problem

On the Integrations page (e.g. https://MYURL/config/integrations), several of my LIFX bulbs list multiple devices when there should only be one device.

A picture is worth a 1000 words ...
image
image
image

So in that example, the Kitchen Bench Z Strip shows 5 devices:

  • Family Room Lamp 1
  • Katy's Dresser Mirror
  • Kitchen Bench Z Strip <- the only one which should be listed!
  • Living Room Lamp 4
  • Tom's Bedside Lamp

This is just a single example. I have many more - but not all my bulbs have this issue.

What version of Home Assistant Core has the issue?

HAC 2023.4.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

LIFX

Link to integration documentation on our website

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

Diagnostics information

config_entry-lifx-a9b30007c673edc8693ca7ec6c0d3720.json.txt

Example YAML snippet

N/A

Anything in the logs that might be useful for us?

Additional information

I deleted one of the offending bulbs from HA and pulled it back in the next day. That fixed the issue, but only for that bulb.

As far as I can tell, this issue is benign from a functionality standpoint. However I, like many others, have several bulbs that cycle in and out (i.e. loose/re-establish their Wi-Fi connections -- become unavailable/available)

I don't know how the filtered device list is generated on the Integrations page, nor do I know if/how it's used downstream. Regardless it's wrong -- and if it is used downstream it could potentially be the root cause of some other potentially stubborn/hard-to-find issues.

@home-assistant
Copy link

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (lifx) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of lifx 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 lifx Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


lifx documentation
lifx source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented May 11, 2023

I'm pretty sure this was from an old bug that was fixed over a year ago. If you delete them all and re-add them, does the problem come back?

@tggman
Copy link
Author

tggman commented May 11, 2023

I have 35 bulbs ... so I wasn't keen on deleting and re-adding them -- but I bit the bullet and just finished fixing them all (deleted/re-added/fixed names and entity_ids). As it stands now, all 35 bulbs have one device. Hopefully it stays that way (I'll let you know)

Comments:
(1) In January 2023 I added 10 NEW LIFX bulbs and most of those bulbs also showed multiple devices. So this is NOT a year old bug that's been fixed.
(2) I swapped out my router a few months back and decided it was finally time to change the WiFi SSID. So I removed them all from the lifx app (cloud) and went thru the onboarding process in the LIFX app. I think HA also re-discovered them as well but can't say with absolute certainty.
(3) The Diagnostics report I included was run for the example/target bulb "Kitchen Bench Z Strip" but when I looked inside the file it only listed the 1st device on the list (Family Room Lamp 1) - which is not correct.

Questions:
Is it possible this issue is causing excessive LAN traffic because it's trying to talk to the target but ends up talking to all the devices listed for that bulb? I don't know sh#t about how the API works but it made me wonder...

@tggman
Copy link
Author

tggman commented Jun 7, 2023

@bdraco this issue occurred again with two of my bulbs - right after a system hang/crash and I was forced to power down HA without doing a proper shutdown. I am therefore keeping this issue open. Note that system crashes of this type are very rare and seem to most often (always?) after a supervisor update.

@Djelibeybi
Copy link
Contributor

Do you have static IP allocations for your LIFX bulbs via DHCP? I've seen this happen when a bulb gets an IP address previously used by a different bulb. I generally advise using static IP address allocations to avoid this (and to improve overall LIFX stability in general).

@tggman
Copy link
Author

tggman commented Jun 8, 2023

Do you have static IP allocations for your LIFX bulbs via DHCP? I've seen this happen when a bulb gets an IP address previously used by a different bulb. I generally advise using static IP address allocations to avoid this (and to improve overall LIFX stability in general).

I do now! Thanks for the tip @Djelibeybi .
I assigned static IPs to all my LIFX bulbs in the past, but in an effort to reduce "complexity", I didn't reassign them when I swapped out my main router last January. Anyhow, as of this morning all my bulbs have a static IP. Again, I really appreciate the tip.

@bdraco
Copy link
Member

bdraco commented Jun 8, 2023

When a device goes offline, and a new device with a different mac gets the same ip address from the dhcp server as the old device we need to abort and refuse to setup if the mac has changed

flux_led had the exact same issue for years:

# The device is offline and another flux_led device is now using the ip address

@Djelibeybi
Copy link
Contributor

Just remember that what aiolifx reports as the MAC address is actually the LIFX serial number and may not match the actual MAC address reported by other integrations, most notibly the UniFi Network integration.

We should be doing device identification based on the LIFX serial not IP address, and should replace the IP address if the serial matches an existing config entry.

@tggman
Copy link
Author

tggman commented Jun 9, 2023

For those of us with multiple routers on the network, it'd be a REAL nice "feature" if the integration provided the SSID and signal strength as attributes (or whatever).

@Djelibeybi
Copy link
Contributor

RSSI is available already, but SSID is not: it's not something the bulb reports via the API.

@bdraco
Copy link
Member

bdraco commented Aug 5, 2023

Tplink issue is the same problem #97457

Maybe we can make a helper for this

bdraco added a commit that referenced this issue Aug 21, 2023
If the DHCP reservation changed and there is now a different LIFX device at
the saved IP address, retry setup later to avoid cross linking devices

fixes #92955
bdraco added a commit that referenced this issue Aug 21, 2023
fixes #97913

If the DHCP reservation changed and there is now a different tplink device at the saved IP address, retry setup later to avoid cross linking devices

Note: this will not fix existing cross linked devices. It will only prevent the problem from happening again. Existing config entries with the issue will have to be removed manually and set up again.

This is a more general problem as #97457 (uplink) and #92955 (lifx) also have the same problem.  This solution is similar to the used in `flux_led` https://github.com/home-assistant/core/blob/3e7ec88703cf724ef29b00732b467704cf66c5e2/homeassistant/components/flux_led/__init__.py#L196 except for ESPHome we allow the name or the mac to change (for device replacement), but not both at the same time.
@bdraco
Copy link
Member

bdraco commented Aug 22, 2023

2023.9.x will prevent the devices from getting cross linked again.

If you have any that are in this state now, you'll have to remove and re-add them, but once you update to 2023.9.x the problem shouldn't ever happen again.

jfroy added a commit to jfroy/core that referenced this issue Aug 23, 2023
aiobafi6 0.9.0 provides support for detecting that a device's UUID does
not match the UUID provided in the Service object. This patch updates
the integration to handle the resulting exception by aborting the config
entry setup.

This resolves a situation where a configured BAF device can be assigned
a new IP address and some other network device is assigned the prior IP
address. If the new device at the IP address is not a BAF device, then
the integration would fail to setup. But if it happens to be a BAF
device, then suddently the config entry would be connected to the wrong
device (i.e. cross-linking).

See also home-assistant#98784, home-assistant#97913, home-assistant#92955, and home-assistant#98807.
jfroy added a commit to jfroy/core that referenced this issue Aug 23, 2023
aiobafi6 0.9.0 provides support for detecting that a device's UUID does
not match the UUID provided in the Service object. This patch updates
the integration to handle the resulting exception by aborting the config
entry setup.

This resolves a situation where a configured BAF device can be assigned
a new IP address and some other network device is assigned the prior IP
address. If the new device at the IP address is not a BAF device, then
the integration would fail to setup. But if it happens to be a BAF
device, then suddently the config entry would be connected to the wrong
device (i.e. cross-linking).

See also home-assistant#98784, home-assistant#97913, home-assistant#92955, and home-assistant#98807.
jfroy added a commit to jfroy/core that referenced this issue Aug 23, 2023
aiobafi6 0.9.0 provides support for detecting that a device's UUID does
not match the UUID provided in the Service object. This patch updates
the integration to handle the resulting exception by aborting the config
entry setup.

This resolves a situation where a configured BAF device can be assigned
a new IP address and some other network device is assigned the prior IP
address. If the new device at the IP address is not a BAF device, then
the integration would fail to setup. But if it happens to be a BAF
device, then suddently the config entry would be connected to the wrong
device (i.e. cross-linking).

See also home-assistant#98784, home-assistant#97913, home-assistant#92955, and home-assistant#98807.
@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants