streamdeck-yaml — Controlling Home Assistant with an Elgato Stream Deck

Visit this project on GitHub.

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.

My main menu with two sub-menus (and space for more)
My main menu with two sub-menus (and space for more)
My main menu with two sub-menus (and space for more)
CloseNext
My main menu with two sub-menus (and space for more)

You can define sub-menus, e.g. for all your lights and media devices or for different rooms.

After entering the “Lights” sub-menu ...
After entering the “Lights” sub-menu ...
After entering the “Lights” sub-menu …
ClosePrevNext
After entering the “Lights” sub-menu …

Buttons for controlling the lights are possible …

... and switching on the wall light
... and switching on the wall light
… and switching on the wall light
ClosePrevNext
… and switching on the wall light

… and they change their icon and color depending on the state of the light.

Back to the main menu and into “Media” ...
Back to the main menu and into “Media” ...
Back to the main menu and into “Media” …
ClosePrevNext
Back to the main menu and into “Media” …

Switches are supported …

... and switching on the speakers
... and switching on the speakers
… and switching on the speakers
ClosePrev
… and switching on the speakers

… 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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---

# Here you define sub-menus and actions for the keys of the Stream Deck:
keys:
  # The first key opens a sub-menu:
  - kind: SubMenu
    values:
      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: HomeAssistantToggle
          backend: ha
          values:
            title: Bookshelf
            entity_id: light.bedroom_bookshelf_lamp
        - kind: HomeAssistantToggle
          backend: ha
          values:
            title: Deco
            entity_id: light.bedroom_decoration_lamps
        - kind: HomeAssistantToggle
          backend: ha
          values:
            title: Wall
            entity_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: SubMenu
    values:
      # ... this time called “Media”:
      title: Media
      icon: projector
      keys:
        # ... which allows toggling the state of switches:
        - kind: HomeAssistantToggle
          backend: ha
          values:
            title: Audio
            entity_id: switch.bedroom_audio
        - kind: HomeAssistantToggle
          backend: ha
          values:
            title: Speakers
            entity_id: switch.bedroom_main_speakers
        - kind: HomeAssistantToggle
          backend: ha
          values:
            title: Projector
            entity_id: switch.bedroom_projector
        - kind: HomeAssistantToggle
          backend: ha
          values:
            title: herschel
            entity_id: switch.herschel
        # ... and the activation of a script:
        - kind: HomeAssistantScript
          backend: ha
          values:
            icon: theater
            title: Cinema
            entity_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: ElgatoFrontend
  rows: 2
  columns: 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.ttf
  max_fontsize: 15
  padding: 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: HomeAssistantBackend
    values:
      url: "wss://<your Home Assistant URL>/api/websocket"
      token: "<your Home Assistant access token>"

Visit this project on GitHub.