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

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #60 on: August 13, 2017, 12:19:19 am »
Thanks for the files and directions. I managed up until the point where I need to add the ID for the light I'm trying to control. The only way I succeed at controlling a light is by entering "group:xxxxxxxxxx" (without quotes) into the ID field, because I'm not sure where to find the ID of the individual light.

I like the idea of a parent->child setup and it makes a lot more sense to me. It would be great if there were a way to have all of the steps involved in creating each new device handled by the plugin somehow since I have 9 bulbs at present and plan on buying another 6 to 10 in the future. Not sure what to do about those that choose to use more than one token, but I'm quite certain that cases like that are fairly rare. In fact, I can't think of one reason why someone would want to generate multiple tokens to use on the same Vera.

My first request would be an additional control field for duration that allows us to enter a number in seconds for the transition duration. I believe the groundwork was already integrated in the original code posed in this thread, but I was never able to figure out how to use it.

Thanks again!
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 #61 on: August 13, 2017, 12:37:49 am »
Sorry about that, the automation is on the TODO list.  I kinda assumed that everyone in this thread had their id's etc.

You can go to https://api.developer.lifx.com/docs/list-lights  and in the "Try it out" section you put "all". That will give you a list of all your lights and their id's.

For the next update will automate this part of it.

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #62 on: August 13, 2017, 12:45:49 am »
Nice. No need to apologize! I had done that many months ago, but it's difficult to remember the all of the steps involved. Thanks.

While I'm here, I thought of another request that would be handy -- the ability to activate scenes. Using the original code, I'm able to use the syntax:
lifx_ctrl("scene_id:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "scene")
Coupled with a duration feature (if that's even possible) it would be very powerful. I have several scenes that I time to emulate a sunrise and a set for the sunset, but the changes are very abrupt and it sort of ruins the effect I'm going for. Those 2 abilities would solve that and more.
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 #63 on: August 13, 2017, 01:01:26 am »
Nice. No need to apologize! I had done that many months ago, but it's difficult to remember the all of the steps involved. Thanks.

While I'm here, I thought of another request that would be handy -- the ability to activate scenes. Using the original code, I'm able to use the syntax:
lifx_ctrl("scene_id:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "scene")
Coupled with a duration feature (if that's even possible) it would be very powerful. I have several scenes that I time to emulate a sunrise and a set for the sunset, but the changes are very abrupt and it sort of ruins the effect I'm going for. Those 2 abilities would solve that and more.

I can think of a few elegant ways to do that but it will take time, since you appear to be familiar with and using the original script I can modify it to do what you wish to do.

I don't know if my copy is the most updated, send me a copy (remove your api key [best practices])..and I should be able to create an amended version that will add a delay to the scene (that will be much quicker, maybe even tomorrow).

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #64 on: August 13, 2017, 01:09:33 am »
No rush...  I just moved so I'm still installing light fixtures, etc.
It will be some time before I install many of the most important lights because I have a lot to organize here first.

I don't have any special files here. The only update I used was the one available in the first post of the thread, so it would be simpler for you to grab it there if you don't have an up-to-date set of files.

By delay, you mean a slow transition, correct? I know that the Android app has the ability to turn on a scene over a duration when you hold down the scene and select the time-frame, so it should be possible using the API.

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 #65 on: August 13, 2017, 01:13:43 am »
Yes, I'm referring to the transition delay for the lifx scene change. I thought you were using the old script, in that case I will put it on the list of things to do.

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #66 on: August 13, 2017, 01:23:04 am »
Yes, I am using the old script (old being the one that was current until you arrived on the scene  ;) ).
I do use the app as well though because I have yet to find a Zwave option that functions properly with the Vera that would give me the same flexibility as the app, or at least basic functionality even. I had high hopes for the Aeotec Wallmote Quad, but I don't believe Mi Casa Verde has added it to their list of devices with full functionality yet.

Anyway, I'll be following your progress as you find time to enhance your plugin. Keep up the great work and have a nice weekend!
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 lfairbank

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #67 on: September 01, 2017, 02:32:33 am »
This is so awesome!!!
I have been waiting for this for ages.

HOT TIP: you can use "group_id:xxxx" "scene_id:xxxxxx" etc instead of "id:xxxxx" to control a room from one switch

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #68 on: September 03, 2017, 03:42:06 pm »
This is so awesome!!!
I have been waiting for this for ages.

HOT TIP: you can use "group_id:xxxx" "scene_id:xxxxxx" etc instead of "id:xxxxx" to control a room from one switch

I know, right?  This is this best way to use these bulbs so far (without putting an open-mic, internet connected bug in your home).
I figured out the scenes thing and posted instructions back in post #52 of this thread.
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 #69 on: September 05, 2017, 02:33:02 am »
Uploaded a new plugin that now allows you to dynamically add all your lights and scenes from a parent device.  TLDR; Add lights and Lifx Scenes to your vera with no tinkering.

https://github.com/majimus/majimusLifx

This is not compatible with the previous version I would recommend removing the previous devices before using this.  If you are happy with the previous code feel free to keep using it since this version is less tolerant of manual changes.

Scenes and Lights are supported but not groups (coming soon).  Also if anyone wants to donate an Icon for the parent feel free, I'm using the scene icon from vera.

if you are using groups and are having a blast manually editing the ID's you will probably be better with the previous version for now.

Contributions are welcome (even if it's the readme).  The instructions for this version would be:
-remove the old devices
-upload the files (except the Readme)
-Manually add a new device with device_type "urn:schemas-majimus-com:device:LifxParent:1" ,  device_file "D_MajimusLifx_P.xml" ,  implementation_file "I_MajimusLifx.xml" and device_file "D_MajimusLifx_P.json".

Once you have added your device, put in your api key in the settings and you can list and sync lights and scenes.

As always this is very Beta (may have errors) and work in progress , only for UI7. Unchecking an installed device (light or scene) and syncing will REMOVE the device from your vera

Feedback appreciated.
« Last Edit: September 05, 2017, 02:46:12 am by Majimus »

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #70 on: September 05, 2017, 02:47:28 am »
Nice!
I'll give this a shot tomorrow when I'm more awake and able to focus.
I'd like to contribute more, but I'm not a programmer. However, I do have plenty of experience in design and I'd be more than happy to create any icons you need. I could even build templates so that we can have indicators that reflect different bulb states if that suits you.
Let me know, and thanks for your efforts
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 #71 on: September 05, 2017, 04:08:24 pm »
Something simple, the letter LIFX in two rows in a square?

Offline jmedemar

  • Jr. Member
  • **
  • Posts: 98
  • Karma: +0/-0
  • Vera 3
Re: Instructions and Steps to Implement LIFX API
« Reply #72 on: September 06, 2017, 09:38:22 am »
Something simple, the letter LIFX in two rows in a square?
Found these on google for inspiration.

Offline Majimus

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +7/-0
Re: Instructions and Steps to Implement LIFX API
« Reply #73 on: September 06, 2017, 12:59:10 pm »
I vote for the last one.

Offline Quixote

  • Full Member
  • ***
  • Posts: 249
  • Karma: +9/-32
Re: Instructions and Steps to Implement LIFX API
« Reply #74 on: September 07, 2017, 01:13:31 am »
I can recreate that logo and experiment with different colors, as long as we won't be breaking any copyrights or anything. I'll have to take care of that sometime in the next three days because I have a lot lined up at the moment.
What resolution and image size must the logos be?
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.