Author Topic: Instructions and Steps to Implement LIFX API  (Read 11325 times)

Offline silfa718

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #45 on: January 06, 2017, 12:16:32 pm »
Thanks for the reply. Can you clue us in on the syntax we would use with your script and how the return values are handled? Do they populate a table somewhere or is it just one variable with one long string?


After this get answered, I guess I'll have to get busy figuring out LUA

Thanks for the help

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #46 on: January 06, 2017, 01:47:16 pm »
Thanks for the reply. Can you clue us in on the syntax we would use with your script and how the return values are handled? Do they populate a table somewhere or is it just one variable with one long string?


After this get answered, I guess I'll have to get busy figuring out LUA

Thanks for the help

No problem at all. It's actually a pretty good idea and if I weren't using the Android app, I'd probably do the same thing. I'm a little preoccupied right now, but maybe I'll see if I can remember some Lua from about a decade ago. :)
You can find the manual online in PDF format.
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person.

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #47 on: January 14, 2017, 08:46:36 pm »
Joe, you MIA?
 :-\
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person.

Offline silfa718

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #48 on: January 15, 2017, 01:21:06 pm »
My vera no longer shows my lifx lights anymore in the dashboard, happen to anyone else? It was working as of a couple days ago.

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #49 on: January 15, 2017, 01:30:08 pm »
I never had my lights showing on my dashboard. Only the scenes I created with the scripts.
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person.

Offline silfa718

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #50 on: January 15, 2017, 01:41:05 pm »
I never had my lights showing on my dashboard. Only the scenes I created with the scripts.

Okay, I forgot how this worked, I'll test it and check back later

Update:

Found my problem. My bulb wasn't connecting to the LIFX cloud. Why or how I don't know. I reset the bulb via the app and it is working again.
« Last Edit: January 15, 2017, 05:35:35 pm by silfa718 »

Offline leyton01

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-2
Re: Instructions and Steps to Implement LIFX API
« Reply #51 on: January 23, 2017, 10:05:32 am »
Joe,

Would you consider modifying this to run the LIFX LAN API instead? Eliminates cloud/internet issues and should make it quicker and more reliable.

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #52 on: February 10, 2017, 07:21:57 am »
Well, it seems that Joe has deserted us.
I got impatient, so I opened the lifx_ctrl.lua file to poke around a little and try to figure out one of the features I needed. I finally managed to make sense of that particular problem, and it seems that the feature was actually already programmed into the script and it was only a matter of finding the syntax.
For anyone interested in activating the scenes that you've created using the LIFX app, you can go to this page:
https://api.developer.lifx.com/docs/list-scenes
Enter the token that you plugged into your lifx_ctrl.lua file and hit "Try it!" and you'll get a list of your scenes. From there, you find the scene "uuid" (looks like a serial number), listed in the line right above the name of the scene.
In your newly created scene on the Vera, use the Lua code:

lifx_ctrl("scene_id:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "scene")

replace the "xxxx"s with your scene uuid. Simple as that.
Enjoy.
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person.

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #53 on: February 15, 2017, 02:31:38 pm »
Is there anyone here that is knowledgeable enough in Lua to modify the lifx_ctrl.lua file to allow us to specify the duration for the scene function?
I'd like to set up my sunrise and sunset scripts to change color over several minutes, but I'm not sure how to modify the control script. It doesn't look that complicated for someone that knows what they're doing.
Thanks in advance.
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person.

Offline joek

  • Sr. Newbie
  • *
  • Posts: 48
  • Karma: +7/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #54 on: February 25, 2017, 08:00:27 am »
Joe,

Would you consider modifying this to run the LIFX LAN API instead? Eliminates cloud/internet issues and should make it quicker and more reliable.

I've looked into operating the Lifx bulbs via local LAN some time ago, but determined using the lifx Rest API would be easier to implement. Plus not certain how to implement Lan portion on the vera, so would have to run a local server.

Joe

Offline joek

  • Sr. Newbie
  • *
  • Posts: 48
  • Karma: +7/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #55 on: February 25, 2017, 08:05:52 am »
Well, it seems that Joe has deserted us.

That's not true I've not deserted this thread.

I subscribe to this thread and for some reason I am no longer receiving notifications when a new message is posted. I just reset my notifications so hopefully that fixes it.

Joe
« Last Edit: April 07, 2017, 10:17:32 pm by joek »

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #56 on: February 25, 2017, 04:54:41 pm »
Well, it seems that Joe has deserted us.

That's not true I've not deserted this thread. That's fake news!

I subscribe to this thread and for some reason I am no longer receiving notifications when a new message is posted. I just reset my notifications so hopefully that fixes it.

Joe

XD  Well, I figured that fake news was all the rage these days, so I'd get in on the action. Sorry, I should have sent you a P.M. before jumping to conclusions.
Did you notice my post about scene duration? I have a routine that works with my alarm clock app and Tasker to run through some Lifx scenes to simulate a sunrise and sunset and it would be a lot better if the transitions were less abrupt. If I could shift between scenes over 10 minutes that would be pretty sweet. Doable?
Thanks.
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person.

Offline Majimus

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +7/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #57 on: August 12, 2017, 10:14:57 pm »
Joe,

Would you consider modifying this to run the LIFX LAN API instead? Eliminates cloud/internet issues and should make it quicker and more reliable.

I've looked into operating the Lifx bulbs via local LAN some time ago, but determined using the lifx Rest API would be easier to implement. Plus not certain how to implement Lan portion on the vera, so would have to run a local server.

Joe

I've been working on a plugin based loosely off the work done here.  At this time it is only for UI7 and supports on/off, brightness and color via the user interface. It also periodically updates the light to reflect changes made outside Vera (on/off and brightness).

It's still early work in progress, but if folks are interested I will publish it and we can go forward based on suggestions (probably start a new thread). The vision for this plugin was from the point of view of advanced configuration (pulsing, movement etc) being set by the lifx app (this applies especially to the light strip) and the basic things controlled by vera.

-Majimus


Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #58 on: August 12, 2017, 10:20:24 pm »
Awesome! I'm really excited about this! You are a hero in my eyes.  ;D
I would definitely be interested in testing the plugin and making suggestions if that would help you in any way.
THANKS!!!
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person.

Offline Majimus

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +7/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #59 on: August 12, 2017, 10:52:31 pm »
You can find the code at https://github.com/majimus/majimusLifx , this is really beta and ONLY for UI7.

I've been using it as I develop, but at this point there is still a lot of work to be done so.

To install:

1. Upload all files to your vera (running UI7)
2. Add a new device with device type = urn:schemas-majimus-com:device:Lifx:1
3. The upnp device filename = D_MajimusLifx.xml
4. The upnp implementation filename = I_MajimusLifx.xml

You will probably need to reload the interface for the new device to appear then u click the settings section for the configuration and you add your Lifx ApiKey and the id (the format for the id is "id:xxxxxx" without the quotes) of the light in question.

The steps will need to be adjusted for each light you want to add (you can probably get away with putting "all") as the id and controlling all your lights at once.

Going forward I will move this to a parent->child setup since most people will be controlling all lights with the same token, as it is you can control lights from different accounts.

I'm happy to make changes based on feedback as time permits (but I do have a day job so you know how it goes)

-Majimus