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

Enhanced bulb scanning #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

arktronic
Copy link

The current code uses <broadcast>, a.k.a. INADDR_BROADCAST, to scan for bulbs. I found that this doesn't work in all situations (including mine) due to the limitations of such broadcasts.

In this PR I changed the code to use the netifaces package to find all interfaces, get their IPv4 broadcast address(es), and use them to broadcast the device discovery message. If netifaces is unavailable or if for some reason it can't find any broadcast addresses, the code falls back to using <broadcast>.

I preemptively apologize for any non-Pythonic code here; Python isn't something I use every day 😄

Code now tries using real interface broadcast addresses instead of relying
on '<broadcast>', which has serious limitations associated with it. A
fallback to previous behavior was implemented as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant