MQTT IRC Bot/Bridge

It has been a long time since my last blog post. I was incredibly busy with HiveMQ and my focus pivoted to M2M in general and MQTT, an awesome, ultra-low footprint protocol for the Internet of Things, specifically. In the future this blog will also cover these things.

I had some spare time this weekend and decided to do some fun programming. The result was a MQTT-to-IRC or IRC-to-MQTT bridge bot. Although it is a fun project, it turns out that there are real useful use cases for that and because of that I decided to share it :)

How to use

The first step is to download or clone my Github Repository. Then, on the command line, simply run:

mvn clean package

Copy the jar file to a directory of choice and create a config.properties file with the properties according to the documentation. An example config:

broker.host=localhost
broker.port=1883
mqtt.clientId=mqttbot

irc.hostname=irc.freenode.net
irc.port=6667
irc.nickName=mqtt_bot_
irc.channels=#myircchannel1,#thesecondchannel

The next step is to install a MQTT broker locally. To do this, go to http://www.hivemq.com and download the latest version. HiveMQ is an advanced enterprise MQTT broker which is made for use cases where scalability, extensibility and reliability is key. It is also perfect for private MQTT projects. Please follow the quick start at here to install HiveMQ.

After installing the HiveMQ MQTT broker locally, start the bot and try publish a MQTT message with a tool of choice on the topic „irc/#%yircchannel1“. Now your message should appear in the corresponding IRC chat.

Of course it is also possible to get all messages via MQTT. Just subscribe to the topic „irc/%myircchannel1/messages“ and you should receive all messages of the IRC chat.

Huh? Why should I do that?

At first sight this does not make any sense why one would do that. When taking a second look, you will realize that you could connect any things to a chat with humans. You could send an IRC message when someone enters a door, when your Jenkins has build results, when a Github Commit occurs, and so on.

Also, you may probably want to get a Andorid Push Notification when someone writes your name in an IRC chat. And if you think this does not make any sense, at least it was fun hacking on :-)

Share this Diese Icons verlinken auf Bookmark Dienste bei denen Nutzer neue Inhalte finden und mit anderen teilen können.
  • MisterWong
  • del.icio.us
  • Google Bookmarks
  • Facebook
  • TwitThis
  • DZone
  • Digg
  • Print

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert