Remote teams ring office bell with Raspberry Pi and Slack
Bustling offices… remember those? It feels like we’ve all been working from home forever, and it’s going to be a while yet before everyone is back at their desks in the same place. And when that does happen, if your workplace is anything like Raspberry Pi Towers, there will still be lots of people in your team who are based in different countries or have always worked from home.
This office bell, built by a person called Alex, is powered by a Raspberry Pi 3B+ and is linked to Slack, so when a milestone or achievement is announced on the chat platform by a remote team member, they get to experience ringing the office bell for themselves, no matter where in the world they are working from.
- Raspberry Pi 3B+
- Servo (Alex used these)
- Hammer arm (Alex had this one 3D-printed)
- This Python script Alex wrote using the Python
Integrating with Slack
To get the Raspberry Pi talking to Slack, Alex used the
slackclient module (Python 3.6+ only), which makes use of the Slack Real Time Messaging (RTM) API. This is a websocket-based API that allows you to receive events from Slack in real time and send messages as users.
With the Slack RTM API, you create an RTM client and register a callback function that the client executes every time a specific Slack event occurs. When staff tell the @pibot on Slack it’s ‘belltime’, the Raspberry Pi tells the servo to ring the bell in the office.
Alex also configured it to always respond with an emoji reaction when someone successfully rings the bell, so remote employees get some actual feedback that it worked. Here’s the script for that bit.
Alex also figured out how to get around WiFi connectivity drops: they created a cronjob that runs a bash script every 15 minutes to check if the bell ringer is running. If it isn’t running, the bash script starts it.
At the end of Alex’s original post, they’ve concluded that using a HAT would allow for more control of the servo and avoid frying the Raspberry Pi. They also cleaned up their set-up recently and switched the Raspberry Pi 3B+ out for a Raspberry Pi Zero, which is perfectly capable of this simple job.
Whilst it’s a clever thing I have a major hate for offices and companies that have the bell thing on “something good happening” and at any place i’ve worked that has done the bell thing i’ve either damped the clapper or hidden the bell where no one can find it as after the 2nd or 3rd time it gets really annoying when you are trying to work/concentrate or have a conversation.
In my office, my colleagues used to have a crisis everytime my deskphone rang as it was set slightly louder than just audible. Theirs were set to be inaudible. I covered my phone with foam padding to keep them happy! (We are all software engineers…)
That’s a lot of processing power to do a WiFi equipped microcontroller’s job…
Can you remind me what an office is? Since March 16th, I’ve been to a client’s office once (on 25th June that very hot day – so I took advantage of going somewhere air conditioned). I’ve never seen one of these happy clappy places with a bell, the only bells we used to have in offices (back in the days before 1997 when I started working at home) were the ones in the desktop, wired plain old telephones.
The Raspberry Pi Party requires all elected public servants to wear non-removable shock collars, to remind them who they work for!