Keyboard Maestro --> StreamDeck Button?

Hello,

The Streamdeck plugin for KM allows one to change the title or image of a Streamdeck button using a macro. Is it also possible for KM to actually press/invoke the button?

My use case is as follows. For live streaming, I use the immensely popular OBS ("Open Broadcast Software") for Mac. While it works wonderfully thus far, it does not seem to be coded using MacOS standard practices. OBS has a functionality where hotkeys can be assigned to different scenes (e.g., "1" for a scene with the main camera or "2" for a scene with B-roll, etc.). The hotkeys are simple, like the numbers 1, 2, etc.

For whatever reason, KM is unable to send those hotkeys to OBS. I tried the "Send Keystroke" action with the option to send hotkey "1" to OBS in the background, but it didn't work. I then set up a new macro to activate OBS, wait .5s, and then press "1" in the active application, but even that didn't work. KM was able to bring OBS's window to the front, so I know it is addressing the correct app, but the "Send Keystroke" action doesn't seem to be able to do what OBS needs; pressing the physical key works just fine, though. I've been troubleshooting it this week by resetting OBS's permissions in System Preferences and making sure KM is properly configured. All other macros work well except this one.

Now, I am considering a different solution. My Streamdeck has buttons for each scene. If OBS could invoke those buttons, either through the plugin or by triggering the USB device itself, I could accomplish what we need in our studio.

A third option is OSC, but my research thus far tells me KM isn't set up to work with OSC commands.

I appreciate any help in the right direction.

Thank you

1 Like

Since I posted this question, I've been thinking about the issue, and thank God, I found a solution that works for me. I am sharing it here in case it is helpful for anyone in the future.

Rather than deal with the frustration of Keyboard Maestro and OBS not being able to speak to each other, and rather than having Keyboard Maestro somehow trigger a USB Device Key, I found a workable solution using Bitfocus Companion, a cross-platform web service that allows control of OBS using the latter's web socket functionality. So, OBS's web socket is open to commands at, for example, port 4444 and Companion is able to send commands to change scenes and do many other useful things via that web socket.

Now comes the harder part of having Keyboard Maestro speak to Companion. The latter has a powerful feature that allows any of its buttons to be triggered with OSC, but as mentioned before, KM doesn't seem to support sending OSC commands. (I really wish KM could natively send OSC commands; it doesn't seem hard at all.)

Thankfully, I persisted in the OSC path and found a Homebrew application called SendOSC. It basically sends OSC commands via shell command. Once set up, I was able to send OSC commands to Companion, which, in turn, controlled OBS.

Finally, using Keyboard Maestro's Execute Shell Script action, I added these commands to my macros, and et voila! Everything is working in our studio as we hoped.

Now, I have physical buttons on my Streamdeck to control OBS scenes, but I am also able to control them via Keyboard Maestro for more powerful automations.

Blessings to you all

1 Like

In case this is helpful, StreamDeck has Actions for OBS. Scene, Mixer Audio, Record, Stream, and Source can be controlled with StreamDeck using those actions.

Thank you. Yes, I have been using the native Streamdeck controls for OBS, but I needed the ability to trigger them programmatically without physically pressing the keys.

The solution I posted above not only allows me to trigger scenes without pressing the Streamdeck or keyboard keys, but since it uses OSC, I can trigger them from any device on the same network. It’s tremendously useful in a studio environment.

2 Likes

Thanks for the great advice!!

Odd, I'm able to trigger OBS hotkeys from keyboard maestro even when the application is hidden. I do need to use the "send to" option in the hotkey action but it works. I do get occasional inconsistent behavior, but that's weird that it doesn't work for you.

The one thing i experienced was that if i launched OBS with the flag "--minimize-to-tray", keyboard maestro would NOT send keystrokes to it, so I had to get around it by launching OBS with the window shown, and then have keyboard maestro immediately hide it.