Release LIFX for v2 API Plugin - Home Theater - NATEKODILIFX
#1
Rainbow 
Hi All,

The last few weeks I've been getting very few hours of sleep wanting to give people something decent to play with. I don't know python very well but I have made an attempt to create this plugin for you all so you can use your Lifx bulbs with XBMC / Kodi.

I have tested this on my own system and it seems to work fine, however once this gets into the wild (i.e. your hands) it may not be as friendly. I have placed it on github so anyone can run with this and create something nice and new and polished.

There is a config file where you will be required to enter your details such as an API key which you can get from https://cloud.lifx.com . Having said that I'm not sure how open it is for people to get an API key but you will need to go to "settings" up the top of the page and request a key. Once you have a key you will need to open up the lifx.cfg file inside the ZIP folder and place your key after the apiKey =

You will also need to put in the group of lights or the bulb you wish to have Kodi turn off. This is either for example group:Living Room (which is in there) for the group called Living Room or label:Center which will manipulate a bulb called Center only. All these are names you have created in your phone app which are connected to your lifx cloud account.

Features:
  • When a Movie is Playing it will fade the lights to off
  • When a TV show is playing it will fade the lights to a dark blue at 5% brightness which is just enough light to walk around in without being obtrusive
  • When you pause a video the lights will return to their original state before you started the video.
  • When a video stops or comes to the end, the lights will return to their original state before you started the video.
  • When lights are returned to their original state they are called how they were set.. not as a group, in case you had a theme going, they will return to those exact colours
  • User definable fade in and out times within the lifx.cfg folder

This comes with no guarantee that it will work. It works as far as I've tested it. If I can I will try and help.

I am hoping there is someone out there who is cleverer than I am and is able to write some code which will allow people to edit the settings directly from within the Kodi interface and write them to the config file. Every time a video starts the config file is re-read to capture any changes you desire.

And here it is: NateKodiLifxNod
Reply
#2
Awesome, I will be giving this a try when I get back from holiday. Thanks for your effort!
Reply
#3
Has anyone had a chance to try this out and see if it works for them at all?
Reply
#4
I'll give it a try tomorrow. But how do I install it? Your first version had a zip file to install from
Kodi menu - what do I do to install v2?
Main TV: LibreELEC 7.0.1 / Kodi 16.1, with Xonfluence skin on Asus Chromebox (1.4GHz, 4Gb RAM, 64Gb SSD) + DVB-S and DVB-T with TVH.
Plus testing v17 nighlies on Macbook, and using Estuary skin.
Reply
#5
You need to download the ZIP file from Github.. open the zip file up and edit the file "lifx.cfg" and enter in your API code and the name of your light or group of lights.. save the file back into the zip file.. copy the zip file somewhere (varies depending on which flavor of Kodi you are using) but I use the Home Folder using WinSCP to upload it, I use OSMC but its the same for any linux distro.. once you have it saved on the Kodi machine.. go to Adons in Kodi and say Install from ZIP.. find the ZIP file and say OK.

If you need to edit the config file it is in /~/%username%/.kodi/adons/service.NateKodiLIFX/lifx.cfg and you can use vi or nano or any text editor to make changes to it.
Reply
#6
Thanks for writing this. I wanted to give it a try but the zip file can't be installed - Kodi says it has the wrong structure. This is Kodi 14 on Chromebox.

I tried using my modified zip and the original zip from github and both got the same error. I looked at the structure on the development wiki and it looks ok. I also tried placing the three main files in the root of the zip but that didn't work either.
Reply
#7
OK .. I think I see the error.. it's the way that GitHub creates the ZIP.. what you'll need to do is download it.. extract all the files.. there is a folder called Service.NateKodiLIFX.. Take that folder and the 3 files inside (Addon.xml, lifx.config and service.py).. so you have the ZIP.. Folder (service.NateKodiLIFX) then inside the 3 files... nothing in the root of the zip other than the service.NateKodiLIFX folder.. It should then work okay.
Reply
#8
here is what I'm using, but it still won't install:

Code:
cb01:/tmp # unzip -l service.NateKodiLIFX.zip
Archive:  service.NateKodiLIFX.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  04-01-2015 21:54   service.NateKodiLIFX/
      259  04-01-2015 21:46   service.NateKodiLIFX/lifx.cfg
     4577  03-27-2015 06:53   service.NateKodiLIFX/service.py
      647  03-27-2015 06:53   service.NateKodiLIFX/addon.xml
---------                     -------
     5483                     4 files
Reply
#9
I just tested it on anew windows build on my work PC and was fine. If there was a way to upload it on ere I would.

There seems to be no way of attaching a file in the forums.. that way I know you've got it right.
Reply
#10
(2015-04-02, 02:21)phoniclynx Wrote: You need to download the ZIP file from Github..

The link doesn't take me to a zip file - only .md, .txtx, .xml, .cfg, and .py files. Where is the zip file?
Main TV: LibreELEC 7.0.1 / Kodi 16.1, with Xonfluence skin on Asus Chromebox (1.4GHz, 4Gb RAM, 64Gb SSD) + DVB-S and DVB-T with TVH.
Plus testing v17 nighlies on Macbook, and using Estuary skin.
Reply
#11
On the right hand side.. where Github nicely hides it
Reply
#12
phoniclynx, can you put it on Dropbox space and just share the link?
Reply
#13
I have commited the GitHub files so you should just be able to just download it using the Download ZIP on the right hand side of the link above -- Make sure to unsip everything from -master first then you'll have your zip.
Reply
#14
It was a problem with the way I was re-zipping the file. I fixed that bit. When I try to install now, I get an error:

Code:
07:14:14 T:139715822978816   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ImportError'>
Error Contents: No module named requests
Traceback (most recent call last):
File "/storage/.kodi/addons/service.NateKodi.LIFX/service.py", line 10, in <module>
import requests
ImportError: No module named requests
-->End of Python script error report<--

Looks like a pretty straightforward error. I'll dig into my openelec and see what the problem is.
Reply
#15
Looks like you don't have script.module.requests installed and probably not script.module.simplejson as well.
Reply
 
Thread Rating:
  • 1 Vote(s) - 5 Average



Logout Mark Read Team Forum Stats Members Help
LIFX for v2 API Plugin - Home Theater - NATEKODILIFX51