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

Getting no bulbs, trying to use with ambience #160

Closed
ghost opened this issue May 1, 2021 · 20 comments
Closed

Getting no bulbs, trying to use with ambience #160

ghost opened this issue May 1, 2021 · 20 comments

Comments

@ghost
Copy link

ghost commented May 1, 2021

Im getting the issue listed here, https://github.com/LukaJankovic/Ambience/issues/3 if I put this in terminal
$ python3
Python 3.9.2 (default, Feb 20 2021, 00:00:00)
from lifxlan import *
print(LifxLAN().get_lights())

I get
[]

My lifx bulbs are on the same network.

@mclarkk
Copy link
Owner

mclarkk commented May 1, 2021

What OS are you on? Are you also on Fedora like the original poster of that issue? Is your network setup pretty normal? What is the prefix of your network's local address? (e.g., 192.168.1.x, 10.0.0.x)

There was a recent pull request that changed the way that the library gets the local network address for broadcasting the discovery message. Historically that functionality has had a lot of problems working consistently on every operating system. The code finally got to a place where it was working fine, but it required a third-party library called netifaces that was annoying for people to install, so I recently accepted a pull request to change the code (#129). It's hard to know right now what is causing your issue given the lack of output, but I have my suspicions and I would definitely start by seeing what the output of get_broadcast_addrs() is (in device.py).

Sorry I can't be of better help right now -- finishing up my dissertation over the next week. I can only provide high-level guidance about where the problem might be until the dissertation is filed. Let me know what you find and I'll try to follow up.

@ghost
Copy link
Author

ghost commented May 1, 2021

I am on Pop!_Os which is an ubuntu fork. My bulbs are on 192.168.1.x. Not sure how to get the output of get_broadcast_addrs(), would I have to put it in an IDE?

@mclarkk
Copy link
Owner

mclarkk commented May 1, 2021

Run this code however you'd prefer:

from lifxlan import *
print(device.get_broadcast_addrs())

What does it print out?

@ghost
Copy link
Author

ghost commented May 1, 2021

it prints out ['192.168.1.255']

@mclarkk
Copy link
Owner

mclarkk commented May 1, 2021

Great! So that's not the issue. What does this print out?

from lifxlan import *
lan = LifxLAN()
print(lan.get_devices())
print("---")
print(lan.lights)
print("---")
print(lan.devices)

@ghost
Copy link
Author

ghost commented May 1, 2021

print(lan.get_devices())
[<lifxlan.device.Device object at 0x7ff28d397f10>, <lifxlan.device.Device object at 0x7ff28d397d90>, <lifxlan.device.Device object at 0x7ff28d397ee0>, <lifxlan.device.Device object at 0x7ff28d397f70>, <lifxlan.device.Device object at 0x7ff28d32d130>, <lifxlan.device.Device object at 0x7ff28d32d220>, <lifxlan.device.Device object at 0x7ff28d32d1c0>, <lifxlan.device.Device object at 0x7ff28d32d100>]
print("---")
'---'
print(lan.lights)
[]
print("---")
'---'
print(lan.devices)
[<lifxlan.device.Device object at 0x7ff28d397f10>, <lifxlan.device.Device object at 0x7ff28d397d90>, <lifxlan.device.Device object at 0x7ff28d397ee0>, <lifxlan.device.Device object at 0x7ff28d397f70>, <lifxlan.device.Device object at 0x7ff28d32d130>, <lifxlan.device.Device object at 0x7ff28d32d220>, <lifxlan.device.Device object at 0x7ff28d32d1c0>, <lifxlan.device.Device object at 0x7ff28d32d100>]

I put quotes around --- to prevent github from putting a line

@ghost
Copy link
Author

ghost commented May 1, 2021

Is it recognizing my lights as devices?

@mclarkk
Copy link
Owner

mclarkk commented May 1, 2021

Ah ha! That's great, so the network-based discovery is working, whew!

In lifxlan, everything that gets discovered is labeled a device by default. A device only gets tagged as a light as well if its product ID shows up in the light_products list in this file: https://github.com/mclarkk/lifxlan/blob/master/lifxlan/products.py

(You can see the product ID when you print out the device, e.g. with print(lan.get_devices()[0]). I would be interested in knowing the product IDs for the devices that aren't being recognized as lights!)

That products.py file was updated recently. If your version of lifxlan is older than 1.2.6, it would be a good idea to upgrade or reinstall it now. If you installed via pip, pip show lifxlan will print out the version info. If it's not 1.2.6, there's a good chance the products.py file is out of date and upgrading/reinstalling lifxlan will fix your problem.

@ghost
Copy link
Author

ghost commented May 1, 2021

No its 1.2.6, I also dont know why it wouldn't show its just A19 bulbs. When I use this print(lan.get_devices()[0]) it says Product: 93 (Unknown product) and Version: 67305733

@ghost
Copy link
Author

ghost commented May 1, 2021

Your list on products.py is missing 93? I have A19 lifx color bulbs.

@ghost
Copy link
Author

ghost commented May 1, 2021

I put lifx white bulbs in that I had that I was going to return and that shows up in ambience although only with the on off function, no dimming or anything, so the program is working just not with my a19 bulbs

@ceboxsell
Copy link

As a suggestion I find it best to download the code from GitHub and install locally. It ensures the latest is installed. I then use the Hello world script to test.
From my limited knowledge I think this would be best for you.

@mclarkk
Copy link
Owner

mclarkk commented May 1, 2021

Wow yeah, product 93 is missing somehow. That shouldn't happen, especially since we switched to generating products.py directly from LIFX's products.json using an automatic script! I'll look into it.

@mclarkk
Copy link
Owner

mclarkk commented May 1, 2021

All right, I updated both the source on Github and also the version on pip, so however you installed lifxlan, upgrade it and let me know if it works now @Arndorferd!

@ghost
Copy link
Author

ghost commented May 2, 2021

I cant seem to upgrade it, I installed by source. I cant really find a way to uninstall the old one either.

@mclarkk
Copy link
Owner

mclarkk commented May 2, 2021

To upgrade from source, navigate into the root lifxlan folder and do git pull to get the latest source. To install the newly updated code, run python setup.py install in that same root folder.

@ghost
Copy link
Author

ghost commented May 2, 2021

Idk what you mean by root lifxlan folder, I tried just downloading the file off of here and doing python setup.py install in it. Its still the same issue but, pip show lifxlan shows 1.2.6 and not 1.2.7 so not sure if it updated.

@mclarkk
Copy link
Owner

mclarkk commented May 2, 2021

Did you ever install lifxlan via pip, perhaps when following the instructions for Ambience? Ambience may also have installed lifxlan through pip automatically.

If lifxlan was ever installed by pip, then Python will still be using the pip version. You should upgrade the pip version by running pip3 install --upgrade lifxlan. If you really want to install from source for some reason let me know and I can help you uninstall the pip version, but I suspect that just upgrading the pip-installed one is going to be easier.

@ghost
Copy link
Author

ghost commented May 2, 2021

This is working at least in that its showing up as lights with,

from lifxlan import *
lan = LifxLAN()
print(lan.get_devices())
print("---")
print(lan.lights)
print("---")
print(lan.devices)

however ambience is still not showing them, perhaps the issue is still an issue with Ambience.

@mclarkk
Copy link
Owner

mclarkk commented May 2, 2021

Great! Glad to have helped.

If Ambience isn't working there could be a number of reasons why. I would recommend uninstalling it and reinstalling it fresh first, and if that still doesn't work post an issue on their repo.

@mclarkk mclarkk closed this as completed May 2, 2021
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

No branches or pull requests

2 participants