# hs.streamdeck

Configure/control an Elgato Stream Deck.

Please note that in order for this module to work, the official Elgato Stream Deck app should not be running.

This extension supports the following devices:

  • Stream Deck (Original)
  • Stream Deck (Original V2)
  • Stream Deck Plus
  • Stream Deck Mini
  • Stream Deck Mini (V2)
  • Stream Deck XL
  • Stream Deck XL (Mk2)
  • Stream Deck Pedal

This module would not have been possible without standing on the shoulders of others:


# API Overview

Functions - API calls offered directly by the extension

  • discoveryCallback
  • getDevice
  • init
  • numDevices

Methods - API calls which can only be made on an object returned by a constructor

  • buttonCallback
  • buttonLayout
  • encoderCallback
  • firmwareVersion
  • imageSize
  • reset
  • screenCallback
  • serialNumber
  • setBrightness
  • setButtonColor
  • setButtonImage
  • setScreenImage

# API Documentation

# Functions

# discoveryCallback

| | | | --------------------------------------------|-------------------------------------------------------------------------------------| | Signature | hs.streamdeck.discoveryCallback(fn) | | Type | Function | | Description | Sets/clears a callback for reacting to device discovery events | | Parameters |

  • fn - A function that will be called when a Stream Deck is connected or disconnected. It should take the following arguments: A boolean, true if a device was connected, false if a device was disconnected An hs.streamdeck object, being the device that was connected/disconnected
| | Returns |
  • None
| | Notes | None | | Examples | None | | Source | extensions/streamdeck/libstreamdeck.m line 51 |


# getDevice

Signature hs.streamdeck.getDevice(num)
Type Function
Description Gets an hs.streamdeck object for the specified device
Parameters
  • num - A number that should be within the bounds of the number of connected devices
Returns
  • An hs.streamdeck object
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 92

# init

| | | | --------------------------------------------|-------------------------------------------------------------------------------------| | Signature | hs.streamdeck.init(fn) | | Type | Function | | Description | Initialises the Stream Deck driver and sets a discovery callback | | Parameters |

  • fn - A function that will be called when a Stream Deck is connected or disconnected. It should take the following arguments: A boolean, true if a device was connected, false if a device was disconnected An hs.streamdeck object, being the device that was connected/disconnected
| | Returns |
  • None
| | Notes |
  • This function must be called before any other parts of this module are used
| | Examples | None | | Source | extensions/streamdeck/libstreamdeck.m line 25 |


# numDevices

Signature hs.streamdeck.numDevices()
Type Function
Description Gets the number of Stream Deck devices connected
Parameters
  • None
Returns
  • A number containing the number of Stream Deck devices attached to the system
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 75

# Methods

# buttonCallback

| | | | --------------------------------------------|-------------------------------------------------------------------------------------| | Signature | hs.streamdeck:buttonCallback(fn) | | Type | Method | | Description | Sets/clears the button callback function for a Stream Deck device | | Parameters |

  • fn - A function to be called when a button is pressed/released on the stream deck. It should receive three arguments: The hs.streamdeck userdata object A number containing the button that was pressed/released A boolean indicating whether the button was pressed (true) or released (false)
| | Returns |
  • The hs.streamdeck device
| | Notes | None | | Examples | None | | Source | extensions/streamdeck/libstreamdeck.m line 109 |


# buttonLayout

Signature hs.streamdeck:buttonLayout()
Type Method
Description Gets the layout of buttons a Stream Deck device has
Parameters
  • None
Returns
  • The number of columns
  • The number of rows
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 274

# encoderCallback

| | | | --------------------------------------------|-------------------------------------------------------------------------------------| | Signature | hs.streamdeck:encoderCallback(fn) | | Type | Method | | Description | Sets/clears the knob/encoder callback function for a Stream Deck Plus. | | Parameters |

  • fn - A function to be called when an encoder button is pressed/released/rotated on a Stream Deck Plus. It should receive five arguments: The hs.streamdeck userdata object A number containing the button that was pressed/released/rotated A boolean indicating whether the button was pressed (true) or released (false) A boolean indicating that the button was turned left A boolean indicating that the button was turned right
| | Returns |
  • The hs.streamdeck device
| | Notes | None | | Examples | None | | Source | extensions/streamdeck/libstreamdeck.m line 136 |


# firmwareVersion

Signature hs.streamdeck:firmwareVersion()
Type Method
Description Gets the firmware version of a Stream Deck device
Parameters
  • None
Returns
  • A string containing the firmware version of the deck
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 255

# imageSize

Signature hs.streamdeck:imageSize()
Type Method
Description Gets the width and height of the buttons in pixels
Parameters
  • None
Returns
  • An table with keys w and h containing the width and height, respectively, of images expected by the Stream Deck
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 295

# reset

Signature hs.streamdeck:reset()
Type Method
Description Resets a Stream Deck device
Parameters
  • None
Returns
  • The hs.streamdeck object
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 216

# screenCallback

| | | | --------------------------------------------|-------------------------------------------------------------------------------------| | Signature | hs.streamdeck:screenCallback(fn) | | Type | Method | | Description | Sets/clears the screen callback function for a Stream Deck Plus's touch screen (above the encoder knobs). | | Parameters |

  • fn - A function to be called when a screen is pressed/released/swiped on a Stream Deck Plus. It should receive six arguments: The hs.streamdeck userdata object A string either containing "shortPress", "longPress" or "swipe" The X position of where the screen was first touched The Y position of where the screen was first touched The X position of where the screen was last touched (if swiping) The Y position of where the screen was last touched (if swiping)
| | Returns |
  • The hs.streamdeck device
| | Notes | None | | Examples | None | | Source | extensions/streamdeck/libstreamdeck.m line 165 |


# serialNumber

Signature hs.streamdeck:serialNumber()
Type Method
Description Gets the serial number of a Stream Deck device
Parameters
  • None
Returns
  • A string containing the serial number of the deck
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 236

# setBrightness

Signature hs.streamdeck:setBrightness(brightness)
Type Method
Description Sets the brightness of a Stream Deck device
Parameters
  • brightness - A whole number between 0 and 100 indicating the percentage brightness level to set
Returns
  • The hs.streamdeck device
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 195

# setButtonColor

Signature hs.streamdeck:setButtonColor(button, color)
Type Method
Description Sets a button on the Stream Deck device to the specified color
Parameters
  • button - A number (from 1 to 15) describing which button to set the color on
  • color - An hs.drawing.color object
Returns
  • The hs.streamdeck object
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 359

# setButtonImage

Signature hs.streamdeck:setButtonImage(button, image)
Type Method
Description Sets the image of a button on the Stream Deck device
Parameters
  • button - A number (from 1 to 15) describing which button to set the image for
  • image - An hs.image object
Returns
  • The hs.streamdeck object
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 315

# setScreenImage

Signature hs.streamdeck:setScreenImage(encoder, image)
Type Method
Description Sets the image of the screen on the Stream Deck device
Parameters
  • encoder - A number (from 1 to 4) describing which encoder to set the image for
  • image - An hs.image object
Returns
  • The hs.streamdeck object
Notes None
Examples None
Source extensions/streamdeck/libstreamdeck.m line 337