API Docs

A Stream Deck device, obtained via hs.streamdeck.all() or a discovery watcher — do not instantiate directly.

  • Example:
const deck = hs.streamdeck.all()[0]
deck.setBrightness(50)
deck.buttonCallback((device, button, isDown) => {
    if (isDown) device.setButtonColor(button, HSColor.named("red"))
})

Properties

identifier

string
The unique identifier assigned to this device object.

deckType

string
A human-readable description of the device model (e.g. `"Elgato Stream Deck (XL)"`).

firmwareVersion

string
The device's firmware version. Reads live from the hardware on every access.

keyCount

number
The total number of buttons (`keyColumns * keyRows`).

encoderColumns

number
The number of rotary encoders (Stream Deck Plus only; `0` on other models).

encoderRows

number
The number of encoder rows (Stream Deck Plus only; `0` on other models).

encoderCount

number
The total number of encoders (`encoderColumns * encoderRows`).

imageSize

HSSize
The pixel dimensions required for button images.

Methods

setBrightness(brightness) -> HSStreamDeckDevice

Sets the device's brightness.
setBrightness(brightness) -> HSStreamDeckDevice
Name Type Description
brightness number A whole number 0-100, the percentage brightness level
HSStreamDeckDevice
self, for chaining
hs.streamdeck.all()[0].setBrightness(75)

reset() -> HSStreamDeckDevice

Resets the device to its power-on state (clears all button images).
reset() -> HSStreamDeckDevice
HSStreamDeckDevice
self, for chaining
hs.streamdeck.all()[0].reset()

setButtonImage(button, image) -> HSStreamDeckDevice

Sets a button's image.
setButtonImage(button, image) -> HSStreamDeckDevice
Name Type Description
button number The button number, from `1` to `keyCount`
image HSImage An `HSImage` to display on the button. It is resized to fit.
HSStreamDeckDevice
self, for chaining
const deck = hs.streamdeck.all()[0]
deck.setButtonImage(1, HSImage.fromPath("/path/to/icon.png"))

setButtonColor(button, color) -> HSStreamDeckDevice

Sets a button to a solid color.
setButtonColor(button, color) -> HSStreamDeckDevice
Name Type Description
button number The button number, from `1` to `keyCount`
color HSColor An `HSColor`
HSStreamDeckDevice
self, for chaining
hs.streamdeck.all()[0].setButtonColor(1, HSColor.named("red"))

setScreenImage(encoder, image) -> HSStreamDeckDevice

Sets the LCD strip image above one encoder (Stream Deck Plus only; a no-op on other models).
setScreenImage(encoder, image) -> HSStreamDeckDevice
Name Type Description
encoder number The encoder number, from `1` to `encoderColumns`
image HSImage An `HSImage` to display. It is resized to fit.
HSStreamDeckDevice
self, for chaining
hs.streamdeck.all()[0].setScreenImage(1, HSImage.fromPath("/path/to/icon.png"))

buttonCallback(fn) -> HSStreamDeckDevice

Sets the callback for button press/release events. Replaces any previously set callback. The callback receives: this device, the button number, and whether it is now pressed.
buttonCallback(fn) -> HSStreamDeckDevice
Name Type Description
fn function The function to call on button events
HSStreamDeckDevice
self, for chaining
hs.streamdeck.all()[0].buttonCallback((device, button, isDown) => {
    console.log("button " + button + (isDown ? " pressed" : " released"))
})

encoderCallback(fn) -> HSStreamDeckDevice

Sets the callback for encoder press/release/rotation events (Stream Deck Plus only). Replaces any previously set callback. The callback receives: this device, the encoder number, whether it is now pressed, and two booleans indicating rotation direction (at most one is `true` per call).
encoderCallback(fn) -> HSStreamDeckDevice
Name Type Description
fn function The function to call on encoder events
HSStreamDeckDevice
self, for chaining
hs.streamdeck.all()[0].encoderCallback((device, encoder, isDown, left, right) => {
    if (left) console.log("encoder " + encoder + " turned left")
})

screenCallback(fn) -> HSStreamDeckDevice

Sets the callback for LCD touch-screen events (Stream Deck Plus only). Replaces any previously set callback. The callback receives: this device, the event type (`"shortPress"`, `"longPress"`, or `"swipe"`), and the start/end X/Y coordinates (end coordinates are `0` unless swiping).
screenCallback(fn) -> HSStreamDeckDevice
Name Type Description
fn function The function to call on screen events
HSStreamDeckDevice
self, for chaining
hs.streamdeck.all()[0].screenCallback((device, eventType, startX, startY, endX, endY) => {
    console.log(eventType + " at " + startX + "," + startY)
})

destroy() -> None

Stops delivering events and releases all callbacks. Called automatically when the device is disconnected or the module shuts down.
destroy() -> None
None
hs.streamdeck.all()[0].destroy()