Controlling Home-Assistant Entities with your Elgato Stream Deck

Controlling Home-Assistant Entities with your Elgato Stream Deck.

Hi there. This is a really simple one from me, but useful all the same, particularly if you’re a gamer!

I own an Elgato Stream Deck and I love it. I stream when playing computer games and it’s perfect for switching scenes, muting, changing music tracks etc. I don’t need to continue, there are plenty of reviews online. Where it really steps up for me is the ability for me to add Home-Assistant control to it. This not only allows me to assign a hard button to switching something on or off, but it enables me to mix the physical control of lighting with application control. For instance I have assigned a macro on my streamdeck that loads up OBS studio, opens the chat window (restream.io – I only have one monitor), opens Steam, stops playing music on my system (so as to not get a DCMA takedown) and now turns on my streamlights so I’m ready to go. I literally choose the game, hit stream and we’re online!

Home-Assistant on my Stream Deck
Home-Assistant on my Stream Deck

You could go one step further. If you’re into RGB lighting, you could also have it send commands to change to a certain colour when you hit the ‘scene’ transition button. If you have any of Elgato’s stream lights, you will find that these are already controllable via the Stream Deck. You could easily include external lighting now too. I’m sure I’m only scratching the surface here with this.

Now on to the set up side. It’s dead easy. I have a variety of tuya based smart plugs that I have reflashed to Tasmota (currently running 8.4.0 as I write). Will this work with ESPhome or one of the other other open firmwares? I’m not sure, but I don’t see why not. As long as they are open to HTTP control it should be fine. Someone else can verify that though.

For example here is one i use to toggle on and off a light in my office.

http://192.168.2.54/cm?cmnd=Power%20Toggle

That is it. It’s all you need. This simple one liner allows me to toggle my tasmotized (is that even a verb?) Blitzwolf SHP5 on and off and control the light connected to it.

Home-Assistant Stream Deck Commands
Home-Assistant Stream Deck Commands

I chose the blitzwolf SHP5 because not only is it good for a simple wifi enabled power plug but it also has 2 USB ports that can can be controlled independently of the main power socket. To be clear USB1 and USB2 are either both on or both off, but it’s still cool to have additional control over them. You can read more about how I put these into Home-Assistant and set them up correctly to have the independent power control here. If you’re interested in getting some yourself, you can find them here (affiliate link).

If you’re interested to learn more about what you can do on the code side, see the full list of tasmota commands here:

 

Using Node-red

So I’ve showed you the quick way how to control Tasmota devices directly. There’s also an additional way to be able to control Node-red entities and by extension home-assistant entities using a custom stream deck add-on and websockets.

Open up your streamdeck software and install the add-on Websocket Proxy.

websocket proxy streamdeck
websocket proxy streamdeck

Once installed you then need to configure a button to speak to the proxy. I configured a button using this code:

Streamdeck button configuration
Streamdeck button configuration

ws://your.node-red.installation.ip:1880/endpoint/streamdeck

Then go to node-red and drag out an Websocket-in Node and configure the listening point. Be sure to make them the same (note in node-red it kept adding /endpoint/ to the string, so to make it match, i just added that in the streamdeck):

websocket node
websocket node
websocket in configuration node
websocket in configuration node

Add a debug node and then press the button on the streamdeck to see if it’s connected. If everything’s working as it should you should get a large amount of text in the debug and a little green connected icon in the UI.

So far so good? Next step is to convert the debut text into JSON, which we can do using the JSON parser node. I then choose to put the output directly into a switch. Now for the streamdeck, you have two essential events. keyDown and keyUP. These are basically button press and release, so in order to capture these accordingly, I use the switch and configure it accordingly from the output of the json parser.

JSON parser and switch node
JSON parser and switch node
Switch Node Configuration
Switch Node Configuration

So at this point, it’s just a matter of now configuring what you want to do on the button press and / or the button release. I chose to turn on a lamp that I have set up in Home-assistant via a service call.

 

Full light control via streamdeck
Full light control via streamdeck

At this point, when i press the button on the stream deck (keyDown) the light turns on. When I release the button on the streamdeck (keyUp) the light turns off. I’m sure there are ways to go from node-red back to the streamdeck, but I haven’t played with that yet, but it would help fit in with my gaming flow. If you’re interested in learning more about the project and the plugin author’s website, you can visit the github page here.

 

Hopefully for those of you who own a Stream Deck you will find this useful. If you don’t and would consider picking one up, you can find one here on amazon (affiliate link):

Drop a comment below if you manage to come up with some cool idea or flow that incorporates this. I am sure someone far brighter than me will be able to adapt this to trigger more things within the Home-Assistant universe. I’d love to know more! If any of you are gamers, hit me up on Discord or Twitch!

Feel free to check out some of my most recent blog posts here.

 

Comments

  1. Hi, unfortunately this has nothing to do with home assistant. You just control your tasmota devices.

  2. Can you modify your streamdeck plugin to specify the http type, get vs post? And maybe add a json field?

    With home assistant you can create a webhook (through node-red), which doesnt require auth, like the node-red one does. Then in node red you can fire off a flow based on the entry of the webhook.

    Thoughts?

    1. I’ve not played with the home-assistant webhook node in node-red yet. Maybe time to have a go. Would there be any practical advantage over the method already laid out?

Leave a Reply to Andrew HoweCancel reply