Hodor: Controlling the office door from Slack

Nithish Raghunandanan
KI labs Engineering
5 min readFeb 20, 2018


At KI labs, we have a beautiful office in the city centre of Munich, next to the famous Frauenkirche. Unfortunately, only two members of our rapidly growing team have keys for the office. Whenever someone comes to the office, the disturbing noise of the doorbell disrupts the deeply-focused developers. Someone has to take one for the team and press the button on the intercom, which is located far away from the desks. This is not only annoying but also disturbs their flow.

As a company full of engineers, we no longer wanted to keep this happening and implemented an agile solution like in our daily work. We formed a small team and hacked together the following solution in two evenings over a beer.

Our Solution: Hodor

Before we started, we gave ourselves three criteria:

  • As easy and fast to implement as possible
  • As convenient to use as possible
  • As cheap as possible

We checked out some of the cool possibilities from others like [1] and [2]

To open the door as easy as possible, we tried to use the existing infrastructure and to integrate the hardware directly into the intercom. As everyone uses Slack anyway, we created a Slack bot, which listens to /door and triggers an action.


Hardware Setup

We decided to use a Raspberry Pi 3 as the main hardware component. It is reasonably cheap and easy to use. In our setup, it is connected to our local WiFi.

We imitate a button press on the intercom by short-circuiting the physical button on the intercom. This is done by using a simple relay which is controlled by the Raspberry Pi.

The relay uses 5 Volt supply voltage and Ground (GND) which are both supplied by the Raspberry Pi. The relay’s input pin must be tied to GND to be triggered. As shown in the figure, we accomplish this by using a bipolar NPN transistor as a switch between the relay and the general purpose input/output (GPIO) pin of the Raspberry Pi. The base of the transistor is connected to the GPIO (with a 1k resistor for current limiting). Once the GPIO is triggered, the transistor starts conducting and the relay’s input pin goes to GND, which switches the relay and closes the circuit on the intercom.

Wiring the hardware together

Door Opening Service on the Raspberry Pi

We needed a simple server to receive commands from the slack bot and activate the relay to open the door. For this, we created a Node.js application, which runs as a service on port 80 of Raspberry Pi. This service listens to a specific request from slack bot indicating the door opening intent. On validating the request, a predefined GPIO pin is activated (in our case pin 11).

We added a cron job to ensure that the service is started on reboot in case the power supply is disrupted. We added a line like the following to the crontab:

@reboot /path/to/node /path/to/the/app.js &

Exposing the Service to the World

Once the Node.js service on Raspberry Pi starts running, we need to expose its service on the internet for it to be accessible from the slack bot. For this, we installed Dataplicity on the Raspberry Pi. They have an option of a free account, where you can access your device via an interactive terminal. There is also an option (called “Wormhole”) to expose a service running on port 80 of the device to the outside world. We activated the wormhole and were able to access the service outside the local network. This also enables us to add other services (read: Voice Assistants 😉) to open the door.

Code for activating the relay

Slack Bot

The simplest way to create a Slack integration was the slash command. So we built a custom slash command /door which is handled by a small Python-based web service. This service is completely stateless and is perfect to be served on AWS Lambda.

Slack bot in action

The service handles all the slack events for the command and checks the requests for security. We set up some security checks like:

  • Enabling the opening of the door only during office hours
  • Ensuring that the users are authorised by limiting the service to a specific Slack channel
  • Keeping a history of all requests by storing the requests with the timestamp on a cloud database (DynamoDB)

We discovered Zappa which did all the heavy lifting of deployment of lambda functions to AWS. It needs just two commands to deploy the app (Developers dream!).

Future Work

The focus of this solution was to efficiently build a minimal viable product (MVP) to solve our biggest pain of operating the intercom. When we get the next opportunity, it would be cool to try these ideas:

  • 3D Print a case for it to look as good as it works 😉
  • Detect the ringing of the bell and post a message on Slack with an option to open the door.
  • Add an integration to Amazon Alexa or Google Assistant to open the door.

In case you want to replicate this for your office, you can find the code on our Github repo at https://github.com/KI-labs/Hodor. And we are open to your questions and pull requests 😃

And in case you are interested in joining us, we have several openings at www.ki-labs.com