Sawtaytoes / LIFX-Controller

Advanced control over your LIFX lights on your local LAN.
MIT License
8 stars 1 forks source link

Tutorial for the controller and lifx-color-cycle mod? #1

Open neurokinnetix opened 5 years ago

neurokinnetix commented 5 years ago

Could you please be so kind as to make a step by step tutorial for using the controller and/or color-cycle mod that you created. Would love to implement this into my twitch streams. Need a functioning color cycling scene if possible. Thank you so much for your time and contributions on this project.

Sawtaytoes commented 5 years ago

That sounds good. What do you mean by color-cycling scenes exactly?

Do you mean setting up a scene and randomly changing the colors of the lights when that scene is activated, or something else?

neurokinnetix commented 5 years ago

Yes I want to be able to have a scene that makes the lights color cycle just like they do when you use the color cycle setting on the LIFX iOS app


From: Kevin Ghadyani notifications@github.com Sent: Saturday, June 1, 2019 9:10 PM To: Sawtaytoes/LIFX-Controller Cc: neurokinnetix; Author Subject: Re: [Sawtaytoes/LIFX-Controller] Tutorial for the controller and lifx-color-cycle mod? (#1)

That sounds good. What do you mean by color-cycling scenes exactly?

Do you mean setting up a scene and randomly changing the colors of the lights when that scene is activated, or something else?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Sawtaytoes/LIFX-Controller/issues/1?email_source=notifications&email_token=AJ7HANZVW22BRTYXCOW56DTPYNB2JA5CNFSM4HSBNLOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWXNM5I#issuecomment-497997429, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJ7HAN6UVF77DCCQRSDWTQ3PYNB2JANCNFSM4HSBNLOA.

Sawtaytoes commented 5 years ago

I made a sample app for that here: https://github.com/Sawtaytoes/LIFX-Color-Cycle

It's a simple form that takes some values. You can directly call that function and pass those params if you want.

image

I just updated dependencies and verified it still works. It sends HTTP commands to LIFX's API on a timer and changes the color step-by-step. For instance, it would change from: red, orange, yellow, green. blue purple, red.

It's a bit wonky though. LIFX has a new API command called cycle. Using this, you can reuse a lot of the same code I wrote and change it to use this single API call: https://api.developer.lifx.com/docs/cycle

Color Cycling

You can change it to a Node.js app by calling cycleColors yourself. It's located in ./api/middleware/cycle-colors.js. You can see the defaults here:

image

Usage

To use it, you'll need to create an copy an API token from LIFX here: https://cloud.lifx.com/settings

My version only targets groups and individual lights, not scenes.

To target scenes, it's a lot more complicated. you'd need to grab the scene ID ahead of time and change the code to target lights in a scene rather than lights in a group.

You'd need to use the LIFX API and grab the scene ID: https://api.developer.lifx.com/docs/list-scenes.

Then, you'd take that scene ID and create a selector like this: https://api.developer.lifx.com/docs/selectors

scene_id:67b1d0db-2416-4368-b101-2081c7ef2817

If you pass that into the colorCycle function as a selector, it will target the scene, but you still need to write the code to grab the light IDs in that scene or manually copy-paste them in from the API call to `/v1/scenes.