Last June we had a Hackday at Kogan.com! This Hackday’s focus on displaying information and providing useful alerts using hardware and software. Teams were asked to express something they find interesting through one of the available mediums.
In this third and final part of the series Jake will talk a bit about Team LifxnChill.
Our team was given a set of 5 smart Lifx Tiles. These nifty light panels are 8x8 LED grids of dissipated lights. Five tiles can be chained together, arranged and animated. They’re programmable using an API (docs here). Each tile cannot be programmed separately. These have great potential for expressing all kinds of stuff.
Ideas proposed included the following:
Use github webhooks to do something with the lights when a commit is pushed, a pull request is merged/closed, or a deviant force pushes.
Standup Glow - Pulse when standup kicks off
Stretch goal - animations
Plan of attack
1. Write experimental commands
2. Create endpoints that use the commands
42. Create lambda functions for other stuff
We never got around to writing up steps 3 to 41. Steps 1, 2, and 42 were enough to get started!
Two APIs were available; LAN and HTTP:
HTTP - Send off basic requests, such as pulses, brightness and cycles. Authenticated by an oauth token. This was low entry and really fun to see ideas come together. Team members could POST requests and see the result immediately.
curl -X POST "https://api.lifx.com/v1/lights/all/effects/breathe" \ -H "Authorization: Bearer YOUR_APP_TOKEN" \ -d 'period=2' \ -d 'cycles=5' \ -d 'color=green'
Keep me POSTed - Lifx Tile
LAN - Limited to, you guessed it, the Local Area Network. The lower latency LAN API allows calls to map each individual light rather than a whole tile. This meant you could use animations. We initially tried this with an existing package called photons-core but opted for HTTP for reasons we’ll later explain.
The LAN API was looking promising, until we discovered the complexity involved in getting the tiles running. Remember we only had one day here, so the focus had to be on getting something out. Using a local network also made it difficult for a team member working remotely to participate. With these factors in mind we opted for the HTTP API.
While developing with the tiles, we discovered often API calls were not coming through. We suspected it was to do with throttling, but cumulatively the team’s usage was nothing should have triggered it. It turned out the Tiles had a bug:
WHEN all Lifx Tiles are off
AND a cURL request is sent
All tiles animate according to the options sent
The first master tile ignites, but it’s daisy-chained titles do not
When all tiles are off, you can’t power them all on with a single request (Which was incredibly frustrating). As a proof of concept everything worked, but a dealbreaker for day-to-day usage.
At this point I decided to post on Lifx’s forums seeking an answer. Not long after they posted a firmware update and voilà! The Tiles became usable.
We now have a proof of concept standup reminder, an Orange/Red/Green status integrated with our jenkins pipeline and a glow each time a commit is made.
In the future we’d like to move these actions over the LAN API with endpoints that our pipeline can hit, allowing the use of animations.