Instructions and Steps to Implement LIFX API

[quote=“joek, post:20, topic:191679”]Local LAN access to LIFX is possible via their LAN Protocol: Introduction However, I if recall correctly it requires a local server. There are folks that created python libs for LIFX that use local LAN, but still requires a local server to operate.

Using the LIFX HTTP API was easy to implement, but you are correct that it requires internet access to their servers per their API.

Joe[/quote]

I’m probably part of a small minority, but it rubs me the wrong way that I’m at my ISP’s mercy when it comes to controlling my lights. I thought one of the main purposes of the Vera was to act as a “server” for these simple automation tasks?
Thanks for your reply!

-Derek

That is Vera’s purpose, but this is an issue around Lifx’s APIs, and interacting with those APIs doesn’t just happen. Someone has to take the time to write an appropriate plugin for the Lifx LAN protocol and be happy with running a local 24 hour server if they want to integrate it into Vera. Depending on how skilled one is writing the plugin, it may be able to use the Vera itself as the server if the plugin can be written that way…

I’ve found joek’s HTTP implementation stable and very useful so far.

Hey JoeK,
I bought a bunch of these bulbs, dug up my old Vera 2 (with UI5) and tried out your plug-in.

I’m getting a real kick out of this and I just wanted to say thanks for making this available for us. It’s pretty cool!

All the best!

-D

One thing I can’t get to work and I’m wondering if it’s just not programmed into the plugin –
I’ve been trying to use “label:name, label:name 2, label:name 3” instead of individual ids, as instructed here: Selectors
Am I doing something wrong, or it’s just not available?

Also, any chance we can get the “breathe” function as well?

Thanks

[quote=“Quixote, post:24, topic:191679”]One thing I can’t get to work and I’m wondering if it’s just not programmed into the plugin –
I’ve been trying to use “label:name, label:name 2, label:name 3” instead of individual ids, as instructed here: Selectors
Am I doing something wrong, or it’s just not available?[/quote]

Works for me using the following syntax for example:

                lifx_ctrl("label:Bulb01,label:Bulb02", "on","blue",.2)
Also, any chance we can get the "breathe" function as well?

Thanks

Been very busy on other things but will add “breathe” next code update.

Thanks,
Joe

Thanks. I understand how the projects can start to pile up! I appreciate your work and even as the plugin stands it’s super useful. I now have it set up to flash my lights when the doorbell is pressed by pairing its functionality with my Elk alarm system and related plugin. The only reason I’m requesting the “Breathe” function is because I find the Pulse a little jarring. I wouldn’t want a guest having a seizure because the doorbell rings. :wink:

I figured out the error with my syntax while trying to use “label”. It was actually just a silly mistake of forgetting that the label names are case-sensitive.

Is there currently a command to activate a scene, or is that something else that you would need to invest time into? If it’s already implemented, what is the syntax?

Thanks!

-D

It’s not in the code but also not difficult to add it in because the framework is there already. Hope to work on it this upcoming weekend.

Cheers!

10/1/16 update:

Added the breathe per your request. Will add the feature to activate a LIFX scene in the next update. New code and updated instructions are in the opening message on page 1.

New code with added features - http://forum.micasaverde.com/index.php/topic,36961.msg275597.html#msg275597

UPDATES:

10/01/16 -
- changed instructions to support U15 and U17 releases
- rename json.lua to myjson.lua for U17 support
- added “period” parameter to lifx_ctrl()
- added “breathe” mode to lifx_ctrl
- updated instructions and examples

Enjoy!

Thanks Joe!
That’s awesome! I’m looking forward to working this feature into my setup, but I’m currently experiencing a major setback with my bulbs. I made changes to my network settings and reset my LIFX app to re-onboard the bulbs, but they wouldn’t connect to my router. After returning the settings to their original state the bulbs still won’t onboard.
Hopefully an app update is released soon that fixes my issue. So far support has been helpful, but ultimately unable to resolve the issue.
I think it may be something to do with the Android (6.0.1) app.

Thanks again in any case.

I enjoyed reading this thread and I like the function provided here. I took the Python from the LIFX pages and wrote up some Lua for the individual things I wanted my 1 LIFX Bulb to do… basically, turn on at a random colour and turn off, so 2 little bits of Lua. I am writing here to put myself in the good company of others who think the LIFX Cloud is a bit of overkill for most of us - I would also relish being able to just write a bit of Lua that could tell my LIFX bulb what to do locally (on the same network). As my LIFX Bulb is controlled by a PIR I find it can be somewhat unresponsive (by that I just mean there’s a delay) when the Scene is triggered… I think that would go with local control as I put the delay down to communication with LIFX Cloud.

Still - a good thread and a nice bit of Lua.

Hey Joe,
I’ve run into some problems with my bulbs and have since been unable to use them, but I was still wondering if you’ve considered building your code into a full-fledged Vera plugin. That would be pretty sweet!
I’ve been looking at the RGB plugin a little, about to add a Fibaro RGBW controller and I’m thinking it would be pretty kick-ass if there were a quick and easy way to coordinate the devices if I ever manage to setup LIFX bulbs again.

-Derek

[quote=“Quixote, post:31, topic:191679”]Hey Joe,
I’ve run into some problems with my bulbs and have since been unable to use them, but I was still wondering if you’ve considered building your code into a full-fledged Vera plugin. That would be pretty sweet!
I’ve been looking at the RGB plugin a little, about to add a Fibaro RGBW controller and I’m thinking it would be pretty kick-ass if there were a quick and easy way to coordinate the devices if I ever manage to setup LIFX bulbs again.

-Derek[/quote]
@Quixote

Sorry, no intentions for me to build a LIFX plugin. IMO, it would be best for LiFi Labs to develop and support an official LIFX plugin for Vera.

Regards,
Joe

Bummer. We both know that will never happen. :frowning:

Just wanted to say thanks for doing this work and publishing so others can benefit from it. I was able to easily get my scenario working (turn on a specific set of lights for a specific period of time when a specific code is entered on a lock).

JC

from a home automation newbie, just wanted to say thanks! just to be slightly difficult, has anybody managed to get the fade on / off duration working?

Thanks again for your contributions to the community

Sent from my iPhone using Tapatalk

Hi Joe,
I just tested my Lifx bulbs again this morning and I guess they must’ve fixed something because they actually worked this time I tried to connect to them with the app. :slight_smile:
I set them up on my new Vera Plus and started doing a little testing with the new breathe function and I’m finding some strange behavior. I’m having my bulbs retain the color that I choose for the breathe rather than return to their original color as they were with the pulse function.
Has anyone else noticed this with their setup?
Thanks.

-D

Can someone please test the breathe function and verify my results?

@Quixote

Sorry I am not at a place where I can test the breathe function, but did check the Lua code. The code does have the presist set to false, which should retain the color prior to starting breathe.

You could test the lifx api yourself by going to their web page and using the breathe function. The link is in the first post.

Joe

Just got this working, and everything worked on the first try. Thanks for the clear instructions.

Would it be possible to to add duration (How long in seconds you want the power action to take.) to the parameter list. At first I thought this the period parameter.

Also if i wanted to create a dimmer scene, that would look at the current brightness and raise (or lower) by a factor of .1 from the current state, would that be possible? How?