HSStreamDeckDevice
TypeA 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.onButton((device, button, isDown) => {
if (isDown) device.setButtonColor(button, HSColor.named("red"))
})
Properties
deckType
string
A human-readable description of the device model (e.g. `"Elgato Stream Deck (XL)"`).
Methods
setBrightness(brightness) -> HSStreamDeckDevice
Sets the device's brightness.
Declaration
setBrightness(brightness) -> HSStreamDeckDevice
Parameters
| Name | Type | Description |
|---|---|---|
| brightness | number | A whole number 0-100, the percentage brightness level |
Returns
HSStreamDeckDevice
self, for chaining
Example
hs.streamdeck.all()[0].setBrightness(75)
reset() -> HSStreamDeckDevice
Resets the device to its power-on state (clears all button images).
Declaration
reset() -> HSStreamDeckDevice
Returns
HSStreamDeckDevice
self, for chaining
Example
hs.streamdeck.all()[0].reset()
setButtonImage(button, image) -> HSStreamDeckDevice
Sets a button's image.
Declaration
setButtonImage(button, image) -> HSStreamDeckDevice
Parameters
| 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. |
Returns
HSStreamDeckDevice
self, for chaining
Example
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.
Declaration
setButtonColor(button, color) -> HSStreamDeckDevice
Parameters
| Name | Type | Description |
|---|---|---|
| button | number | The button number, from `1` to `keyCount` |
| color | HSColor | An `HSColor` |
Returns
HSStreamDeckDevice
self, for chaining
Example
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).
Declaration
setScreenImage(encoder, image) -> HSStreamDeckDevice
Parameters
| Name | Type | Description |
|---|---|---|
| encoder | number | The encoder number, from `1` to `encoderColumns` |
| image | HSImage | An `HSImage` to display. It is resized to fit. |
Returns
HSStreamDeckDevice
self, for chaining
Example
hs.streamdeck.all()[0].setScreenImage(1, HSImage.fromPath("/path/to/icon.png"))
onButton(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.
Declaration
onButton(fn) -> HSStreamDeckDevice
Parameters
| Name | Type | Description |
|---|---|---|
| fn | function | The function to call on button events |
Returns
HSStreamDeckDevice
self, for chaining
Example
hs.streamdeck.all()[0].onButton((device, button, isDown) => {
console.log("button " + button + (isDown ? " pressed" : " released"))
})
onEncoder(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).
Declaration
onEncoder(fn) -> HSStreamDeckDevice
Parameters
| Name | Type | Description |
|---|---|---|
| fn | function | The function to call on encoder events |
Returns
HSStreamDeckDevice
self, for chaining
Example
hs.streamdeck.all()[0].onEncoder((device, encoder, isDown, left, right) => {
if (left) console.log("encoder " + encoder + " turned left")
})
onScreen(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).
Declaration
onScreen(fn) -> HSStreamDeckDevice
Parameters
| Name | Type | Description |
|---|---|---|
| fn | function | The function to call on screen events |
Returns
HSStreamDeckDevice
self, for chaining
Example
hs.streamdeck.all()[0].onScreen((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.
Declaration
destroy() -> None
Returns
None
Example
hs.streamdeck.all()[0].destroy()