Not your standard io.

keg.io Development Continues...

Last weekend Chris, Dylan, Garret, and I had a mini hack-a-thon to try and bust out some more code. We were able to reliably get all the GET and PUT requests to the keg.io server in AWS working reliably. Dylan also was able to get a ton of routes done. This also included logging all of the REST api calls from the Arduino into the DB. I guess I should back up a bit and explain a bit of the architecture.

Originally we had an Arduino with a custom shield that talked to a server running node.js over a usb serial connection. As you can imagine this is probably not the best communication method, plus we need to have a computer running next to the Kegerator. Now with the help of sparkfun’s wifly shield we are now going send HTTP requests over wifi. Rad. This will eliminate the computer entirely and allow us to develop and host the server in AWS. Here is a list of all the GET routes we have for the Web UI:

GET

/hello - basic ping of the keg,io server

/config/socketPort - Retrieving the port to use for websocket connections

/kegerators/ACCESS_KEY/temperatures - Get temperatures for a kegerator

/kegerators/ACCESS_KEY/users - Gets users of a kegerator based on recent pours

/kegerators/ACCESS_KEY/pours - Get pours from a kegerator

/kegerators/ACCESS_KEY/kegs - Get the list of kegs used in this kegerator

/users - Get info about users

/users/RFID - Get user info

/users/RFID/coasters - Get users earned coasters

/coasters - Get info about coasters

/coasters/ID - Get info about coasters

There are also a set of API routes for the Ardunio code to interact with. These are routes designed for the Kegerator to interact with the server. They include things like, Authorize a User, Get the Keg temp, and record the flow of the beer. Since each Kegerator is unique, all the requests are signed with a secret key and hashed with SHA256-HMAC to verify it’s sender. The server then sends back a hashed response with the same key for the Arduino to validate and open the Kegerator. No, you can’t replay the hash.