Tuesday, June 03, 2014

What's MQTT and how can you use it?

MQTT is a machine to machine protocol that runs over the top of HTTP. Think SOAP or REST, but designed to be a lot smaller.

Unfortunately, the documentation on the main site is very much about the protocol, not what you can do with it.

The key difference between SOAP or REST and MQTT is the idea of a broker is built in from the start. Instead of point to point connections, everyone just publishes and reads from centralised locations.

While you can do that with SOAP or REST, it's not common - and there are very few public instances of RabbitMQ or similar just sitting around to play with.

Not so with MQTT.

Here's some examples:

  • Publish Jenkins broken build results to a broker and turn up the local airconditioning a few degrees to help people really feel the heat
  • Use Owntracks to identify waypoints (Home, Work, X, Y, Z) and publish when you get near a geofence.
  • Hey Huginn, see that Owntracks notification? Check me in on foursquare [well, I have to write this bit] when I'm at the pub waypoint.
  • Hey TheThingSystem: turn off the local aircon when I leave the home geofence according to Owntracks.
  • Hey NinjaBlocks turn off the powerpoints you control [again, has to be written, but it's not far off] when the amount of Owntracks presence sensors at waypoint home drops to 0.
Pretty neat stuff. You can tell why IBM think it's the bee's knees - they want to integrate a whole bunch of industrial or medical stuff into this and sell Websphere MQ.

This all seems pretty exciting, as does IFTTT or Zapier, but you quickly realise there's either limits (because it's not designed for programmers) or you need some serious neckbeard to get things working.

Over the next few posts, I'll be documented specific HOWTOs and some of the pull requests or contributions I'm making to remove some of that pain.

No comments: