IRC bot that sends MQTT Messages

Just a small project I did for fun but maybe someone will find a good use for it. Maybe you want your botnet command and control server to be able to trigger things in your house.

This is an IRC bot that will join a channel and then listen for commands, defined with yaml in config file, that will then send an MQTT message.

It will accept commands from anyone (not sure there would be a real secure way to verify identity) so be aware of that and don’t setup an automation to open your garage door or something. So please keep potential risks in mind.

The easiest way to get it going is to use the image on Dockerhub (it’s built by Dockerhub with the Dockerfile in the repo (based on the Python Debian Buster-slim image)) or there are instructions from running it manually.

First start the container

docker run -d -v /docker_files/ircmqttbot/config:/home/appuser/config \

Then copy the the example_config.yaml (see the Github repo) file to your shared volume named config.yaml and fill out the information.

The config section is for the information for you MQTT host and the IRC stuff, then the command section contains 2 examples (to turn some lights on and off) the name of the entity under command is the command that if the bot sees in IRC will trigger it.

    lights on:
      topic: "irc/light"
      message: "on"

You can replace these or add as many as you want.

Then on Home Assistant here is an example of an automation based on this

alias: IRC Turn On Light
  - platform: mqtt
    topic: irc/light
    payload: 'on'

  - service: light.turn_on
        - light.bed_left_lamp
        - light.bed_right_lamp

Ideas, feedback, pull requests all welcome. Also if anyone does think of a good use for this would love to hear it (again just keep in mined the potential risks)

Github repo
Dockerhub Image