Swamp extension for controlling an Elgato Key Light
  • TypeScript 100%
Find a file
keeb d6089dee7a Add discord-voice-watch.ts and document it in README
Polls PulseAudio every 2s for a WEBRTC VoiceEngine source output; turns
keylight-cozy on when Discord joins a voice channel and off when it leaves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 09:50:27 -07:00
extensions/models Bump to 2026.05.29.4 2026-05-29 09:22:56 -07:00
models/@keeb/keylight Add @keeb/keylight swamp extension 2026-05-29 09:16:29 -07:00
.gitignore Add @keeb/keylight swamp extension 2026-05-29 09:16:29 -07:00
.swamp.yaml Add @keeb/keylight swamp extension 2026-05-29 09:16:29 -07:00
CLAUDE.md Add @keeb/keylight swamp extension 2026-05-29 09:16:29 -07:00
discord-voice-watch.ts Add discord-voice-watch.ts and document it in README 2026-05-29 09:50:27 -07:00
LICENSE.txt Add @keeb/keylight swamp extension 2026-05-29 09:16:29 -07:00
manifest.yaml Bump to 2026.05.29.4 2026-05-29 09:22:56 -07:00
README.md Add discord-voice-watch.ts and document it in README 2026-05-29 09:50:27 -07:00
SWAMP.md Add @keeb/keylight swamp extension 2026-05-29 09:16:29 -07:00

@keeb/keylight

Control an Elgato Key Light from swamp workflows. The extension talks directly to the Key Light's built-in HTTP API (port 9123) — no Elgato Control Center software required. Turn the light on or off, toggle it, and dial in brightness and color temperature, all from a swamp model definition.

Installation

swamp extension pull @keeb/keylight

Configuration

Create a model that points at your Key Light's IP address:

swamp model create keylight @keeb/keylight \
  --arg host=10.0.0.245 \
  --arg port=9123

port defaults to 9123 and can be omitted.

Usage

# Sync current state and device info
swamp model method run keylight sync

# Power control
swamp model method run keylight on
swamp model method run keylight off
swamp model method run keylight toggle

# Set brightness (0100) and/or color temperature
swamp model method run keylight set --arg brightness=60
swamp model method run keylight set --arg temperature=200
swamp model method run keylight set --arg brightness=80 --arg temperature=250 --arg on=true

Color temperature

Temperature is expressed in mired (micro reciprocal degrees), which is the unit the Elgato API uses natively:

Mired Kelvin Character
143 ~7000 K Cool / Daylight
200 ~5000 K Neutral White
250 ~4000 K Warm White
344 ~2900 K Warm / Tungsten

Lower mired = cooler (bluer) light. Higher mired = warmer (more orange) light.

Resources

After running sync, on, off, toggle, or set, the model stores:

  • state — current power state, brightness, and temperature, plus a updatedAt timestamp.
  • info — product name, firmware version, serial number, and display name (only written by sync).

Reference stored state in workflows with CEL:

data.latest("keylight", "state").attributes.on
data.latest("keylight", "state").attributes.brightness

Prerequisites

  • The Key Light must be reachable on the local network (UDP mDNS or static IP).
  • No authentication is required — the Key Light's REST API is unauthenticated.
  • Firmware 1.0.3 or later recommended (API shape is stable across all current firmware versions).

Discord voice watch

discord-voice-watch.ts is a standalone Deno script that polls PulseAudio every 2 seconds and turns the Key Light on when Discord opens a voice channel and off when it closes.

deno run --allow-run discord-voice-watch.ts

Requires pactl (PulseAudio) and swamp on $PATH. The script controls the keylight-cozy model — edit the swamp() call to target a different model.

License

MIT — see LICENSE.txt for details.