News for hackers. Stuff that matters.
Re:Philips Hue API Hacking by kevingadd on Wednesday December 12, 2012 @02:29AM (#4909084)
Why does the Hue class have an argumentless constructor that must immediately be followed up with attribute initialization and a call to the actual constructor? Kind of a nitpick, but definitely doesn't seem pythonic - or obvious.

Cool hack though, API looks straightforward.

Re:Philips Hue API Hacking by izak30 on Wednesday December 12, 2012 @02:55AM (#4909135)
I haven't gotten around to writing an application with it yet, just futzing from the terminal. I agree that it's a wart, I pretty much stopped once I got it all working here, and until tonight I haven't had much outside interest in this one.
Re:Philips Hue API Hacking by timClicks on Wednesday December 12, 2012 @04:39AM (#4909337)
I would also change h.lights.get('l3') to h.lights[l3] by defining __getitem__(). Possibly even cut this back to h[13], as you'll always be referring to the lights.
Re:Philips Hue API Hacking by masklinn on Wednesday December 12, 2012 @06:48AM (#4909624)
And setState should probably take kwargs rather than a dict of arguments. Might also be cool to use a context manager for a "complex send" e.g.

    with light:
        light.bri(220)
        light.alert("select")
which would only send the whole request at once in __exit__, as in "transactional" APIs.
Re:Philips Hue API Hacking by izak30 on Wednesday December 12, 2012 @11:58AM (#4911114)
I do really like this one. Been trying to think of a decent way to do pipelining. If you haven't noticed, it is possible to do chaining with the existing API, but it's one request/call.