-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Refactor LIFX discovery to make it faster and more reliable #70458
Refactor LIFX discovery to make it faster and more reliable #70458
Conversation
I also took the opportunity to reword the various debug log statements so that the connectivity lifecycle is more obvious if you have debug logs enabled. This includes changing the |
This may resolve #68943 as well. |
6006782
to
d533edb
Compare
I've also added additional LIFX models to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for picking up the LIFX integration. Have you considered signing up as code owner?
Let me think about that for a bit. Is there anywhere I can read up about what's involved and what the expectations are from the maintainers? |
@amelchio @bdraco here are the logs that show the huge improvement between the current and updated startup reliability and time for my ~60 LIFX bulb install. I think we should merge this so that we improve things immediately and I'll keep working on it to streamline and optimise it too. |
Would that allow me to replace |
Thank you for your contribution thus far! 🎖 Since this is a significant contribution, we would appreciate you'd added yourself to the list of code owners for this integration. ❤️ Please, add your GitHub username to the For more information about "code owners", see: Architecture Decision Record 0008: Code owners. |
d533edb
to
50dae03
Compare
Done. |
This also eliminates the duplicate ID and missing entity ID errors that are caused by multiple discoveries trying to register the same entity at the same time. I've also added myself as a code owner for the integration as per ADR 0008. Signed-off-by: Avi Miller <me@dje.li>
50dae03
to
f1967c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good but I'm traveling until Wednesday so I can't test them with my LIFX devices
This has been an issue for a while now, so a few more days isn't going to make that much difference. :) |
Ideally we merge this before beta cutoff (sometime before Wed morning) so we can get feedback in beta. We can always revert if it is a problem. @Djelibeybi Would you please move the manifest changes into a new PR so in the rare event we do have to revert it, we won't revert them as well. |
@bdraco Yep, I can do that. |
Manifest changes spun out into #70614 |
I ordered a few more LIFX devices and a switch so I'll be able to test on Wednesday when I get back to Texas |
@bdraco I've officially asked the LIFX team to update the public protocol with the new switch messages: LIFX/public-protocol#6 and I've been talking to folks at LIFX about this directly too. I also have an alternative integration that uses Photons instead of |
I'll check back on this tomorrow as I want to make sure Anders has a chance to look at it before hitting merge. |
Yeah. Well, it's almost the other way around: doing a big change like that requires you to sign up as code owner to make sure you are notified of the inevitable fallout. As a code owner, it's somewhat expected that you track new issues. But you're a volunteer and nobody will hold it against you if you cannot donate enough time to resolve everything. There is no actual rule but in practise being a code owner also means that you get priority in reviews since people will assume that a) you know what you are doing and b) you will be around to fix up any mistakes. |
This is a potentially breaking change but does resolve several duplicate discovery issues caused by the race conditions that occur when mulitiple discoveries happen on the same logical network. Signed-off-by: Avi Miller <me@dje.li>
…assistant-core into refactor-lifx-discovery
I have a couple more comments, just no time to make them right now. But we'll get this into the beta, don't worry about that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me now. Just a few minor comments that you can consider but I am not insisting on any change.
I think you should remove the second paragraph of the Breaking Change note though, it is a bit confusing and contradictory (anything vs. unlikely/most) to me and I don't think it adds much anyway.
@bdraco Are we good to go here or did you want to do tests with your bulbs first? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm traveling and will test it when I get back home tomorrow. Let's merge this now so we get feedback in beta.
I'll ping @Djelibeybi tomorrow if I find anything needs to be adjusted.
Tested with my devices. Works great. No longer missing devices when I remove and readd the config entry |
Signed-off-by: Avi Miller me@dje.li
Breaking change
This PR changes the network adapters used to discover LIFX devices.
Instead of enabling all adapters on which LIFX devices appear, this
PR switches to only using the adapter(s) enabled in Home Assistant.
Proposed change
Currently there is a race condition that occurs when bulbs respond
multiple times to the discovery broadcast and the integration tries
to register the same bulb that's already mid-registering.
This PR adds an in-flight discovery throttle that only allows one
direct connection per bulb at a time to avoid that race condition.
This is faster because there is a limit to how many packets a bulb
can process per second. So, the fewer packets we send, the faster
the bulb can process the ones it receives.
It's more reliable because there are less packets on the network,
less broadcasts over wifi and thus less overall traffic. This allows
us to reduce the amount of message retries as well.
Finally, it eliminates the "does not generate unique ID" error that
was caused by multiple discoveries trying to register the same entity
at the same time but out of order.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: