DEV Community

Cover image for DIY: Building a busy light to show your Slack presence
Elio Struyf
Elio Struyf

Posted on

DIY: Building a busy light to show your Slack presence

Going back a year in time, I created a post about building my Busy Light, which I connected to the Microsoft Graph. Homebridge is used to control the busy light, its colors, and statuses.

Busy light controlled by Slack presence

Info: The related article: Building a busy light to show your Microsoft Teams presence

The busy light has been running without issues since I hang it at my office until earlier this week. It did not break. It was because I stopped using Microsoft Teams and switched to Slack.

Reason: I moved to another company.

Getting my busy light working again

To be sure that my wife and kids know I am in a meeting. I had to dive into the Slack APIs to understand how presence works in Slack.

Slack and Microsoft Teams' significant difference in your presence is that Slack only has two presence states: online and away, where Microsoft Teams supports many more.

I was checking at my new colleagues and reading some articles. Slack uses a combination of the presence and the user's status.

Slack status messages

Like the Google Calendar app, some apps can automatically change your status when jumping into a meeting.

To make Slack's presence work with my busy light. I started by creating a fork of the Homebridge Presence switch connected to Microsoft Graph and removed all the authentication and Microsoft Graph logic.

Info: Homebridge presence switch connected to Slack

The logic of calling the Microsoft Graph got replaced by calling the profile-, presence-, and dnd-API from Slack.

By calling these three APIs, the Homebridge plugin can provide you the following busy light states:

  • Available
  • Away
  • DnD
  • Offline
  • <Slack status>: This is a state you control yourself. You can add all your status texts and their corresponding colors.

You can find more information about the plugin and the installation process on the Homebridge presence switch connected to Slack repository.

Important: The Homebridge plugin also creates additional switches for each of the presence states. These switches allow you to automate your home even more. Like for instance, when I go to a meeting, my speaker will automatically stop playing.

Presence switch

The hardware

The hardware is still the same as the one I used for the Microsoft Teams Busy Light: busy light hardware.

The server

To control the LED HAT on the Raspberry Pi, I use a service I wrote in Python: the busy light service.

The Slack permission scope

The Homebridge Presence Slack App I have created will ask you to consent to the following permissions to get the information it requires to control the lights correctly.

APP Permissions

You can find more information about the Homebridge plugin installation process on the repo its readme: plugin installation;

Article originally published to eliostruyf.com

Top comments (0)