LIFX Plugin

This plugin still in beta http://apps.mios.com/plugin.php?id=8986 allows for controlling LIFX bulbs from the veraplus(UI7).

This plugin works mainly via Lifx’s cloud and requires internet access (allows for “easy” scene and group control).

We have now gotten to the hybrid model where some commands are sent locally (when possible).To enable you MUST set USE_LOCAL to “true” in the advanced settings of the controller.

These LAN features are dependant on your local network, if your network for whatever reason does not allow for direct communication the plugin will continue to work as it did before. When working with LAN control your lights will respond pretty much instantaneously to supported commands (no more of that dreaded lag).

Once installed

[ol][li]Enter your LIFX token in the settings tab of the device (you may need to scroll down to see the settings tab)[/li]
[li]Click the “List Devices” Button [/li]
[li]Select the devices, groups and Scenes you would like to control[/li]
[li]Click the “Sync Selection” Button [/li][/ol]

If you would like to remove a device from vera uncheck the device using after listing all lights and then click sync. Simply deleting the device from the vera UI is not recommended since the device may (who am I kidding, they WILL) re-appear.

A lot of resources can be found at http://forum.micasaverde.com/index.php/topic,36961.0.html and you can get a feel for where the development of this has come from. I’ve opened this thread to facilitate change-logs etc.

The work here is without guarantee etc etc and while I will make an effort to attend to bugs, time is very limited so custom (not generally useful) feature requests may not be honored.

The “Script”; It seems like I’ve somehow ended up with maintainer role of said “script”. I don’t use the script so I get no pleasure (whatsoever) from this, you will find said script attached here nonetheless. There are many experienced users here who will be able to respond to questions about it (the script).

Plugin Version History:

1.4

[ul][li]Color Temperature Support[/li][/ul]

1.3

[ul][li]Bug fixes for people with issues in 1.1[/li]
[li]Misc improvements[/li][/ul]

1.2

[ul][li]Significant LAN control improvements[/li][/ul]

1.1 [if you have problems with this release roll back to 1.0 and wait for 1.3 yes 1.3]

[ul][li]Additional improvements to LAN control[/li]
[li]Add device category and sub-category[/li][/ul]

1.0

[ul][li]Second phase of LAN control: Brightness[/li][/ul]

0.9

[ul][li]First phase of LAN/local control: On and Off[/li][/ul]

0.8

[ul][li]Permit the modification of Scene transition delays via call_action[/li][/ul]

0.7

[ul][li]Devices in Vera are updated with new names when renamed externally[/li]
[li]Other bug fixes[/li][/ul]

0.6

[ul][li]Add StepUp/StepDown support[/li][/ul]

Changes to the “Script”

[ul][li]There are now three files, you need all three[/li]
[li]Your token goes in the file called lifx_ctrl_auth[/li]
[li]Changes were made to the json file for compatibility[/li][/ul]

– The extra auth file should make updates more seamless for everyone, just upload new lifx_ctrl file going forward and voila.

Reserved

[quote=“Majimus, post:185, topic:191679”]I will check later…so I’ve tested the code and it works, what did you do?
example usage is:
lifx_ctrl(“scene_id:xxxxx-xxx-xxxx-xxxx”, “scene”, nil, nil, nil, 3)[/quote]

The exact sequence I followed:
opened “develop apps” tab on the Vera webserver page and selected “Luup files”,
dragged and dropped the new Lifx_ctrl.lua file from the directory that I downloaded it to into the appropriate box and hit “done”,
opened the settings tab, selected “Net and Wifi” and hit “Reboot”
created a new scene (manually triggered) and entered the script into the “Also, execute the following Luup code:” area, after looking up and verifying the specific scene uuid on https://api.developer.lifx.com/docs/list-scenes with my token code. The script used was:
lifx_ctrl(“scene_id:xxxxxxxx-465f-4159-90d5-xxxxxxxxxxxx”, “scene”, nil, nil, nil, 1)
but I also tried:
lifx_ctrl(“scene_id:xxxxxxxx-465f-4159-90d5-xxxxxxxxxxxx”, “scene”, 0, 0, 0, 1)

