2. Modules: StreamDeck Devices¶
-
class
StreamDeck.Devices.StreamDeck.
StreamDeck
(device)¶ Represents a physically attached original StreamDeck device.
-
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: Text corresponding to the specific type of the 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.
-
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.
-
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.
-
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_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 (function) – Asyncio loop to dispatch the callback into
-
set_key_image
(key, image)¶ Sets the image of a button on the StremDeck 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
get_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.
-
-
class
StreamDeck.Devices.StreamDeckOriginal.
StreamDeckOriginal
(device)¶ Bases:
StreamDeck.Devices.StreamDeck.StreamDeck
Represents a physically attached original StreamDeck 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.
-
set_key_image
(key, image)¶ Sets the image of a button on the StremDeck 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
get_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.
-
-
class
StreamDeck.Devices.StreamDeckMini.
StreamDeckMini
(device)¶ Bases:
StreamDeck.Devices.StreamDeck.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
get_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.
-