Automatically raise your desk when joining a Microsoft Teams call or meeting

colorful toothed wheels
Photo by Digital Buggu on Pexels.com

Like many people, I participate in many calls and meetings on a daily basis in Microsoft Teams.

Like many people, I also work at home a lot of the time.

Like some people, I have a powered standing desk.

And like some people, I have an unhealthy desire to tinker with things that could probably be done a lot simpler.

So, before we go any further, let me state that what you’re about to read comes from the files of “because I could”.

It joins the ranks of my previous post on How to display the currently playing Spotify track as your Teams status message, and How lazy can you get by combining Alexa and Microsoft Teams?

The Challenge

Still with me? Great!

In a previous episode of over-complicated solutions nobody asked for, I showed how it was possible to trigger automations based on your Microsoft Teams presence using Home Assistant and Microsoft Graph.

Since then, I’ve been wanting to be able to add my standing desk into the mix so that it automatically raises whenever I join a meeting or start/accept a call in Microsoft Teams.

My standing desk is fantastic, but I often forget to put it in standing mode throughout the day. I personally find that while I’m standing, I tend to be more creative and engaged in meetings, as I can step back from the desk and not be tempted to use the keyboard & mouse to click on other applications.

In order to give desk owners more control, some standing desks allow you to connect to them from an app on your phone using a Bluetooth Low Energy (BLE) module. In my case, the desk used a re-badged JCP35N-BLT unit. Depending on the app you can schedule set times and reminders to stand up, which is very handy. Unfortunately, the particular app for the module I have didn’t have many features, and some of the ones there didn’t work. In fact, the supplier stopped selling them on their website.

The problem here is that I can’t simply take any other module and plug it in – these are often proprietary devices that have specific codes and keys to work with each other. So, unless I spend some unnecessary money to replace the controller unit, I was stuck. Instead, I chose to spend some unnecessary time and effort to make it work.

Now, you might be thinking “surely you could just press a button that is merely centimetres from your hand” – and you would be right. But that’s not why you’re still reading this. Otherwise, this is your last chance to stop before the crazy, over-complicated, unnecessary solution begins.

The Solution

As I mentioned earlier, I already have an automation that runs when my Microsoft Teams presence indicates that I’m in a call. This automation changes the tablet display screen outside of my home office, and changes the colour of the LED strip behind me to red. In order to get my standing desk into this automation, I needed Home Assistant to connect to the BLE module. For that there are three main parts to the solution: controlling the desk without the app, connecting the control to Home Assistant, and adding the desk control to the existing automation.

Part 1 – Controlling the desk without the app

Luckily, I already have a Raspberry Pi Zero 2 W connected to the UPS under my desk. This $80ish device connects to Home Assistant and makes the UPS network-connected, which is considerably cheaper than an actual network-connected UPS that cost considerably more.

As this device is already running a flavour of Linux and includes BLE capabilities – the key was to somehow trigger the desk from the Pi.

Thankfully, I stumbled upon a repository on GitHub created by someone who had the same desk BLE module and frustrations as me. He had created a simple script that allows you to trigger the desk to use the pre-set memory points to either sit or stand. All it required was to replace the Bluetooth address in either the script or Python3 file (depending on which you prefer to use) with the address from your own BLE module.

It is a simple yet brilliant solution, and I am incredibly grateful to the developer for doing the hard work to figure it out.

Part 2 – Connecting the control to Home Assistant

My Home Assistant runs on a virtual machine inside on my NAS, in a completely different room from my home office. Therefore, I needed a way to execute remote commands on a Linux machine, from Home Assistant.

Again, someone had already done the hard work of figuring this out and documenting it, which again made my life a lot easier.

In my configuration.yaml file I have the following lines for my remote commands:

shell_command:

ls_desk_stand_command: ssh -i /config/ssh/id_rsa -o ‘StrictHostKeyChecking=no’ loryans@piupsmon.strant.com ‘~/desk-control/desk_control.sh -s stand’

ls_desk_sit_command: ssh -i /config/ssh/id_rsa -o ‘StrictHostKeyChecking=no’ loryans@piupsmon.strant.com ‘~/desk-control/desk_control.sh -s sit’

Part 3 – Adding the desk control to the automation

Using the existing automation, I simply added the following action:

Now, having machinery operate automatically while you’re using them can be a dangerous thing, so I decided to leverage the Alexa Media Player integration to send me an audible notification that my desk was about to stand

And in order to get the timing right I needed to add a delay from when the notification is triggered to when the actual desk begins to stand, so the final sequence looks like this:

(I’m fairly sure after a day or two of meetings I’ll disable the audio warning.)

And here is the final output:


Also published on Medium.

2 comments

  1. This was amazing – exactly what I have been looking for when selecting a motorized desk. I haven’t bought a desk yet. Is this brand recommended, or have you found something more evolved in your search for this solution?

    1. Thanks Simon! Are you in Australia? Because if so, I do indeed recommend Zen Space Desks as their quality and price are fantastic. I wouldn’t however get this Bluetooth module again, and would instead look for a different controller and module that is less restrictive. One of my colleagues is building me an ESP-based solution to replace tg Bluetooth module, so it can talk directly to Home Assistant.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: