Skip to main content

Connect and control Elgato Stream Decks

Project description

Knöpfe [ˈknœpfə]

Connect and control Elgato Stream Decks from Linux.

Features

  • Several integrated widgets
  • OBS integration including
    • Showing and changing if stream is running
    • Showing and changing if recording is running
    • Showing current scene
    • Switching between scenes
  • Multiple pages to switch between
  • Configuring device's brightness and hardware polling interval
  • Automatic sleeping if device isn't used with the possibility for widgets to prevent this (i.e. while OBS is running)

Installation

PyPI

pip install knoepfe

should do the trick :)

Arch Linux AUR

If you're on Arch Linux you can use the PKGBUILD in the AUR to install Knöpfe. Provided you're using yay

yay -S knoepfe

should be enough.

Prerequisites

udev rules are required for Knöpfe to be able to communicate with the device.

Create /etc/udev/rules.d/99-streamdeck.rules with following content:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0080", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", TAG+="uaccess"

Then, run sudo udevadm control --reload-rules and reconnect the device. You should be ready to go then.

systemd unit

If you want to start Knöpfe automatically on user login, consider creating and enabling a systemd unit in ~/.config/systemd/user/knoepfe.service:

[Unit]
Description=Knoepfe

[Service]
# Set path to where Knoepfe executable was installed to
ExecStart=/usr/local/bin/knoepfe
Restart=always

[Install]
WantedBy=default.target

And start and enable it by running:

systemctl --user enable knoepfe
systemctl --user start knoepfe

Usage

Starting

Usually just running knoepfe should be enough. It reads the configuration from ~/.config/knoepfe/knoepfe.cfg (see below for more information) and connects to the stream deck.

Anyway, some command line options are available:

knopfe
Connect and control Elgato Stream Decks

Usage:
  knoepfe [(-v | --verbose)] [--config=<path>]
  knoepfe (-h | --help)
  knoepfe --version

Options:
  -h --help       Show this screen.
  -v --verbose    Print debug information.
  --config=<path> Config file to use.

Configuration

Unless overwritten on command line, Knöpfe loads its configuration from ~/.config/knoepfe/knoepfe.cfg. So you should create that file if you don't want to stick to the example config used as fallback.

Anyway, the example is a great way to start. It can be found as knoepfe/default.cfg in this repository and the installation target directory.

The configuration is parsed as Python code. So every valid Python statement can be used, allowing to dynamically create and reuse parts of it. The default configuration is heavily commented, hopefully explaining how to use it clear enough.

Widgets

Following widgets are included:

Text

Simple widget just displaying a text.

Can be instantiated as:

widget({'type': 'knoepfe.widgets.Text', 'text': 'My great text!'})

Does nothing but showing the text specified with text on the key.

Clock

Widget displaying the current time. Instantiated as:

widget({'type': 'knoepfe.widgets.Clock', 'format': '%H:%M'})

format expects a strftime() format code to define the formatting.

Timer

Stop watch widget.

Instantiated as:

widget({'type': 'knoepfe.widgets.Timer'})

When pressed it counts the seconds until it is pressed again. It then shows the time elapsed between both presses until pressed again to reset.

This widget acquires the wake lock while the time is running, preventing the device from going to sleep.

Mic Mute

Mute/unmute PulseAudio source, i.e. microphone.

Instantiated with:

widget({'type': 'knoepfe.widgets.MicMute'})

Accepts device as optional argument with the name of source the operate with. If not set, the default source is used. This widget shows if the source is muted and toggles the state on pressing it.

OBS Streaming and Recording

Show and toggle OBS streaming/recording.

These widgets can be instantiated with

widget({'type': 'knoepfe.widgets.obs.Recording'})

and

widget({'type': 'knoepfe.widgets.obs.Streaming'})

They connect to OBS (if running, they're quite gray if not) and show if the stream or recording is running. On a long press the state is toggled.

As long as the connection to OBS is established these widgest hold the wake lock.

OBS Current Scene and Scene Switch

Show and switch active OBS scene.

These widgets are instantiated with

widget({'type': 'knoepfe.widgets.obs.CurrentScene'})

and

widget({'type': 'knoepfe.widgets.obs.SwitchScene', 'scene': 'Scene'})

The current scene widget just displays the active OBS scene.

The scene switch widget indicates if the scene set with the scene key is currently active. If not and the widget is pressed it switches to the scene.

As long as the connection to OBS is established these widgets hold the wake lock.

Development

Please feel free to open an issue if you encounter any bugs.

Pull requests are also very welcome :)

As widgets are loaded by their module path it should also be possible to add new functionality in a plugin-ish way by just creating independent python modules defining their behaviour. But, well, I haven't tested that yet.

Mentions

This project relies on python-elgato-streamdeck to communicate with the devices and is heavily inspired by Dev Deck and deckmaster.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knoepfe-0.1.1.tar.gz (175.1 kB view details)

Uploaded Source

Built Distribution

knoepfe-0.1.1-py3-none-any.whl (180.1 kB view details)

Uploaded Python 3

File details

Details for the file knoepfe-0.1.1.tar.gz.

File metadata

  • Download URL: knoepfe-0.1.1.tar.gz
  • Upload date:
  • Size: 175.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for knoepfe-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2161141ad91d6fc00c3fc94186075764343f26da8c17a9fa97c1c309dac91b40
MD5 f21be1c259f6ff062a8ce0687af5bf2c
BLAKE2b-256 bcfac8c821976255d34137319f36201f876d0def4a1f2080a841d46645380df3

See more details on using hashes here.

File details

Details for the file knoepfe-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: knoepfe-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 180.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for knoepfe-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dcc5a890a32fa59324f6e268a4254492c3f4870704fb725670b265c3dafbf47a
MD5 ef428ec03006913bae9845f9336e05f0
BLAKE2b-256 df4f48280e767fa961309c37d6204d46844985a3b0d40cd35d6f8ee3a2ce4f60

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page