For the longest time, I’ve been lurking in the forums, reading, researching, and trying to understand how to perform automation tasks with Keyboard Maestro on macOS. This past weekend, the lightbulb suddenly clicked, and I was able to put together two hot-key initiated macros to:
Open all the apps I use when I start the workday; turn on all my Elgato Key Lights; turn on two sets of LED light strings controlled by a Z Wave Power Strip via the Hubitat Elevation C7 Hub.
Quit all the apps I use when the workday is over; turn off all my Elgato Key Lights; turn off the two sets of LED light strings controlled by a Z Wave Power Strip via the Hubitat Elevation C7 Hub.
I didn’t build this from scratch; instead, I searched the web, found some sites that gave me a start, and then modified it to suit my needs. The result is a workflow that I’m delighted with because I no longer have this mental to-do item taking up brain space! The @MacSparky “whimsy” factor is quite high to boot.
The rest of this post will cover how I put it all together and includes:
- reference links to sites that I used to help me do all this:
- Templated KM Macros;
- Templated Postman REST API calls for the Hubitat Z Wave Operations.
The best part of all this is that it’s all local - meaning no cloud processing, and it’s pretty fast.
- MacBook Pro (circa 2018) running the latest beta version of macOS 12 Monterrey
- Elgato Control Center app
- Elgato Stream Deck app with KMLink Plugin
- Keyboard Maestro
- Karabiner-Elements to remap the Caps Lock key for use with KM macros
- Hubitat Elevation C7 Hub
- 4K Camera with Camlink 4K adapter to provide video
- Rodecaster Pro with Shure SM7B and Yamaha HS 5 monitors for in & out audio
- Amazon Echo Show 5 (don’t even get me started on Siri & the HomePod )
The pandemic workday consists of many video conferences using Teams, Zoom, Webex, Slack, and E-Mail. These online, interactive video sessions REQUIRE good quality audio so that other participants don’t get irritated due to poor audio quality.
Over the last 18 months, manually opening apps and setting the right audio inputs and outputs using the mouse and keyboard was driving me bonkers. Alfred didn’t do all I wanted it to, and the overall experience was, for me, a big PITA.
I mean, it is 2021, I am a member of MPU and paying More Power Users Podcast subscriber and I couldn’t live with the shame I was carrying for not being able to get this all working with a single button press.
I tried to go the easy route and searched for a Stream Deck plugin for the Hubitat Hub. I found ripnet’s GitHub repo that had just the thing; however, I couldn’t figure out how to get to the Options area where I could enter the API endpoint for the hub.
That’s when I decided to search the Hubitat Community forums (also running on Discourse) and see what I could find. Ripnet’s GH Stream Deck + Hubitat repo was posted in the Hubitat Community too, FYI.
Digging around a bit more led me to this post that gave me the steps to build the proper GET request for Hubitat’s Maker API.
There’s a post in Hubitat’s Community I created, and you can read more about that if you’d like.
I also forked ripnet’s repo and added some documentation to make it easier to understand how to add his/her plugin to the Stream Deck app
Using Elgato’s official documentation, I was able to cobble together the API calls I needed to turn my 3 Key Lights on and off.
All that was left was creating the KM macros, and that’s what I did.
The Start Work Apps & Lights On macro opens, Outlook, Teams, Zoom & Slack with KM’s Open Applications action. I then used KM’s Execute Shell Script action to add the API calls to turn on the three Elgato lights. The last part was to use the Execute Shell Script action again to turn on the two LED light strings via a CURL command to the Hubitat API endpoint. All these steps execute when I press the Caps Lock + W keyboard shortcut.
I repeated the process to quit all work apps and turn off all the lights in the Close Work Apps & Lights Off macro and tested using the Caps Lock +Q keyboard shortcut I assigned, and wouldn’t you know, it all worked.
I don’t mean to make it sound like I got it all working on my first attempt. It took three attempts and got it all working on the fourth.
Now that the two macros were done, all I needed to do was open the Stream Deck app, assign the KM Link plugin to a Stream Deck button with the Multi Action Switch function to create the On/Off toggle.
Actually, the first iteration used the Multi Action function and I created two separate buttons for On and Off.
When I realized that the Multi Action Switch capability was a toggle for two configurable states, I modified the setup so that everything would run off a single button on the Stream Deck hardware.
Instead of pushing my luck and the boundaries of my success with Keyboard Maestro, I erred on the side of caution and used the Stream Deck Audio Switcher Plugin by Fred Emmott. You can find it in the Stream Deck store or in his GitHub Repo.
Here’s a screenshot showing the order of operations in the Stream Deck app:
The plugin allows me to pick from a dropdown list of audio sources and destinations as part of the Multi Action Switch configuration. My preference is to use the RCP for all of these calls for a few reasons:
- the MacBook Pro is already doing quite a bit of heavy lifting, offloading the audio processing to the RCP means I don’t have to run another app on the MBP (think Audio Hijack);
- the complexity of audio setup is reduced. I don’t have to worry about a 3rd party audio plugin (think ScreenFlow or Camtasia) screwing things up and ruining anything. I can’t go back and hold these meetings again, so it needs to work right the first time, all the time.
- All of the video and telephony apps on the MBP are set to use the macOS system audio inputs and outputs, so I don’t need to fiddle with the audio settings within each app.
- the RCP has other audio inputs that allow me to add music from Apple Music, Spotify, or Pandora via their respective Amazon Echo Skills that I’ve enabled on my Amazon Echo Show 5.
Why the Echo Show 5? Because it has a TRRS output jack built into it and that connects directly to the Rodecaster Pro. The older 2nd Gen Echo Show with the 10.1-inch screen doesn’t have the audio jack and would require their dongle, and I have enough of those already. Thank you, Apple!
The Rodecaster Pro also has programmable sound pads that I can use during calls for things like laugh tracks, the Jeopardy theme song when participants are thinking about how to answer questions, and the sound of Crickets when no one has one.
It’s incredible how these little touches make today’s video calls much more fun and memorable.
Lastly, the Rodecaster Pro can record audio from the meetings too. I record the audio of these meetings to create transcripts using Otter.AI. I add the ML/AI-generated transcript to the final package that we share with all participants when it’s desired/required.
You can download the templated versions of the KM Macros here. (Shared via my Dropshare account)
Templated API calls for Elgato and Hubitat are posted in my public Postman Workspace.
- ignore the v1 Elgato APIs and use the Postman 2.1 APIs instead, as the v1 example is no longer supported. v2.1 is the latest.
I say templated because I’ve replaced the real device IPs and IDs in my network with descriptive placeholders that you can modify with your own.
Here’s a quick video showing it all working. The video is hosted in my CloudApp account and should open in a new tab as it was too large to post here in the forum.
- Use Better Touch Tool or KM to position all the apps where I want/need them.
- Create a schedule to auto-launch all these actions before I walk into my home office so it’s all ready to go when I show up
- Add a playlist of high-energy songs so that I’m in a great mood and state before I start working for the day.
- Have the schedule shut down the apps and lights so that I’m interrupted and reminded to go back into the house and hang out with my wife, help make dinner, etc. (Inspired by @tjluoma)
Alright, that does it for this post. I’ll come back and edit this later this week with more screenshots for the more visually inclined.
In the meantime, feel free to post your thoughts, comments, and other feedback here, and I’ll do my best to reply within 24 hours.
, & ,