I’ve tried twice already to copy over the new lua file and I can’t think of anything that could possibly be wrong, so I will delete the file, re-download it and try one last time.
Edit: Nope. Nothing. :confused:

checking again right now.

Ok, this is really weird… NONE of my scripts work. I’m going to unplug the Vera for a sec and see what happens.
I tried lifx_ctrl(“group:Bedroom”, “on”, “blue”, 1) just as a test and that didn’t work either.
Be right back…

Edit: my scripts no longer work, even after resetting the Vera. I can execute the scenes using my Android phone with the Lifx app.

For some reason the json module does not seem to load anymore, I will upload the modified module and the modified script.

Give me a few mins to test and upload.

All credits for this json module goes to https://gist.github.com/tylerneylon/59f4bcf316be525b30ab, I just refactored it a little.

Added the files to the first post you need both of them.

The revised scripts have been uploaded to the first post. Uploaded new script file as well as refactored json module, all seems well now.

Please advise…

Still no luck. :frowning:

you have added both files to your vera, with your token added correctly? Have you also verified that your require code in the startup lua is not garbled?

OMG! The token! How could I forget to replace that? :-[
Sorry about that. Be right back.

Edit: Ok, I feel like a complete idiot, but that did the trick. Back in business! I’ve tested a number of scenes and everything works as it should with one exception – the LIFX Z strip that I have changes its color immediately rather than the time specified for the scene change duration. The other light in that scene transitions as it should.
Thanks for your patience!

[quote=“Quixote, post:10, topic:199073”]OMG! The token! How could I forget to replace that? :-[
Sorry about that. Be right back.

Edit: Ok, I feel like a complete idiot, but that did the trick. Back in business! I’ve tested a number of scenes and everything works as it should with one exception – the LIFX Z strip that I have changes its color immediately rather than the time specified for the scene change duration. The other light in that scene transitions as it should.
Thanks for your patience![/quote]

There was someone else with the same issues on the Lifx forums, could be an issue with the strip.

I’ll dig deeper over the next week and let you know if I come up with anything. What I can tell you right now is that I am able to do gradual scene changes from within the LIFX Android App according to the transition change duration I select.
Thanks again and good night.

[quote=“Quixote, post:12, topic:199073”]I’ll dig deeper over the next week and let you know if I come up with anything. What I can tell you right now is that I am able to do gradual scene changes from within the LIFX Android App according to the transition change duration I select.
Thanks again and good night.[/quote]

I will check my strip during the week.

Best,

Maj

Version 0.9 has been uploaded and is pending review, this brings the first phase of local LAN control:

[ul][li]When possible “Turn on” and “Turn off” commands for lights (only actual lights) will be sent locally[/li]
[li]Disabled by default, to enable set USE_LOCAL to “true” in the advanced settings of the parent device[/li][/ul]

This is beta so if something breaks leave a comment and disable the feature, also LAN features can be finicky so YMMV.

Worst case everything should work as usual (nothing should break per se), best case lights turn on and off without that ever so slight lag.

While one can think of reasons why a mostly “local when possible” for all commands could be useful (or downright necessary) , I think that for the majority of residential use cases “on” and “off” being local will suffice.

Thanks for the update. I’ll test it out this weekend and let you know how it goes.
I really like the idea of putting the token in a separate file. Smart.

Curious, where do I find the “StepUp/StepDown” functionality?
Thanks in advance

[quote=“Quixote, post:15, topic:199073”]Thanks for the update. I’ll test it out this weekend and let you know how it goes.
I really like the idea of putting the token in a separate file. Smart.

Curious, where do I find the “StepUp/StepDown” functionality?
Thanks in advance[/quote]

This is a feature of the dimming service that allows you to change the intensity of a dimmable light in predefined steps, someone requested this for use with remotes.

I can’t seem to find this on the device page or in scene creation. Is it part of the script functions?

It is found in the Advanced Editor of the scene creator. The actions are called StepUp and StepDown.

It is found in the Advanced Editor of the scene creator. The actions are called StepUp and StepDown.[/quote]

Thank you

Version 0.9 is now available.

© 2019 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy