2. Modules: StreamDeck Devices

2.1. StreamDeck (Abstract Base)

class StreamDeck.Devices.StreamDeck.DialEventType(value)

Bases: Enum

Type of event that has occurred for a Dial.

class StreamDeck.Devices.StreamDeck.StreamDeck(device)

Bases: ABC

Represents a physically attached StreamDeck device.

close()

Closes the device for input/output.

See also

See open() for the corresponding open method.

connected()

Indicates if the physical StreamDeck device this instance is attached to is still connected to the host.

Return type:

bool

Returns:

True if the deck is still connected, False otherwise.

deck_type()

Retrieves the model of Stream Deck.

Return type:

str

Returns:

String containing the model name of the StreamDeck device.

dial_count()

Retrieves number of physical dials on the attached StreamDeck device.

Return type:

int

Returns:

Number of physical dials

dial_states()

Retrieves the current states of the dials (pressed or not) on the Stream Deck

Return type:

list(bool)

Returns:

List describing the current states of each of the dials on the device (True if the dial is being pressed, False otherwise).

abstract get_firmware_version()

Gets the firmware version of the attached StreamDeck.

Return type:

str

Returns:

String containing the firmware version of the attached device.

abstract get_serial_number()

Gets the serial number of the attached StreamDeck.

Return type:

str

Returns:

String containing the serial number of the attached device.

id()

Retrieves the physical ID of the attached StreamDeck. This can be used to differentiate one StreamDeck from another.

Return type:

str

Returns:

Identifier for the attached device.

is_open()

Indicates if the StreamDeck device is currently open and ready for use.

Return type:

bool

Returns:

True if the deck is open, False otherwise.

is_touch()

Returns whether the Stream Deck can receive touch events

Return type:

bool

Returns:

True if the deck can receive touch events, False otherwise

is_visual()

Returns whether the Stream Deck has a visual display output.

Return type:

bool

Returns:

True if the deck has a screen, False otherwise.

key_count()

Retrieves number of physical buttons on the attached StreamDeck device.

Return type:

int

Returns:

Number of physical buttons.

key_image_format()

Retrieves the image format accepted by the attached StreamDeck device. Images should be given in this format when setting an image on a button.

See also

See set_key_image() method to update the image displayed on a StreamDeck button.

Return type:

dict()

Returns:

Dictionary describing the various image parameters (size, image format, image mirroring and rotation).

key_layout()

Retrieves the physical button layout on the attached StreamDeck device.

Return type:

(int, int)

Return (rows, columns):

Number of button rows and columns.

key_states()

Retrieves the current states of the buttons on the StreamDeck.

Return type:

list(bool)

Returns:

List describing the current states of each of the buttons on the device (True if the button is being pressed, False otherwise).

open()

Opens the device for input/output. This must be called prior to setting or retrieving any device state.

See also

See close() for the corresponding close method.

product_id()

Retrieves the product ID attached StreamDeck. This can be used to determine the exact type of attached StreamDeck.

Return type:

int

Returns:

Product ID of the attached device.

abstract reset()

Resets the StreamDeck, clearing all button images and showing the standby image.

abstract set_brightness(percent)

Sets the global screen brightness of the StreamDeck, across all the physical buttons.

Parameters:

percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.

set_dial_callback(callback)

Sets the callback function called each time there is an interaction with a dial on the StreamDeck.

Note

This callback will be fired from an internal reader thread. Ensure that the given callback function is thread-safe.

Note

Only one callback can be registered at one time.

See also

See set_dial_callback_async() method for a version compatible with Python 3 asyncio asynchronous functions.

Parameters:

callback (function) – Callback function to fire each time a button state changes.

set_dial_callback_async(async_callback, loop=None)

Sets the asynchronous callback function called each time there is an interaction with a dial on the StreamDeck. The given callback should be compatible with Python 3’s asyncio routines.

Note

The asynchronous callback will be fired in a thread-safe manner.

Note

This will override the callback (if any) set by set_dial_callback().

Parameters:
  • async_callback (function) – Asynchronous callback function to fire each time a button state changes.

  • loop (asyncio.loop) – Asyncio loop to dispatch the callback into

set_key_callback(callback)

Sets the callback function called each time a button on the StreamDeck changes state (either pressed, or released).

Note

This callback will be fired from an internal reader thread. Ensure that the given callback function is thread-safe.

Note

Only one callback can be registered at one time.

See also

See set_key_callback_async() method for a version compatible with Python 3 asyncio asynchronous functions.

Parameters:

callback (function) – Callback function to fire each time a button state changes.

set_key_callback_async(async_callback, loop=None)

Sets the asynchronous callback function called each time a button on the StreamDeck changes state (either pressed, or released). The given callback should be compatible with Python 3’s asyncio routines.

Note

The asynchronous callback will be fired in a thread-safe manner.

Note

This will override the callback (if any) set by set_key_callback().

Parameters:
  • async_callback (function) – Asynchronous callback function to fire each time a button state changes.

  • loop (asyncio.loop) – Asyncio loop to dispatch the callback into

abstract set_key_image(key, image)

Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.

See also

See key_image_format() method for information on the image format accepted by the device.

Parameters:
  • key (int) – Index of the button whose image is to be updated.

  • image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.

set_poll_frequency(hz)

Sets the frequency of the button polling reader thread, determining how often the StreamDeck will be polled for button changes.

A higher frequency will result in a higher CPU usage, but a lower latency between a physical button press and a event from the library.

Parameters:

hz (int) – Reader thread frequency, in Hz (1-1000).

set_touchscreen_callback(callback)

Sets the callback function called each time there is an interaction with a touchscreen on the StreamDeck.

Note

This callback will be fired from an internal reader thread. Ensure that the given callback function is thread-safe.

Note

Only one callback can be registered at one time.

See also

See set_touchscreen_callback_async() method for a version compatible with Python 3 asyncio asynchronous functions.

Parameters:

callback (function) – Callback function to fire each time a button state changes.

set_touchscreen_callback_async(async_callback, loop=None)

Sets the asynchronous callback function called each time there is an interaction with the touchscreen on the StreamDeck. The given callback should be compatible with Python 3’s asyncio routines.

Note

The asynchronous callback will be fired in a thread-safe manner.

Note

This will override the callback (if any) set by set_touchscreen_callback().

Parameters:
  • async_callback (function) – Asynchronous callback function to fire each time a button state changes.

  • loop (asyncio.loop) – Asyncio loop to dispatch the callback into

abstract set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)

Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.

See also

See touchscreen_image_format() method for information on the image format accepted by the device.

Parameters:
  • image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.

  • x_pos (int) – Position on x axis of the image to draw

  • y_pos (int) – Position on y axis of the image to draw

  • width (int) – width of the image

  • height (int) – height of the image

touchscreen_image_format()

Retrieves the image format accepted by the touchscreen of the Stream Deck. Images should be given in this format when drawing on touchscreen.

See also

See set_touchscreen_image() method to draw an image on the StreamDeck touchscreen.

Return type:

dict()

Returns:

Dictionary describing the various image parameters (size, image format).

vendor_id()

Retrieves the vendor ID attached StreamDeck. This can be used to determine the exact type of attached StreamDeck.

Return type:

int

Returns:

Vendor ID of the attached device.

class StreamDeck.Devices.StreamDeck.TouchscreenEventType(value)

Bases: Enum

Type of event that has occurred for a Touchscreen.

2.2. StreamDeck Original

class StreamDeck.Devices.StreamDeckOriginal.StreamDeckOriginal(device)

Bases: StreamDeck

Represents a physically attached StreamDeck Original device.

get_firmware_version()

Gets the firmware version of the attached StreamDeck.

Return type:

str

Returns:

String containing the firmware version of the attached device.

get_serial_number()

Gets the serial number of the attached StreamDeck.

Return type:

str

Returns:

String containing the serial number of the attached device.

reset()

Resets the StreamDeck, clearing all button images and showing the standby image.

set_brightness(percent)

Sets the global screen brightness of the StreamDeck, across all the physical buttons.

Parameters:

percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.

set_key_image(key, image)

Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.

See also

See key_image_format() method for information on the image format accepted by the device.

Parameters:
  • key (int) – Index of the button whose image is to be updated.

  • image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.

set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)

Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.

See also

See touchscreen_image_format() method for information on the image format accepted by the device.

Parameters:
  • image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.

  • x_pos (int) – Position on x axis of the image to draw

  • y_pos (int) – Position on y axis of the image to draw

  • width (int) – width of the image

  • height (int) – height of the image

2.3. StreamDeck Mini

class StreamDeck.Devices.StreamDeckMini.StreamDeckMini(device)

Bases: StreamDeck

Represents a physically attached StreamDeck Mini device.

get_firmware_version()

Gets the firmware version of the attached StreamDeck.

Return type:

str

Returns:

String containing the firmware version of the attached device.

get_serial_number()

Gets the serial number of the attached StreamDeck.

Return type:

str

Returns:

String containing the serial number of the attached device.

reset()

Resets the StreamDeck, clearing all button images and showing the standby image.

