I’ve been following Mark Pesce on Twitter ever since I watched his brilliant closing keynote at Web Directions South in 2008. A few months ago he started hinting at a #sekritproject in his tweets. I had no idea what it was back then but I didn’t have to wait long to find out. He unveiled the Light by Moore’sCloud on the 5th of October – I was captivated both by how it looked and the latent potential it embodied. Was this the first “thing” in the Internet of Things? A few weeks later the Light was on Kickstarter. After watching the first video of the device I immediately had an idea for how to use it – as a Build monitor for Bamboo.
Using the Light to display Bamboo build information felt like such a natural fit. The 3×3 grid of lights on each side would allow for “slices” of light to be used to display state data over a period of time. That’s quite a bit of information for just 3 slivers of light. I converted my thoughts into some diagrams which showed the various states.
I ran the idea past Mark and he was pretty excited. I spent some 20% Time creating a Bamboo plugin to communicate build status back to the Light. The initial pseudo code I looked something like this:
// get last 3 build results from Bamboo
// push the state to the Light
// while build is running, update progress every 500ms
// when complete push the new state to the light
Fleshing it out in the plugin was quite straight forward after that. At the time there were 3 REST endpoints available:
The ajaxcolor endpoint sets all lights immediately to a specified colour – we needed to do a “slice” so this wasn’t useful for us. Then there is gradiencgi which transitions all lights to a specified colour over a period of time – nice but doesn’t help with the slices. Lastly there’s setlights.py which allows each of the 52 lights to be adjusted individually – perfect!
We abstracted the lights for each slice into arrays and created another set to handle displaying the progress on the front face. Sending the data to the light is a simple JSON post. Getting the data from Bamboo was simple due to the fantastic work the Bamboo team have been doing in fleshing out and documenting their API over the last year or two. We wired the slices and progress lights up to the build data for a plan (hard coded for this demo) and then it was time to test!
Actually testing our plugin on one of the Lights was fun. Mark gave us access to Huey (he’s affectionately named his 3 prototype lights Huey, Dewey and Louie) for an entire afternoon. We began triggering builds on a Bamboo instance here in our Sydney office and were able to see Huey change via Skype. A cheer went up when we first saw those little lights turn on.
Overall this was one of the most enjoyable 20% projects I’ve worked on. Huge thanks to the Bamboo team for building such an awesome product (and Brydie for the plugin work).