I love controlling stuff with Home Assistant, but having to open the app on my phone each time I
want to switch on a light gets annoying really quickly. As I’m also not a big fan of yelling at
personal assistants like Alexa or Siri, I wanted to control everything conveniently with physical
buttons — and the Elgato Stream Decks are just great for that. So I wrote some software that runs
on my Raspberry Pi and connects a Stream Deck with Home Assistant.
First, let’s have a look at what you can do with it.
… and they also change their appearance. The “Cinema” button activates a Home Assistant
script.
If you like the idea, why not give it a try? The functionality is at the moment basically limited
to the things I’m personally using, but I’m always open for pull requests :)
Configuration
Everything is configured in a single YAML file. This is my config for the menus you saw in
the photos above:
---# Here you define sub-menus and actions for the keys of the Stream Deck:keys:# The first key opens a sub-menu:-kind:SubMenuvalues:icon:lightbulb-multiple# ... which is called “Lights”:title:Lights# ... and contains a new set of keys:keys:# ... like a button that toggles the state of a light:-kind:HomeAssistantTogglebackend:havalues:title:Bookshelfentity_id:light.bedroom_bookshelf_lamp-kind:HomeAssistantTogglebackend:havalues:title:Decoentity_id:light.bedroom_decoration_lamps-kind:HomeAssistantTogglebackend:havalues:title:Wallentity_id:light.bedroom_window_wall_lamp-null-null# ... and a back button that returns to the previous menu:-kind:BackButton# The second key opens another sub-menu:-kind:SubMenuvalues:# ... this time called “Media”:title:Mediaicon:projectorkeys:# ... which allows toggling the state of switches:-kind:HomeAssistantTogglebackend:havalues:title:Audioentity_id:switch.bedroom_audio-kind:HomeAssistantTogglebackend:havalues:title:Speakersentity_id:switch.bedroom_main_speakers-kind:HomeAssistantTogglebackend:havalues:title:Projectorentity_id:switch.bedroom_projector-kind:HomeAssistantTogglebackend:havalues:title:herschelentity_id:switch.herschel# ... and the activation of a script:-kind:HomeAssistantScriptbackend:havalues:icon:theatertitle:Cinemaentity_id:script.cinema_prepare-kind:BackButton# You also need to define a frontend that displays the keys and accepts# keypresses. Currently, ElgatoFrontend for Elgato Stream Decks and# GtkFrontend for development purposes are implemented.frontend:kind:ElgatoFrontendrows:2columns:3# The timeout defines the amount of time after which the display is disabled,# it will be activated again if any key is pressed.timeout:300# seconds, i.e. 5 minutes# The style is customizable with a custom font, fontsize, and padding at the borders of# the key images:style:font:/usr/share/fonts/TTF/OpenSans-Bold.ttfmax_fontsize:15padding:7# Last but not least, you need to define backends for the keys. Currently only Home# Assistant is supported, but you can add multiple instances here and reference them# by their name in the `backend` parameter of the keys.backends:ha:kind:HomeAssistantBackendvalues:url:"wss://<yourHomeAssistantURL>/api/websocket"token:"<yourHomeAssistantaccesstoken>"