set_brightness(percent)

Sets the global screen brightness of the StreamDeck, across all the physical buttons.

Parameters:

percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.

set_key_image(key, image)

Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.

See also

See key_image_format() method for information on the image format accepted by the device.

Parameters:
  • key (int) – Index of the button whose image is to be updated.

  • image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.

set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)

Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.

See also

See touchscreen_image_format() method for information on the image format accepted by the device.

Parameters:
  • image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.

  • x_pos (int) – Position on x axis of the image to draw

  • y_pos (int) – Position on y axis of the image to draw

  • width (int) – width of the image

  • height (int) – height of the image

2.4. StreamDeck XL

class StreamDeck.Devices.StreamDeckXL.StreamDeckXL(device)

Bases: StreamDeck

Represents a physically attached StreamDeck XL device.

get_firmware_version()

Gets the firmware version of the attached StreamDeck.

Return type:

str

Returns:

String containing the firmware version of the attached device.

get_serial_number()

Gets the serial number of the attached StreamDeck.

Return type:

str

Returns:

String containing the serial number of the attached device.

reset()

Resets the StreamDeck, clearing all button images and showing the standby image.

set_brightness(percent)

Sets the global screen brightness of the StreamDeck, across all the physical buttons.

Parameters:

percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.

set_key_image(key, image)

Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.

See also

See key_image_format() method for information on the image format accepted by the device.

Parameters:
  • key (int) – Index of the button whose image is to be updated.

  • image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.

set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)

Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.

See also

See touchscreen_image_format() method for information on the image format accepted by the device.

Parameters:
  • image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.

  • x_pos (int) – Position on x axis of the image to draw

  • y_pos (int) – Position on y axis of the image to draw

  • width (int) – width of the image

  • height (int) – height of the image

2.5. StreamDeck Pedal

class StreamDeck.Devices.StreamDeckPedal.StreamDeckPedal(device)

Bases: StreamDeck

Represents a physically attached StreamDeck Pedal device.

get_firmware_version()

Gets the firmware version of the attached StreamDeck.

Return type:

str

Returns:

String containing the firmware version of the attached device.

get_serial_number()

Gets the serial number of the attached StreamDeck.

Return type:

str

Returns:

String containing the serial number of the attached device.

reset()

Resets the StreamDeck, clearing all button images and showing the standby image.

set_brightness(percent)

Sets the global screen brightness of the StreamDeck, across all the physical buttons.

Parameters:

percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.

set_key_image(key, image)

Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.

See also

See key_image_format() method for information on the image format accepted by the device.

Parameters:
  • key (int) – Index of the button whose image is to be updated.

  • image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.

set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)

Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.

See also

See touchscreen_image_format() method for information on the image format accepted by the device.

Parameters:
  • image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.

  • x_pos (int) – Position on x axis of the image to draw

  • y_pos (int) – Position on y axis of the image to draw

  • width (int) – width of the image

  • height (int) – height of the image

2.6. StreamDeck Plus

class StreamDeck.Devices.StreamDeckPlus.StreamDeckPlus(device)

Bases: StreamDeck

get_firmware_version()

Gets the firmware version of the attached StreamDeck.

Return type:

str

Returns:

String containing the firmware version of the attached device.

get_serial_number()

Gets the serial number of the attached StreamDeck.

Return type:

str

Returns:

String containing the serial number of the attached device.

reset()

Resets the StreamDeck, clearing all button images and showing the standby image.

set_brightness(percent)

Sets the global screen brightness of the StreamDeck, across all the physical buttons.

Parameters:

percent (int/float) – brightness percent, from [0-100] as an int, or normalized to [0.0-1.0] as a float.

set_key_image(key, image)

Sets the image of a button on the StreamDeck to the given image. The image being set should be in the correct format for the device, as an enumerable collection of bytes.

See also

See key_image_format() method for information on the image format accepted by the device.

Parameters:
  • key (int) – Index of the button whose image is to be updated.

  • image (enumerable) – Raw data of the image to set on the button. If None, the key will be cleared to a black color.

set_touchscreen_image(image, x_pos=0, y_pos=0, width=0, height=0)

Draws an image on the touchscreen in a certain position. The image should be in the correct format for the devices, as an enumerable collection of bytes.

See also

See touchscreen_image_format() method for information on the image format accepted by the device.

Parameters:
  • image (enumerable) – Raw data of the image to set on the button. If None, the touchscreen will be cleared.

  • x_pos (int) – Position on x axis of the image to draw

  • y_pos (int) – Position on y axis of the image to draw

  • width (int) – width of the image

  • height (int) – height of the image