-
Notifications
You must be signed in to change notification settings - Fork 2
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
"Find Lights" in settings seems broken #1
Comments
It's true. I haven't gotten that part working - mostly because I don't know Python. I just manually entered the values into the text boxes. And the plugin works from there. |
If you'd like it, I'd be more than happy to help you try to get this working! Python is my primary language. Do you just need to speak to cloud.lifx.com using webhooks or is it a more complex matter? sidenote: I was able to get the plugin to interact with my lights, however it didn't use the ID I specified and instead plunged my entire room into darkness 👀 |
Sorry about that - yeah, that was on my to do list, but since I only have a single light - it wasn't a problem for me. So yes, help would be good. Problem 1Your house is being plunged into darkness when the print ends. And I assuming, all the lights come on when the print starts. The reason for that is I tell it to set state on all lights. Check out init.py - that's where everything happens. Specifically see methods handleTurnOffLight and handleTurnOnLight. Ignore the first api call - it's for debugging and listing all available lights. I call the following API: https://api.lifx.com/v1/lights/all/state. The all portion of the URL is called a selector. You can change it to address a specific light by specifying the id (not uuid) of the light. Example: https://api.lifx.com/v1/lights/id:d3b2f2d97452/state Problem 2The Find Lights button does nothing useful. The original intent was to enter the access token and then click Find Lights to list all the available lights in a bootstrap popup, have user select the light they want and populate the light id textbox. However, calling the LIFX api from the client causes a CORS problem, so calling it from the server is the only option. To do that, I'd have to ajax the request to the server (e.g. the plugin running in OctoPrint), have it call LIFX, then return the results to the client. And that's the part that eluded me and since everything "worked fine on my computer", I dropped the ball. The UI for the OctoPrint plugins are made via jinja2 templates. There are specific methods that have to be called (not just an arbitrary ajax call to a method of your choice) in order for OctoPrint to pass the data into your code and I couldn't figure how to tie those templates into API calls to the OctoPrint server. So that's where I left things. This was my first whack at using Python and I basically limped my way to getting the plugin to work. I didn't mean to make this code public, given it's state. The reason I did is that OctoPrint only lets you install plugins off GitHub. And the directory structure of this project is dictated by OctoPrint's plugin architecture . So if you can help, that would be great. |
Expected behaviour:
A list of light IDs for the access token is displayed
Actual behaviour:
Page reloads. When returning to the "Lifx Switch" settings menu nothing has changed.
The text was updated successfully, but these errors were encountered: