Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Implement LIFX Binding #215

Closed
openhab-bot opened this issue Nov 17, 2013 · 50 comments
Closed

Implement LIFX Binding #215

openhab-bot opened this issue Nov 17, 2013 · 50 comments

Comments

@openhab-bot
Copy link
Collaborator

From christop...@gmail.com on March 23, 2013 17:58:14

I would like to see a LIFX binding in the future.

It's a smartphone controlled LED-Bulb (like Philips HUE).

Here are some information for developers: http://www.kickstarter.com/projects/limemouse/lifx-the-light-bulb-reinvented/posts/419030

Original issue: http://code.google.com/p/openhab/issues/detail?id=215

@openhab-bot
Copy link
Collaborator Author

From teichsta on May 07, 2013 08:47:57

Summary: Implement LIFX Binding (was: LIFX binding)

@openhab-bot
Copy link
Collaborator Author

From teichsta on May 21, 2013 14:17:49

unassigned to make current state more transparent

@openhab-bot
Copy link
Collaborator Author

From kai.openhab on May 22, 2013 01:15:11

Owner: ---

@openhab-bot
Copy link
Collaborator Author

From teichsta on May 23, 2013 08:49:22

Status: Accepted

@openhab-bot
Copy link
Collaborator Author

From teichsta on November 05, 2013 14:47:54

Labels: To-Github

@teichsta teichsta reopened this Dec 8, 2013
@petrklus
Copy link
Contributor

Just to add a bit of context - https://npmjs.org/package/lifx

@phardy
Copy link
Contributor

phardy commented Apr 12, 2014

@LIFX have released an official public API. The github repos currently contain reference implementations in Ruby, Objective-C and for the Android SDK.

@petrklus
Copy link
Contributor

Yes - they claim that java is coming soon, so as soon as it's out we will
integrate it! There are some efforts on unofficial Java libraries but seems
like a bit wasted time to try to integrate something that will be obsolete
very soon..

I've started work on the binding skeleton so should be fairly quick to implement once the right Java SDK is out. Another option is to integrate the Ruby version via JRuby but that seems like a bit of an overkill :)

On Sat, Apr 12, 2014 at 5:33 AM, phardy notifications@github.com wrote:

@LIFX https://github.com/lifx have released an official public API. The
github repos currently contain reference implementations in Ruby,
Objective-C and for the Android SDK.

Reply to this email directly or view it on GitHubhttps://github.com//issues/215#issuecomment-40270659
.

@kaikreuzer
Copy link
Member

It takes terribly long for the Java-API to arrive.
Di you maybe already have a look at the Android version? After all, it is Java sourcecode and I guess it should not be too difficult to adapt it to a "pure" Java version, don't you think?

@qerub
Copy link

qerub commented May 9, 2014

Another option is to integrate the Ruby version via JRuby but that seems like a bit of an overkill :)

For the record: The LIFX library depends on Addrinfo which is half-implemented in JRuby, so that's not an alternative (unless JRuby is fixed first).

@petrklus
Copy link
Contributor

petrklus commented May 9, 2014

I know, they are taking their sweet time :(. In the meantime, I use exec
binding in combination with unofficial python api to control my lights
(details in my copy of the code
https://github.com/petrklus/lifx-simpleapi/blob/master/colour_setter.py)

On Fri, May 9, 2014 at 11:51 PM, Christoffer Sawicki <
notifications@github.com> wrote:

Another option is to integrate the Ruby version via JRuby but that seems
like a bit of an overkill :)

For the record: The LIFX library depends on Addrinfo which is
half-implemented in JRuby, so that's not an alternative (unless JRuby is
fixed first).


Reply to this email directly or view it on GitHubhttps://github.com//issues/215#issuecomment-42717830
.

@petrklus
Copy link
Contributor

petrklus commented May 9, 2014

So as a first step, use the list_lights to get the raw addresses of your
bulbs. I then have a central colour and a set of switches to toggle
individual lights, your usage will be different but this is a base:

import org.openhab.core.library.types.*

var HSBType hsbValueBulbs
var String hueValueBulbs
var String saturValueBulbs
var String brightValueBulbs

var HSBType hsbValue
var String redValue
var String greenValue
var String blueValue

rule "Set moodlight colours"
when
Item Moodlight_Color1 changed or
Item MoodLight_TV changed or
Item MoodLight_Lifx_Office changed or
Item MoodLight_Lifx_Living changed or
Time cron "0 */1 * * * ?"
then
hsbValueBulbs = Moodlight_Color1.state as HSBType

    hueValueBulbs   =   hsbValueBulbs.hue.intValue.toString
    saturValueBulbs =   hsbValueBulbs.saturation.intValue.toString
    brightValueBulbs  = hsbValueBulbs.value.intValue.toString

    logInfo("HSB vals:", hueValueBulbs + "," + saturValueBulbs + "," +brightValueBulbs)   
    // sendHttpGetRequest("http://127.0.0.1:8888/all/color/"+hueValueBulbs+"/"+saturValueBulbs+"/"+brightValueBulbs)

    var String colourString = " " + hueValueBulbs+" "+saturValueBulbs+" "

    // logInfo("Moodlights", executeCommandLine("scripts/lifx/colour_setter.py d073d500072c 180 100 100"))

    // office colour

    var String commandString = "scripts/lifx/colour_setter.py "

    commandString = commandString + "d073d500072c"+","+hueValueBulbs+","+saturValueBulbs
    if (MoodLight_Lifx_Office.state == ON) {
        commandString = commandString + "," + brightValueBulbs
    } else {
        commandString = commandString + "," + "0"
    }        
    commandString = commandString + "."

    commandString = commandString + "d073d5010fe5"+","+hueValueBulbs+","+saturValueBulbs
    // living room colour
    if (MoodLight_Lifx_Living.state == ON) {
        commandString = commandString + "," + brightValueBulbs
    } else {
        commandString = commandString + "," + "0"
    }
    commandString = commandString + "."

    logInfo("MoodLight", commandString)

    executeCommandLine(commandString)

    if (MoodLight_TV.state == ON) {
        hsbValue = Moodlight_Color1.state as HSBType
        redValue   = hsbValue.red.intValue.toString
        greenValue = hsbValue.green.intValue.toString
        blueValue  = hsbValue.blue.intValue.toString
    } else {
        redValue   = "0"
        greenValue = "0"
        blueValue  = "0"
    }

    logInfo("RGB vals:", redValue + "," + greenValue + "," +blueValue)           
    sendHttpGetRequest("http://192.168.2.202:7777/views/nook/light_SET/"+redValue+"/"+greenValue+"/"+blueValue)

end

Just ignore the second RGB part - that is for my other homebrew lamp :)

On Sat, May 10, 2014 at 1:10 AM, Petr Klus petr@klus.co.uk wrote:

I know, they are taking their sweet time :(. In the meantime, I use exec
binding in combination with unofficial python api to control my lights
(details in my copy of the code
https://github.com/petrklus/lifx-simpleapi/blob/master/colour_setter.py)

On Fri, May 9, 2014 at 11:51 PM, Christoffer Sawicki <
notifications@github.com> wrote:

Another option is to integrate the Ruby version via JRuby but that seems
like a bit of an overkill :)

For the record: The LIFX library depends on Addrinfo which is
half-implemented in JRuby, so that's not an alternative (unless JRuby is
fixed first).


Reply to this email directly or view it on GitHubhttps://github.com//issues/215#issuecomment-42717830
.

@petrklus
Copy link
Contributor

petrklus commented May 9, 2014

It's not very clean atm but works reliably for my case. Do not want to spend too much time developing something that is going to be obsolete in a matter of months

@petrklus
Copy link
Contributor

petrklus commented May 9, 2014

Regarding looking into Android version - Yes, that is a possibility I will
probably pursue if they take too long. I've tried getting at least vague
ETA from them but I guess they know better than to make promises :).
On 9 May 2014 23:20, "kaikreuzer" notifications@github.com wrote:

It takes terribly long for the Java-API to arrive.
Di you maybe already have a look at the Android version? After all, it is
Java sourcecode and I guess it should not be too difficult to adapt it to a
"pure" Java version, don't you think?


Reply to this email directly or view it on GitHubhttps://github.com//issues/215#issuecomment-42715451
.

@kaikreuzer
Copy link
Member

Thanks for the infos! I am a bit reluctant to go with the Python solution. I'll rather wait a bit longer for a proper Java binding... If they do not tell any ETA for the Java-API, I guess you better start sooner than later looking into the Android version ;-)

@petrklus
Copy link
Contributor

petrklus commented Jun 7, 2014

Update - got a quick reply on twitter saying that the Lifx guys are now focusing their efforts on improving the bulb firmware.

Shortly after that, the beta firmware surfaced and is breaking the currently reverse-engineered protocol:
timothyb89/lifx-java#1

So I think it would be probably best to wait for official Java API

@kaikreuzer
Copy link
Member

But wouldn’t it be an option to use the lify-java project (and hoping that they update it according to the newer firmware version?)
The best answer probably depends on the answer of your question: Is the new firmware automatically rolled out or is that done manually by the users…

Regards,
Kai

Am 07 Jun 2014 um 14:23 schrieb petrklus notifications@github.com:

Update - got a quick reply on twitter saying that the Lifx guys are now focusing their efforts on improving the bulb firmware.

Shortly after that, the beta firmware surfaced and is breaking the currently reverse-engineered protocol:
timothyb89/lifx-java#1

So I think it would be probably best to wait for official Java API


Reply to this email directly or view it on GitHub.

@CWempe
Copy link
Contributor

CWempe commented Jul 15, 2014

I contacted LIFX about their official java sdk.

This is what I got:

"Hey Christoph,
There is currently an unofficial Java port on GitHub, which you may find useful - but as yet we have no current plans to release a Java SDK. [..]"

https://github.com/besherman/lifx-sdk-java

It seems to be newer than the one petrklus posted.
And even if the auther says it's "quick and dirty" I think it might be stable, because it's a direkt port of the android sdk.
But I am no developer and might be wrong about this. :)

@kaikreuzer
Copy link
Member

we have no current plans to release a Java SDK

This is quite contrary to what they announced a few weeks ago...
But well, the project they refer to sounds good enough as it is anyhow based on the Android version of their API.
So @petrklus, do you want to go for it?

@petrklus
Copy link
Contributor

Hi Kai!

I am at the moment testing the ruby gem with HTTP binding on top and I am
quite happy with the solution - so feel free to remove my "claim" for the
binding development for this moment please..

Best,

Petr

On Tue, Jul 15, 2014 at 9:47 AM, Kai Kreuzer notifications@github.com
wrote:

we have no current plans to release a Java SDK

This is quite contrary to what they announced a few weeks ago...
But well, the project they refer to sounds good enough as it is anyhow
based on the Android version of their API.
So @petrklus https://github.com/petrklus, do you want to go for it?


Reply to this email directly or view it on GitHub
#215 (comment).

@kaikreuzer
Copy link
Member

That's a pity, I had hoped you would pick up this task. Wouldn't you agree that a dedicated LiFX binding in Java would be so much nicer than fiddling with Ruby and HTTP...?

@petrklus
Copy link
Contributor

Absolutely! It's more a time issue at this moment to be absolutely honest -
I would definitely like to have it done but cannot justify doing things
unless they are broken (as my hot water solar recirculation currently is
and the landlord is useless).

So I would still like to do it but do not want to be stopping anybody else
if they want to pick it up!

On Fri, Jul 18, 2014 at 4:55 PM, Kai Kreuzer notifications@github.com
wrote:

That's a pity, I had hoped you would pick up this task. Wouldn't you agree
that a dedicated LiFX binding in Java would be so much nicer than fiddling
with Ruby and HTTP...?


Reply to this email directly or view it on GitHub
#215 (comment).

@CWempe
Copy link
Contributor

CWempe commented Oct 19, 2014

Any progress?

In the following video Kai shows controlling a LIFX with openHAB.
https://www.youtube.com/watch?v=uM-nPPnctCg

Is this only working with openHAB 2.0, yet?

@petrklus
Copy link
Contributor

Would love to know!

On Sun, Oct 19, 2014 at 5:44 PM, Christoph Wempe notifications@github.com
wrote:

Any progress?

In the following video Kai shows controlling a LIFX with openHAB.
https://www.youtube.com/watch?v=uM-nPPnctCg

Is this only working with openHAB 2.0, yet?


Reply to this email directly or view it on GitHub
#215 (comment).

@kaikreuzer
Copy link
Member

Hi,

Yes, well spotted ;-)
This is actually being developped for Eclipse SmartHome and it will be officially presented end of this month at EclipseCon Europe: https://www.eclipsecon.org/europe2014/session/bringing-lifx-eclipse-smarthome
In consequence, this will only be available for openHAB 2.x, not 1.x.

Regards,
Kai

Am 19 Oct 2014 um 21:46 schrieb petrklus notifications@github.com:

Would love to know!

On Sun, Oct 19, 2014 at 5:44 PM, Christoph Wempe notifications@github.com
wrote:

Any progress?

In the following video Kai shows controlling a LIFX with openHAB.
https://www.youtube.com/watch?v=uM-nPPnctCg

Is this only working with openHAB 2.0, yet?


Reply to this email directly or view it on GitHub
#215 (comment).


Reply to this email directly or view it on GitHub.

@CWempe
Copy link
Contributor

CWempe commented Oct 19, 2014

That's good and bad. ;)

Makes waiting for 2.0 even harder.

@kaikreuzer
Copy link
Member

FYI: I plan to release an 2.0 alpha on Nov 23, which should allow running the new bindings together with 1.x addons through a compatibility layer. Hoping to get it usable by then :-)

@petrklus
Copy link
Contributor

Excited!!

Are the binding going to be part of the https://github.com/openhab/openhab2 repo?

Also, re. LiFX - which way did you decide to go with the binding, which library are you using?

@dnobel
Copy link
Contributor

dnobel commented Oct 22, 2014

Hi,

I´m developing the LIFX binding for Eclipse SmartHome. It supports auto-discovery of bulbs and changing the color, which works very stable and fast. Unfortunately LIFX only provides an official Android SDK, but no Java SDK. So I decided to use a Java fork of the official Android API SDK (https://github.com/besherman/lifx-sdk-java), which works quite good. As Kai mentioned, i will present it at the EclipseCon next week. I plan to contribute the binding this weekend.

If you want to try it out now, you can find it at my ESH fork (https://github.com/dnobel/smarthome/tree/lifx/binding/org.eclipse.smarthome.binding.lifx).

Regards

Dennis

@petrklus
Copy link
Contributor

Thank you for the update - will have a look!

To help me understand though - what would decide if a binding is part of ESH or OH? Is the binding going to be part of OH only if inclusion into ESH is not possible due to licensing reasons?

@kaikreuzer
Copy link
Member

See https://github.com/openhab/openhab2/blob/master/docs/sources/development/bindings.md#choosing-a-namespace

Actually, all ESH bindings will be made available in openHAB2, but not everything from openHAB2 will be available for any ESH-based solution.

@teichsta
Copy link
Member

so how are we going to proceed with this Binding? Is anybody volunteering to downport the Binding (to some degree)?

@kaikreuzer
Copy link
Member

I'd vote for closing it and rather concentrate on making the other 1.x add-ons working smoothly on openHAB 2 runtime, so that people can move.

@petrklus
Copy link
Contributor

Depends - how long is the OH 1.x expected to be around?

On the 1.x, I've moved from the EXEC binding to lifx-http
https://github.com/chendo/lifx-http (using the official ruby API in the
background) + a few simple rules to act on an item change. Very happy with
the system at the moment, fast response and I also get nice API for the
lights for further development.

@petrklus
Copy link
Contributor

@kaikreuzer I agree - I do not think anyone would get massive amount of utility from it. There are other ways to make it work with 1.x and they work very well! (just my opinion of course)

@CWempe
Copy link
Contributor

CWempe commented Jan 14, 2015

I think I read somewhere that rules are not implemented in openhab2, yet.
If this is still the case, it would be a BIG no-go for many users befor migration from 1.x to 2.x.
Regardless of how many bindings are compatible.

I didn't know about the "other ways to make it work" until now.
So I wont be screaming "I need a LIFX-binding for 1.x!". ;)

@kaikreuzer
Copy link
Member

I think I read somewhere that rules are not implemented in openhab2, yet.

No, that's wrong. Rules work just like for openHAB 1. It is only the case that we are also working on a new rule engine, which is not yet in place.

@CWempe
Copy link
Contributor

CWempe commented Jan 15, 2015

btw: There is a official HTTP API comming for lifx.
chendo/lifx-http#4 (comment)

Let`s hope sooner rather than later. ;)

@kaikreuzer
Copy link
Member

btw: There is a official HTTP API comming for lifx.

Yeah, but if you read chendo/lifx-http#4 (comment), you will see that it will be hosted, i.e. cloud based. So rather useless for a decent openHAB integration.
What is more interesting is the information in chendo/lifx-http#4 (comment), that the private APIs of LIFX provide event mechanisms so that no state polling is required.

@llamahunter
Copy link
Contributor

There's this Java SDK, too. sort of unofficial, but reversed engineered from the official Android SDK.

https://github.com/besherman/lifx-sdk-java

I, for one, would prefer an non-cloud solution. I hacked up a Lifx solution for SmartThings using some reverse engineered node.js libraries. Worked reasonably well... except that SmartThings itself didn't work reasonably well as a hub (it ran everything through the cloud).

@kaikreuzer
Copy link
Member

@llamahunter This is the library that is used in the openHAB 2 LIFX binding, see https://github.com/eclipse/smarthome/tree/master/binding/org.eclipse.smarthome.binding.lifx/lib
But it is not perfect, there are some performance issues with it. I would very much prefer an "official" Java implementation, but I am afraid that we will not see one from LIFX.

@dnobel
Copy link
Contributor

dnobel commented Feb 7, 2015

The LIFX Binding uses version 1 of the the besherman lifx-sdk-java lib. The original library was just a fork of the Android SDK and ported to Java without modifications of the API. As LIFX stopped all activities on github and no further development was made, the author decided to write a completely new library (see also https://github.com/besherman/lifx-sdk-java#history). Maybe this library is better then the original LIFX library and does not have these performance issue.

@kaikreuzer
Copy link
Member

Ah, right, thanks for the correction!

@CWempe
Copy link
Contributor

CWempe commented Feb 7, 2015

Before anybody starts to integrate the new lifx-sdk-java, keep in mind there is a new firmware 2.0 for LIFX.
I don't know if there are any changes regarding the local API.

There is also a new cloud API.
You can find information about requesting a beta access here: chendo/lifx-http#27 (comment)

But I think a local binding is preferred to a cloud binding.

@brutevinch
Copy link

Hi. Is there working binding lifx (2.0 firmware) for openhab1? Really need kelvin support and stable connect. My problem is in connection. i tried to use lifx-http but sometimes it doesn't react at all, same thing with OH2 binding. I think problem is in firmware2 support because original iOS app and ping from PC to LIFX is great! In Developer Zone of site LIFX there are enough documentation about local protocol, but i'm not a programmer((((( Please reopen issue.

@petrklus
Copy link
Contributor

petrklus commented Aug 8, 2015

@brutevinch Same problem here - I wanted to get some "local" control as my internet connection is not very stable (and thus the cloud api is not working very well). Installed OH2 + LiFX, discovery went well but after a few hours I started getting nullpointer exceptions from the binding and could no longer control some of the bulbs (openhab/openhab-addons#328)

@llamahunter
Copy link
Contributor

So, there's now a published V2 protocol doc from lifx. Is anyone working on a binding? https://github.com/LIFX/lifx-protocol-docs

@kaikreuzer
Copy link
Member

Yes, @kgoderis implemented the new protocol: eclipse-archived/smarthome#483

@brutevinch
Copy link

@kaikreuzer is this for OH1 too?

@kaikreuzer
Copy link
Member

No, Eclipse SmartHome bindings only work on openHAB 2.

hubermi pushed a commit to hubermi/openhab that referenced this issue Jan 10, 2017
Windows build does not start with included batch files openhab#215

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants