flux_led icon indicating copy to clipboard operation
flux_led copied to clipboard

Enhanced bulb scanning

Open arktronic opened this issue 9 years ago • 0 comments

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 :smile:

arktronic avatar Dec 22 '15 08:12 arktronic