Instructions and Steps to Implement LIFX API

Certainly. Originally the code was:

lifx_ctrl(“group:Bedroom”, “pulse”, “green”,0.2,5,1)

but this doesn’t work with a longer pulse cycle either:

lifx_ctrl(“group:Bedroom”, “pulse”, “green”,3,5,1)

Both are identical in their performance.

[quote=“Quixote, post:161, topic:191679”]Certainly. Originally the code was:

lifx_ctrl(“group:Bedroom”, “pulse”, “green”,0.2,5,1)

but this doesn’t work with a longer pulse cycle either:

lifx_ctrl(“group:Bedroom”, “pulse”, “green”,3,5,1)

Both are identical in their performance.[/quote]

Usage is as follows lifx_ctrl(selector, mode, color, bright, cycles, period) FYI bright is not a parameter of the pulse and breathe (AFAIK) so this value will be ignored for those features, but you MUST put something there.

AAArrrgh!
Thanks for clearing that up. :-[
What about persistence?

"[i]persist:
booleanfalse

If false set the light back to its previous value when effect ends, if true leave the last effect color.[/i]"

[quote=“Quixote, post:163, topic:191679”]AAArrrgh!
Thanks for clearing that up. :-[
What about persistence?[/quote]

Persistence is hard-coded in the script…

Okay, cool. Works for me.
Thanks!

[quote=“Quixote, post:166, topic:191679”]Okay, cool. Works for me.
Thanks![/quote]

Alrighty, this has used up all my “vera time” for about a good month ;D …have fun…go easy with the strobes…Later.

Hey Majimus,
I know you explicitly stated that you’ve expended more than your share of time on this for a good while (agreed), but I’ve been investing a lot of time myself recently (albeit not charitably) on setting up a number of elements that are dependent on this plugin and I just wanted to come beg for another feature. It shouldn’t be too complicated for someone of your coding caliber (ok, that was admittedly ass-kissing). If you’re ever in Montreal, Qc I’ll buy you a beer or two. :wink:
I’ve noticed in the past that there is a variable hidden in the script that dictates the time period over which a scene takes effect, but I have no idea how to use it. I’ve been hoping to set up my sunrise emulator to make use of this feature that’s present in the API but so far I’m at a loss.
What are the chances that you could take a few minutes to look at this and see if it’s feasible?
Thanks in advance!

-D

I have been using the lifx_ctrl plugin for some time. Mine stopped working a few weeks ago for no apparent reason. Specifically just turning lights on. Turing off and toggle seems fine. I suspect a change in API. Sounds like I am not alone reading Ifairbank and Quixote posts.

I was pleased to see the development work from Majimus (thank you for your efforts!) and installed the V0.7 plugin. Happy with the result, just not sure how to configure the colours/whites to be specific? ie. With the lifx_ctrl I could specify 2750K white colour temperature. Is there a way I can get this type of control in my scenes?

Thanks,

Hey Majimus,
I know you explicitly stated that you’ve expended more than your share of time on this for a good while (agreed), but I’ve been investing a lot of time myself recently (albeit not charitably) on setting up a number of elements that are dependent on this plugin and I just wanted to come beg for another feature. It shouldn’t be too complicated for someone of your coding caliber (ok, that was admittedly ass-kissing). If you’re ever in Montreal, Qc I’ll buy you a beer or two. :wink:
I’ve noticed in the past that there is a variable hidden in the script that dictates the time period over which a scene takes effect, but I have no idea how to use it. I’ve been hoping to set up my sunrise emulator to make use of this feature that’s present in the API but so far I’m at a loss.
What are the chances that you could take a few minutes to look at this and see if it’s feasible?
Thanks in advance!

-D[/quote]

Scene devices (should) have a parameter called “SceneDelay” changing this (advanced settings) should get you sorted…sadly I don’t envision myself in Montreal anytime soon.

Shame. Well, there’s no expiry date on that offer.
Thanks for the pointer. Is that “scriptable”? If so, what would be the syntax?
Thanks!

I accept gifts… 8)

Now for the business at hand…you should be able to do something like:

luup.variable_set("urn:majimus-com:serviceId:Lifx", "SceneDelay", DEVICEID_FROM_VERA, DELAY)

Check in the advanced settings to verify that the value was changed, I have no scenes to test and I’m working on another spare time project atm.

I’ll check it out this evening and post back with my findings. Thanks again and good luck with your project.

No luck. The scene delay setting remains at 0. :frowning:

I can confirm that it does not work…the ecosystem is fairly esoteric, the following will work AFTER the next upgrade will leave it here anyways

luup.call_action("urn:majimus-com:serviceId:Lifx", "SetSceneDelay", {["newSceneDelayValue"] = "Delay"}, DEVICEID_FROM_VERA)

Will try and upload the new code during the upcoming week (will test for a few days just in case).

[quote=“Majimus, post:175, topic:191679”]I can confirm that it does not work…the ecosystem is fairly esoteric, the following will work AFTER the next upgrade will leave it here anyways

luup.call_action("urn:majimus-com:serviceId:Lifx", "SetSceneDelay", {["newSceneDelayValue"] = "Delay"}, DEVICEID_FROM_VERA)

Very cool, but does this mean that we’ll need to have the same setting for every scene? That could be less than ideal for certain situations, for example a scripts that emulate the sunrise by phasing through a few scenes over an hour vs. activating a scene that comes on when “movie mode” is set. It would be strange to wait 20 minutes for the lights to change while the movie plays. I guess I’m just being picky and we could change the setting before activating each scene, but that seems a little rough around the edges.

In any case, I’m very happy for anything you can offer in the way of a solution when time permits! Thanks

This setting is per scene (already is this way in current version) and not global for all scenes in fact this has no meaning in the context of the controller (Lifx plugin), the idea here is that the user added the scenes as devices, and as such will make this change to the devices that corresponds to the scene.

If the transition delay for each scene is fixed you can simply go to each scene’s advanced settings and make the change.

If you are running the same lifx scenes with different transition periods within vera scenes what do you suggest would be a more refined approach to doing this? I’m trying to understand the alternative to setting new delay for a lifx scene run.

Will need to open a new thread for this plugin soon so that I put a readme etc etc…it is beyond time for that.

Ah yes, of course. I failed to notice the “DEVICEID_FROM_VERA” tacked onto the end of that line somehow. Never try to do anything that requires any amount of concentration on 5 hours of sleep. :o

I think it would be nice if any line of script includes a duration variable that will override the advanced settings of the device (temporarily). So maybe something like:

lifx_ctrl("scene_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "scene", 360)
where the 360 at the end indicates the number of seconds over which the transition is performed (with the same option for turning lights on or off, not just scene transitions).

What do you think? Do-able?

Ah yes, of course. I failed to notice the “DEVICEID_FROM_VERA” tacked onto the end of that line somehow. Never try to do anything that requires any amount of concentration on 5 hours of sleep. :o

I think it would be nice if any line of script includes a duration variable that will override the advanced settings of the device (temporarily). So maybe something like:

lifx_ctrl("scene_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "scene", 360)
where the 360 at the end indicates the number of seconds over which the transition is performed (with the same option for turning lights on or off, not just scene transitions).

What do you think? Do-able?[/quote]

Yes, you will need to amend your script and add the duration parameter in the payload section for the scene change. My recommendation would be to keep the interface standard (use one of the existing params for the duration) and just put placeholder values for parameters that will be ignored when you make the function call.

The plugin update that would allow you to do what I mentioned previously is still under review.

Ok, well I’m confident that whatever you think is best will work out better since you have a much deeper understanding of how this works, obviously.
So if we are running the same lifx scenes with different transition periods within Vera scenes, we would just include a line to change the variable that dictates the scene change duration before the command to execute the LIFX scene (or as I understand now, “device”) and then include a line at the end to return the variable to its previous value before the script ends?
Thanks