Stockholm Dev Team Streamlines Caffeine Availability for Optimal Work Enviroment

Stockholm Dev Team Streamlines Caffeine Availability for Optimal Work Enviroment

Fresh Coffee For All at Narrative

Two of our amazingly talented developers, Joakim and Johan, explain how to set up your own fresh coffee alert. Sweden has one of the highest coffee consumption per capital in the world and the Narrative Team is doing its part to keep it that way. Read below as Johan walks us through the process so you can set up your own system and keep your office running smoothly.


 

Recently a fellow developer here at Narrative and I sat down after work to improve our company bot. We’re using Hipchat to communicate across our offices and also internally at the offices. In the chat we also have our trusted Hubot that keeps track of things for us. Hubot gives us developers information about what’s going on at Github, who’s in charge of keeping the kitchen clean this week and so on. But it’s also fairly simple to make Hubot do other nice things.

Joakim happened to have a Spark Core laying around and had bought some sensors for it. Naturally, we wanted to play with it, but what could we do? The answer was simple, of course we should build a solution that would tell us when the coffee is ready! (Entirely Joakims idea, he’s a smart guy). After all, the old solution needed an upgrade.

What you’ll need:

The setup:

The sensor hooked up to the Spark was added to our coffee maker, you can see it in the photo. The Spark will then detect changes in water level. It samples for changes every 10 seconds and if there’s a connection it will send a web hook. This hook is sent to a small node.js express app running on Heroku. You can see the status screen on the top right photo, no coffee is apparently being brewed right now :(.
Once we get a connection we wait for “no more water”. When that happens we know that the coffee will be ready in 4 minutes. We used a simple timer to figure out those 4 minutes. So now we know when coffee is being brewed and when it’s done. But we have no way to actually tell our co-workers about it. Enter Hubot. After we had all this we wrote a small plugin for hubot with two web hooks.
Whenever we get the first connection it means someone have poured water into our coffee maker. When this happens we call hubots “Coffee is being made” web hook. When we know the coffee is done we send the “Coffee is done”. So now Hubot notifies the entire office when they should run down to the kitchen to get their fix.

spark code

hubot script

Heroku code

Oh, and of course we wanted to keep track of how much coffee we’re making. So everything is saved to Parse.com. We plan on making some graphs on the coffee consumption next. Stay tuned!

SEE ALSO:  Want to love your job? Narrative is hiring!

If you want the code clone, get it from GitHub.

Pre-order your Narrative Clip 2. Be the first to capture your moments with the world’s most wearable camera!