DIY: Building a busy light to show your Slack presence
Tags: slack, wfh, homebridge, meetings
Published: 2021-03-17 08:47:46

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jxqnwld8u4f8pa703l3i.jpg)

> **Info**: The related article: [Building a busy light to show your Microsoft Teams presence](https://www.eliostruyf.com/diy-building-busy-light-show-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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/evb1s0oy5wtphzuxp38g.png)

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](https://github.com/estruyf/homebridge-presence-switch-msgraph) and removed all the authentication and Microsoft Graph logic.

> **Info**: [Homebridge presence switch connected to Slack](https://github.com/estruyf/homebridge-presence-switch-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](https://github.com/estruyf/homebridge-presence-switch-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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dmu9kxqubihp9aejwnrv.jpg)

## The hardware

The hardware is still the same as the one I used for the Microsoft Teams Busy Light: [busy light hardware](https://www.eliostruyf.com/diy-building-busy-light-show-microsoft-teams-presence/#the-hardware).

## The server

To control the LED HAT on the Raspberry Pi, I use a service I wrote in `Python`: [the busy light service](https://www.eliostruyf.com/diy-building-busy-light-show-microsoft-teams-presence/#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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/krl2x7ceadnvxdfrh643.png)

You can find more information about the Homebridge plugin installation process on the repo its readme: [plugin installation](https://github.com/estruyf/homebridge-presence-switch-slack#installation);

*Article originally published to [eliostruyf.com](https://www.eliostruyf.com/diy-building-busy-light-show-slack-presence/)*