mclarkk / lifxlan

Python library for accessing LIFX devices locally using the official LIFX LAN protocol.
MIT License
503 stars 115 forks source link

Device.py def get_label twice. #100

Closed ceboxsell closed 6 years ago

ceboxsell commented 6 years ago

In Device.py on line 136 and 145 def get_label appears.

I found it whilst looking at how I can remove netifaces requirement as this not supported in Jython. Having it is a pain also in windows with the need to have c resources installed to compile in Python 3.

Anyway thought I would mention the double up.

mclarkk commented 6 years ago

Nice catch! Fixed!

I tried to put off including netifaces as a dependency as long as possible, but you wouldn't believe the variance in people's setups. Using netifaces to get the broadcast addresses for all attached subnets completely eliminated all the network-related issues that I previously had not been able to fix for everyone. Netifaces greatly improves the robustness of the library for the common case.

In your case, you can remove netifaces by removing the import statement in device.py and changing get_broadcast_addrs() to explicitly return the broadcast address(es) for your subnet(s), e.g.:

def get_broadcast_addrs():
    return ['192.168.1.255']

If you installed lifxlan via pip at any point, be sure to uninstall it before reinstalling from source.

ceboxsell commented 6 years ago

Thanks. Yes tested the changes yesterday and hard coded the broadcast address for the network I am using it on and all well well. 255.255.255.255 has always worked well for me I guess I am lucky. Thanks

mclarkk commented 6 years ago

Yeah, 255.255.255.255 doesn't work in many situations, as I tragically discovered via Github issues... :'(

Glad you found a fix!!