A Home Assistant & ESPHome solution for having your desk raise whenever you join a Microsoft Teams meeting.
This solution builds on top of my original method which relied on sending a shell command to a Raspberry Pi, which in turn used a Bluetooth dongle to control the desk. https://www.loryanstrant.com/2022/04/25/automatically-raise-your-desk-when-joining-a-microsoft-teams-call-or-meeting/
The code provided here is specific to my requirements as I have two powered standing desks in my home, however you can easily adapt to your needs.
These two are identical except for the names - so pick one and go with it. You'll need to adjust the substitutions to match your preferred device name as well as heights. The "common_settings.yaml" reference is simply where I park common sensors I want across all my ESPHome devices, as well as WiFi settings, API key, etc. Replace this with your specifics.
Contains the code used to create sensors to track the desk status, as well as amount of time standing that day between both desks (as I some days go between both rooms).
Includes the sensors that captures the time the desks spend in each status, as well as my occupancy of either room (using ESPresense).
Only contains a single card to display a needle gauge for showing how much time was spent standing at either/both desks across the working day. It uses a conditional card which will only show if I'm in the garage (as that's where the display is that it shows on).
There is only a single workflow in here, which incorporates various conditions such as the Workday integration, which room I'm in, whether the desk is standing, and my Teams status. Note that the workflow also calls to change my study tablet display (to show my family that I'm in a call/meeting) as well as changing my LED strip colour - so you'll need to remove or replace these.