Skip to content

module pixelblaze

A library that provides a simple, synchronous interface for communicating with and controlling Pixelblaze LED controllers.

This module contains the following classes:

  • Pixelblaze: an object for controlling Pixelblazes.

  • PBB: an object for creating and manipulating Pixelblaze Binary Backups.

  • PBP: an object for creating and manipulating Pixelblaze Binary Patterns.

  • EPE: an object for creating and manipulating Electromage Pattern Exports.


class Pixelblaze

The Pixelblaze class presents a simple synchronous interface to a single Pixelblaze's websocket API.

The constructor takes the Pixelblaze's IPv4 address in the usual 12 digit numeric form (for example, "192.168.4.1"). To control multiple Pixelblazes, create multiple objects.

The objective is to provide 99% coverage of the functionality of the Pixelblaze webUI, and so the supported methods are named and grouped according to the tabs of the webUI:

CREATION

PATTERNS tab

SEQUENCER section

SAVED PATTERNS section

EDIT tab

MAPPER tab

SETTINGS tab

NAME section

LED section

UPDATES section

BACKUPS section

ADVANCED tab

GLOBAL CONTROLS

LOW-LEVEL SEND/RECEIVE

FILESYSTEM

STATISTICS

method __init__

__init__(ipAddress: str, proxyUrl: str = None)

Initializes an object for communicating with and controlling a Pixelblaze.

Args:

  • ipAddress (str): The Pixelblaze's IPv4 address in the usual dotted-quads numeric format (for example, "192.168.4.1").
  • proxyUrl (str, optional): The url of a proxy, if required, in the format "protocol://ipAddress:port" (for example, "http://192.168.0.1:8888"). Defaults to None.

method EnumerateAddresses

EnumerateAddresses(
    timeout: int = 1500,
    proxyUrl: str = None,
    hostIP: str = '0.0.0.0'
)  LightweightEnumerator

Returns an enumerator that will iterate through all the Pixelblazes on the local network, until {timeout} milliseconds have passed with no new devices appearing.

Args:

  • hostIP (str, optional): The network interface on which to listen for Pixelblazes. Defaults to "0.0.0.0" meaning all available interfaces.
  • timeout (int, optional): The amount of time in milliseconds to listen for a new Pixelblaze to announce itself (They announce themselves once per second). Defaults to 1500.
  • proxyUrl (str, optional): The url of a proxy, if required, in the format "protocol://ipAddress:port" (for example, "http://192.168.0.1:8888"). Defaults to None.

Returns:

  • LightweightEnumerator: A subclassed Python enumerator object that returns (as a string) the IPv4 address of a Pixelblaze, in the usual dotted-quads numeric format.

method EnumerateDevices

EnumerateDevices(
    timeout: int = 1500,
    proxyUrl: str = None,
    hostIP: str = '0.0.0.0'
)  LightweightEnumerator

Returns an enumerator that will iterate through all the Pixelblazes on the local network, until {timeout} milliseconds have passed with no new devices appearing.

Args:

  • hostIP (str, optional): The network interface on which to listen for Pixelblazes. Defaults to "0.0.0.0" meaning all available interfaces.
  • timeout (int, optional): The amount of time in milliseconds to listen for a new Pixelblaze to announce itself (They announce themselves once per second). Defaults to 1500.
  • proxyUrl (str, optional): The url of a proxy, if required, in the format "protocol://ipAddress:port" (for example, "http://192.168.0.1:8888"). Defaults to None.

Returns:

  • LightweightEnumerator: A subclassed Python enumerator object that returns a Pixelblaze object for controlling a discovered Pixelblaze.

method addToSequencerPlaylist

addToSequencerPlaylist(
    playlistContents: dict,
    patternId: str,
    duration: int
)  dict

Appends a new entry to the specified playlist.

Args:

  • patternId (str): The patternId of the pattern to be played.
  • duration (int): The number of milliseconds to play the pattern.
  • playlistContents (dict): The results of a previous call to getSequencerPlaylist.

Returns:

  • dict: The updated playlist, which can then be sent back to the Pixelblaze with setSequencerPlaylist.

method compilePattern

compilePattern(patternCode: str)  bytes

Compiles pattern sourcecode into a bytecode blob.

Args:

  • patternCode (str): The PBscript sourcecode of the pattern.

Returns:

  • bytes: a compiled blob of bytecode, ready to send to the Pixelblaze using sendPatternToRenderer().

method controlExists

controlExists(controlName: str, patternId: str = None)  bool

Tests whether the named control exists in the specified pattern. If no pattern is specified, the currently active pattern is assumed.

Note that the active pattern can be undefined on a freshly started Pixelblaze until the pattern has been explicitly set. This function also will return False if the active pattern is not available.

Args:

  • controlName (str): The name of the control.
  • patternId (str, optional): The pattern in which to test for the presence of the control. Defaults to None.

Returns:

  • bool: True if the specified control exists, False otherwise.

method deleteFile

deleteFile(fileName: str)  bool

Deletes a file from this Pixelblaze using the HTTP API.

Args:

  • fileName (str): The pathname (as returned from getFileList) of the file to be deleted.

Returns:

  • bool: True if the file was successfully stored; False otherwise.

method deletePattern

deletePattern(patternId: str)

Delete a pattern saved on the Pixelblaze.

Args:

  • patternId (str): The patternId of the desired pattern.

method getActiveControls

getActiveControls(configSequencer: dict = None)  dict

Returns the collection of controls for the pattern currently running on the Pixelblaze.

If there are no controls or no pattern has been set, returns an empty dictionary.

Args:

  • configSequencer (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSequencer; otherwise, fetches the configSequencer from the Pixelblaze anew. Defaults to None.

Returns:

  • dict: A dictionary containing the control names and values, with controlName as the key and controlValue as the value.

method getActivePattern

getActivePattern(configSequencer: dict = None)  str

Returns the ID of the pattern currently running on the Pixelblaze.

Args:

  • configSequencer (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSequencer; otherwise, fetches the configSequencer from the Pixelblaze anew. Defaults to None.

Returns:

  • str: The patternId of the current pattern, if any; otherwise an empty string.

method getActiveVariables

getActiveVariables()  dict

Gets the names and values of all variables exported by the current pattern.

Returns:

  • dict: A dictionary containing all the variables exported by the active pattern, with variableName as the key and variableValue as the value.

method getAutoOffEnable

getAutoOffEnable(configSettings: dict = None)  bool

Returns whether the auto-Off timer is enabled.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • bool: A boolean indicating whether the auto-Off timer is enabled.

method getAutoOffEnd

getAutoOffEnd(configSettings: dict = None)  str

Returns the time, if any, at which the Pixelblaze will turn on the pattern when the auto-Off timer is enabled.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • str: A Unix time string in "HH:MM" format.

method getAutoOffStart

getAutoOffStart(configSettings: dict = None)  str

Returns the time, if any, at which the Pixelblaze will turn off the pattern when the auto-Off timer is enabled.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • str: A Unix time string in "HH:MM" format.

method getBrandName

getBrandName(configSettings: dict = None)  str

Returns the brand name, if any, of this Pixelblaze (blank unless rebadged by a reseller).

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • str: The brand name.

method getBrightnessLimit

getBrightnessLimit(configSettings: dict = None)  int

Returns the maximum brightness for the Pixelblaze.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The maximum brightness, expressed as a percent value between 0 and 100 (yes, it's inconsistent with the 'brightness' settings).

method getBrightnessSlider

getBrightnessSlider(configSettings: dict = None)  float

Get the value of the UI brightness slider.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • float: A floating-point value between 0.0 and 1.0.

method getColorControlName

getColorControlName(patternId: str = None)  str

Returns the name of the specified pattern's first rgbPicker or hsvPicker control if one exists, or None otherwise.

Args:

  • patternId (str, optional): The pattern to search for color controls; or the currently active pattern if not specified. Defaults to None.

Returns:

  • str: The name of the specified pattern's first rgbPicker or hsvPicker control if one exists, or None otherwise.

method getColorControlNames

getColorControlNames(patternId: str = None)  list

Returns a list of names of the specified pattern's rgbPicker or hsvPicker controls if any exist, None otherwise. If the pattern argument is not specified, check the currently running pattern


method getColorOrder

getColorOrder(configSettings: dict = None)  <enum 'colorOrders'>

Returns the color order of the LEDs connected to the Pixelblaze.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • colorOrders: The ordering for the color data sent to the LEDs.

method getConfigExpander

getConfigExpander()  dict

Retrieves the OutputExpander configuration.

Returns:

  • dict: The OutputExpander configuration as a dictionary, with settingName as the key and settingValue as the value.

method getConfigSequencer

getConfigSequencer()  dict

Retrieves the Sequencer state.

Returns:

  • dict: The sequencer configuration as a dictionary, with settingName as the key and settingValue as the value.

method getConfigSettings

getConfigSettings()  dict

Returns the configuration as defined on the Settings tab of the Pixelblaze.

Returns:

  • dict: A dictionary containing the configuration settings, with settingName as the key and settingValue as the value.

method getCpuSpeed

getCpuSpeed(configSettings: dict = None)  <enum 'cpuSpeeds'>

Returns the CPU speed of the Pixelblaze.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • cpuSpeeds: An enumeration representing the CPU speed.

method getDataSpeed

getDataSpeed(configSettings: dict = None)  int

Returns the data speed of the LEDs connected to the Pixelblaze.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The data speed for communicating with the LEDs.

method getDeviceName

getDeviceName(configSettings: dict = None)  str

Returns the user-friendly name of the Pixelblaze.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • str: The user-friendly name of the Pixelblaze.

method getDiscovery

getDiscovery(configSettings: dict = None)  bool

Returns a boolean signifying whether the Pixelblaze announces itself to the Electromage Discovery Service.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • bool: A boolean signifying whether the Pixelblaze announces itself to the Electromage Discovery Service.

method getFPS

getFPS(savedStatistics: dict = None)  float

Return the speed (in Frames per Second) of the pattern rendering.

Args:

  • savedStatistics (dict, optional): If provided, extracts the value from the results of a previous call to 'getStatistics`; otherwise, fetches the statistics from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The pattern speed in FPS, as reported in a Pixelblaze statistics message.

method getFile

getFile(fileName: str)  bytes

Downloads a file from the Pixelblaze using the HTTP API.

Args:

  • fileName (str): The pathname (as returned from getFileList) of the file to be downloaded.

Returns:

  • bytes: The contents of the file.

method getFileList

getFileList(fileTypes: fileTypes = <fileTypes.fileAll: 63>)  list[str]

Returns a list of all the files of a particular type stored on the Pixelblaze's filesystem.

For Pixelblazes running firmware versions lower than 2.29/3.24 (the point at which the necessary API was introduced), the list includes the names of optional configuration files that may or may not exist on a particular Pixelblaze, depending on its setup.

Args:

  • fileTypes (fileTypes, optional): A bitmasked enumeration of the fileTypes to be listed. Defaults to fileTypes.fileAll.

Returns:

  • list[str]: A list of filenames of the requested fileType.

method getLearningUiMode

getLearningUiMode(configSettings: dict = None)  bool

Returns whether "Learning UI Mode" is enabled.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • bool: A boolean indicating whether "Learning UI Mode" is enabled.

method getLedType

getLedType(configSettings: dict = None)  <enum 'ledTypes'>

Returns the type of LEDs connected to the Pixelblaze.


method getMapCoordinates

getMapCoordinates(mapData: bytes = None)  list

Gets a unit-normalized representation of the pixelMap as an array (1D/2D/3D) of arrays.

Args:

  • mapData (bytes, optional): A blob of mapData as returned from getMapData(); if omitted, the mapData will be fetched from the Pixelblaze anew.

Returns:

  • list: A list containing one to three lists of floats, representing the X, Y and Z world coordinates (range 0..1) for each pixel.

method getMapData

getMapData()  bytes

Gets the binary representation of the pixelMap entered on the 'Mapper' tab.

Returns:

  • bytes: The binary mapData as generated by the Mapper tab of the Pixelblaze webUI.

method getMapFunction

getMapFunction()  str

Returns the mapFunction text used to populate the Mapper tab in the Pixelblaze UI.

Returns:

  • str: The text of the mapFunction.

method getMapOffsets

getMapOffsets(mapCoordinates: list = None)  list

Gets an integer-based representation of the pixelMap as an array (1D/2D/3D) of arrays.

Args:

  • mapCoordinates (list, optional): A list of mapCoordinates as returned from getMapCoordinates(); if omitted, the mapCoordinates will be fetched from the Pixelblaze anew.

Returns:

  • list: A list containing one to three lists of integers, representing the X, Y and Z indices (range 0..pixelCount) for each pixel.

method getNetworkPowerSave

getNetworkPowerSave(configSettings: dict = None)  bool

Returns whether the "Network Power Saving" mode is enabled (and WiFi is disabled).

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • bool: Whether the "Network Power Saving" mode is enabled.

method getPatternAsEpe

getPatternAsEpe(patternId: str)  str

Convert a stored pattern into an exportable, portable JSON format (which then needs to be saved by the caller).

Args:

  • patternId (str): The patternId of the desired pattern.

Returns:

  • str: The exported pattern as a JSON dictionary.

method getPatternControls

getPatternControls(patternId: str)  dict

Returns the name and value of any UI controls exported by the specified pattern.

Args:

  • patternId (str): The patternId of the pattern.

Returns:

  • dict: A dictionary containing the control names and values, with controlName as the key and controlValue as the value.

method getPatternList

getPatternList(forceRefresh: bool = False)  dict

Returns a list of all the patterns saved on the Pixelblaze.

Normally reads from the cached pattern list, which is refreshed every 10 minutes by default. To change the cache refresh interval, call setCacheRefreshTime(seconds).

Args:

  • forceRefresh (bool, optional): Forces a refresh of the cached patternList. Defaults to False.

Returns:

  • dict: A dictionary of the patterns stored on the Pixelblaze, where the patternId is the key and the patternName is the value.

method getPatternSourceCode

getPatternSourceCode(patternId: str)  str

Gets the sourceCode of a saved pattern from the Pixelblaze.

Args:

  • patternId (str): The patternId of the desired pattern.

Returns:

  • str: A string representation of a JSON dictionary containing the pattern source code.

method getPeers

getPeers()

A new command, added to the API but not yet implemented as of v2.29/v3.24, that will return a list of all the Pixelblazes visible on the local network segment.

Returns:

  • TBD: To be defined once @wizard implements the function.

method getPixelCount

getPixelCount(configSettings: dict = None)  int

Returns the number of LEDs connected to the Pixelblaze.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The number of LEDs connected to the Pixelblaze.

method getPreviewFrame

getPreviewFrame()  bytes

Grab one of the preview frames that Pixelblaze sends after every render cycle.

Returns:

  • bytes: a collection of bytes representing pixelCount tuples containing the (R, G, B) values for each pixel in the pattern preview.

method getPreviewImage

getPreviewImage(patternId: str)  bytes

Gets the preview image (a JPEG with 150 iterations of the pattern) saved within a pattern.

Args:

  • patternId (str): The patternId of the desired pattern.

Returns:

  • bytes: A JPEG image in which each column represents a particular LED and each row represents an iteration of the pattern.

method getSequencerMode

getSequencerMode(configSequencer: dict = None)  <enum 'sequencerModes'>

Gets the current sequencer mode.

Args:

  • configSequencer (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSequencer; otherwise, fetches the configSequencer from the Pixelblaze anew. Defaults to None.

Returns:

  • sequencerModes: The sequencerMode.

method getSequencerPlaylist

getSequencerPlaylist(playlistId: str = '_defaultplaylist_')

Fetches the specified playlist. At the moment, only the default playlist is supported by the Pixelblaze.

Args:

  • playlistId (str, optional): The name of the playlist (for future enhancement; currently only 'defaultplaylist' is supported). Defaults to "defaultplaylist".

Returns:

  • dict: The contents of the playlist.

method getSequencerShuffleTime

getSequencerShuffleTime(configSequencer: dict = None)  int

Gets the time the Pixelblaze's sequencer will run each pattern before switching to the next.

Args:

  • configSequencer (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSequencer; otherwise, fetches the configSequencer from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The number of milliseconds to play each pattern.

method getSequencerState

getSequencerState(configSequencer: dict = None)  bool

Gets the current sequencer run state.

Args:

  • configSequencer (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSequencer; otherwise, fetches the configSequencer from the Pixelblaze anew. Defaults to None.

Returns:

  • bool: True if the sequencer is running; False otherwise.

method getSimpleUiMode

getSimpleUiMode(configSettings: dict = None)  bool

Returns whether "Simple UI Mode" is enabled.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • bool: A boolean indicating whether "Simple UI Mode" is enabled.

method getStatistics

getStatistics()  dict

Grab one of the statistical packets that Pixelblaze sends every second.

Returns:

  • dict: the JSON message received from the Pixelblaze.

method getStorageSize

getStorageSize(savedStatistics: dict = None)  int

Return the available Flash storage on the Pixelblaze.

Args:

  • savedStatistics (dict, optional): If provided, extracts the value from the results of a previous call to 'getStatistics`; otherwise, fetches the statistics from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The available storage in bytes, as reported in a Pixelblaze statistics message.

method getStorageUsed

getStorageUsed(savedStatistics: dict = None)  int

Return the amount of Flash storage used on the Pixelblaze.

Args:

  • savedStatistics (dict, optional): If provided, extracts the value from the results of a previous call to 'getStatistics`; otherwise, fetches the statistics from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The used storage in bytes, as reported in a Pixelblaze statistics message.

method getTimezone

getTimezone(configSettings: dict = None)  str

Returns the timezone, if any, for the Pixelblaze.

Args:

  • configSettings (dict, optional): If provided, extracts the value from the results of a previous call to getConfigSettings; otherwise, fetches the configSettings from the Pixelblaze anew. Defaults to None.

Returns:

  • str: A standard Unix tzstring.

method getUpdateState

getUpdateState()  <enum 'updateStates'>

Returns the updateState of the Pixelblaze.

Returns:

  • updateStates: An enumeration describing the updateState of the Pixelblaze.

method getUptime

getUptime(savedStatistics: dict = None)  int

Return the uptime (in seconds) of the Pixelblaze.

Args:

  • savedStatistics (dict, optional): If provided, extracts the value from the results of a previous call to 'getStatistics`; otherwise, fetches the statistics from the Pixelblaze anew. Defaults to None.

Returns:

  • int: The uptime in seconds, as reported in a Pixelblaze statistics message.

method getUrl

getUrl(endpoint: str = None)  str

Build the URL to communicate with the Pixelblaze using an HTTP endpoint.

Args:

  • endpoint (str, optional): The HTTP endpoint. Defaults to None, which returns the URL of the Pixelblaze webUI.

Returns:

  • str: The URL of the HTTP endpoint on the Pixelblaze.

method getVersion

getVersion()  float

Returns the firmware version of the Pixelblaze.

Returns:

  • float: The firmware version, in major.minor format.

method getVersionMajor

getVersionMajor()  int

Returns the major version number.

Returns:

  • int: A positive integer representing the integer portion of the version number (eg. for v3.24, returns 3).

method getVersionMinor

getVersionMinor()  int

Returns the minor version number.

Returns:

  • int: A positive integer representing the fractional portion of the version number (eg. for v3.24, returns 24).

method installUpdate

installUpdate()  <enum 'updateStates'>

Installs new Pixelblaze firmware, if the current updateState indicates that an update is available.

Returns:

  • updateStates: An enumeration describing the new updateState of the Pixelblaze.

method nextSequencer

nextSequencer(saveToFlash: bool = False)

Mimics the 'Next' button in the UI. If the sequencerMode is ShuffleAll or Playlist, advances the pattern sequencer to the next pattern.

Args:

  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method pauseRenderer

pauseRenderer(doPause: bool)

Pause rendering. Lasts until unpause() is called or the Pixelblaze is reset.

CAUTION: For advanced users only. Only used to stop the render engine before sending new bytecode.

If you don't know exactly why you want to do this, DON'T DO IT.

Args:

  • doPause (bool): If True, pause the render engine; if False, resume it.

method pauseSequencer

pauseSequencer(saveToFlash: bool = False)

Mimics the 'Pause' button in the UI. Pauses the pattern sequencer, without changing the current position in the shuffle or playlist. Has no effect if the sequencer is not currently running.

Args:

  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method playSequencer

playSequencer(saveToFlash: bool = False)

Mimics the 'Play' button in the UI. Starts the pattern sequencer, the consequences of which will vary depending upon the sequencerMode.

Args:

  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method putFile

putFile(fileName: str, fileContents: bytes)  bool

Uploads a file to the Pixelblaze using the HTTP API.

Args:

  • fileName (str): The pathname at which to store the file.
  • fileContents (bytes): The data to store in the file.

Returns:

  • bool: True if the file was successfully stored; False otherwise.

method reboot

reboot()

Reboots the Pixelblaze.

This is occasionally necessary, eg. to force the Pixelblaze to recognize changes to configuration files.


method restoreFromBackup

restoreFromBackup(fileName: str)

Restores the contents of this Pixelblaze from a Pixelblaze Binary Backup file.

Args:

  • fileName (str): The desired filename for the Pixelblaze Binary Backup.

method saveBackup

saveBackup(fileName: str)

Saves the contents of this Pixelblaze into a Pixelblaze Binary Backup file.

Args:

  • fileName (str): The desired filename for the Pixelblaze Binary Backup.

method savePattern

savePattern(previewImage: bytes, sourceCode: str, byteCode: bytes)

Saves a new pattern to the Pixelblaze filesystem. Mimics the effects of the 'Save' button.

If you don't know how to generate the previewImage and byteCode components, you don't want to do this.

Args:

  • previewImage (bytes): A JPEG image in which each column represents a particular LED and each row represents an iteration of the pattern.
  • sourceCode (str): A string representation of a JSON dictionary containing the pattern source code.
  • byteCode (bytes): A valid blob of bytecode as generated by the Editor tab in the Pixelblaze webUI.

method sendPatternToRenderer

sendPatternToRenderer(bytecode: bytes, controls: dict = {})

Sends a blob of bytecode and a JSON dictionary of UI controls to the Renderer. Mimics the actions of the webUI code editor.

Args:

  • bytecode (bytes): A valid blob of bytecode as generated by the Editor tab in the Pixelblaze webUI.
  • controls (dict, optional): a dictionary of UI controls exported by the pattern, with controlName as the key and controlValue as the value. Defaults to {}.

method sendPing

sendPing()  Optional[str]

Send a Ping message to the Pixelblaze and wait for the Acknowledgement response.

Returns:

  • Union[str, None]: The acknowledgement message received from the Pixelblaze, or None if a timeout occurred.

method setActiveControls

setActiveControls(dictControls: dict, saveToFlash: bool = False)

Sets the value of one or more UI controls exported from the active pattern.

Args:

  • dictControls (dict): A dictionary containing the values to be set, with controlName as the key and controlValue as the value.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setActivePattern

setActivePattern(patternId: str, saveToFlash: bool = False)

Sets the active pattern.

Args:

  • patternId (str): The patternId of the desired pattern.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setActivePatternByName

setActivePatternByName(patternName: str, saveToFlash: bool = False)

Sets the currently running pattern using a text name.

Args:

  • patternName (str): The name of the pattern.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setActiveVariables

setActiveVariables(dictVariables: dict)

Sets the values of one or more variables exported by the current pattern.

Variables not present in the current pattern are ignored.

Args:

  • dict: A dictionary containing the variables to be set, with variableName as the key and variableValue as the value.

method setAutoOffEnable

setAutoOffEnable(boolValue: bool, saveToFlash: bool = False)

Enables or disables the Pixelblaze's auto-Off scheduler.

Args:

  • boolValue (bool): A boolean indicating whether the auto-Off scheduler should be used.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setAutoOffEnd

setAutoOffEnd(timeValue: str, saveToFlash: bool = False)

Sets the time at which the Pixelblaze will turn on the pattern.

Args:

  • timeValue (str): A Unix time string in "HH:MM" format.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setAutoOffStart

setAutoOffStart(timeValue: str, saveToFlash: bool = False)

Sets the time at which the Pixelblaze will turn off the pattern.

Args:

  • timeValue (str): A Unix time string in "HH:MM" format.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setBrandName

setBrandName(brandName: str)

Sets the brand name of the Pixelblaze (used by VARs to change the brand name that appears on the webUI).

Args:

  • brandName (str): The new name.

method setBrightnessLimit

setBrightnessLimit(maxBrightness: int, saveToFlash: bool = False)

Sets the Pixelblaze's global brightness limit.

Args:

  • maxBrightness (int): The maximum brightness, expressed as a percent value between 0 and 100 (yes, it's inconsistent with the 'brightness' settings).
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setBrightnessSlider

setBrightnessSlider(brightness: float, saveToFlash: bool = False)

Set the value of the UI brightness slider.

Args:

  • brightness (float): A floating-point value between 0.0 and 1.0.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setCacheRefreshTime

setCacheRefreshTime(seconds: int)

Set the interval, in seconds, after which calls to getPatternList() clear the pattern cache and fetch a new pattern list from the Pixelblaze.

The Default is 600 seconds (10 minutes); the maximum allowable value is clamped to a million seconds (about 277 hours, or 11.5 days). Anything else would be excessive.

Args:

  • seconds (int): The maximum age of the pattern cache.

method setColorControl

setColorControl(controlName: str, color, saveToFlash: bool = False)

Sets the 3-element color of the specified HSV or RGB color picker.

Args:

  • controlName (str): The name of the color control to change.
  • color: RGB or HSV colors, with all values in the range 0-1.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setColorOrder

setColorOrder(colorOrder: colorOrders, saveToFlash: bool = False)

Sets the color order for the LEDs connected to the Pixelblaze.

Args:

  • colorOrder (colorOrders): The ordering for the color data sent to the LEDs.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setCpuSpeed

setCpuSpeed(cpuSpeed: cpuSpeeds)

Sets the CPU speed of the Pixelblaze.

Note that this setting will not take effect until the Pixelblaze is rebooted (which can be done with the reboot function).

Args:

  • cpuSpeed (cpuSpeeds): The desired CPU speed.

method setDataSpeed

setDataSpeed(speed: int, saveToFlash: bool = False)

Sets custom data rate for communicating with the LEDs.

CAUTION: For advanced users only. If you don't know exactly why you want to do this, DON'T DO IT. See discussion in this thread on the Pixelblaze forum: https://forum.electromage.com/t/timing-of-a-cheap-strand/739

Args:

  • speed (int): The data rate for communicating with the LEDs.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setDeviceName

setDeviceName(name: str)

Sets the device name of the Pixelblaze.

Args:

  • name (str): The human-readable name of the Pixelblaze.

method setDiscovery

setDiscovery(enableDiscovery: bool, timezoneName: str = None)

Sets whether this Pixelblaze announces its presence to (and gets a clocktime reference from) the Electromage Discovery Service.

Args:

  • enableDiscovery (bool): A boolean controlling whether or not this Pixelblaze announces itself to the Electromage Discovery Service.
  • timezoneName (str, optional): If present, a Unix tzstring specifying how to adjust the clocktime reference received from the Electromage Discovery Service. Defaults to None.

method setLearningUiMode

setLearningUiMode(doLearningMode: bool)

Enables or disables "Learning UI Mode" which has additional UI help for new users.

Args:

  • doSimpleMode (bool): Whether to enable "Learning UI Mode".

method setLedType

setLedType(ledType: ledTypes, dataSpeed: int = None, saveToFlash: bool = False)

Defines the type of LEDs connected to the Pixelblaze.

Args:

  • ledType (ledTypes): The type of LEDs connected to the Pixelblaze.
  • dataSpeed (int, optional): If provided, sets a custom data speed for communication with the LEDs; otherwise the defaults from the webUI are used. Defaults to None.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setMapData

setMapData(mapData: bytes, saveToFlash: bool = True)

Sets the binary mapData used by the Pixelblaze.

Args:

  • mapData (bytes): a blob of binary mapData as generated by the Mapper tab of the Pixelblaze webUI.
  • saveToFlash (bool, optional): A boolean indicating whether the mapData should be saved to Flash. Defaults to True.

method setMapFunction

setMapFunction(mapFunction: str)  bool

Sets the mapFunction text used to populate the Mapper tab in the Pixelblaze UI.

Note that setting the map function also compiles and updates the mapData used by the Pixelblaze.

Args:

  • mapFunction (str): The text of the mapFunction.

Returns:

  • bool: True if the function text was successfully saved; otherwise False.

method setNetworkPowerSave

setNetworkPowerSave(disableWifi: bool)

Enables or disables the WiFi connection on the Pixelblaze, which can significantly reduce power requirements for battery-powered installations.

Note that this setting will not take effect until the Pixelblaze is rebooted (which can be done with the reboot function).

Args:

  • disableWifi (bool): A boolean indicating whether to disable Wifi.

method setPixelCount

setPixelCount(nPixels: int, saveToFlash: bool = False)

Sets the number of LEDs attached to the Pixelblaze.

Note that changing the number of pixels does not recalculate the pixelMap.

Args:

  • nPixels (int): The number of pixels.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setSendPreviewFrames

setSendPreviewFrames(doUpdates: bool)

Set whether or not the Pixelblaze sends pattern preview frames.

Args:

  • doUpdates (bool): True sends preview frames, False stops.

method setSequencerMode

setSequencerMode(sequencerMode: sequencerModes, saveToFlash: bool = False)

Sets the sequencer mode to one of the available sequencerModes (Off, ShuffleAll, or Playlist).

Args:

  • sequencerMode (enum): The desired sequencer mode.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setSequencerPlaylist

setSequencerPlaylist(
    playlistContents: dict,
    playlistId: str = '_defaultplaylist_'
)

Replaces the entire contents of the specified playlist. At the moment, only the default playlist is supported by the Pixelblaze.

Args:

  • playlistContents (dict): The new playlist contents.
  • playlistId (str, optional): The name of the playlist (for future enhancement; currently only 'defaultplaylist' is supported). Defaults to "defaultplaylist".

method setSequencerShuffleTime

setSequencerShuffleTime(nMillis: int, saveToFlash: bool = False)

Sets the time the Pixelblaze's sequencer will run each pattern before switching to the next.

Args:

  • nMillis (int): The number of milliseconds to play each pattern.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setSequencerState

setSequencerState(sequencerState: bool, saveToFlash: bool = False)

Set the run state of the sequencer.

Args:

  • sequencerState (bool): A boolean value determining whether or not the sequencer should run.
  • saveToFlash (bool, optional): If True, the setting is stored in Flash memory; otherwise the value reverts on a reboot. Defaults to False.

method setSimpleUiMode

setSimpleUiMode(doSimpleMode: bool)

Enables or disables "Simple UI Mode" which makes the UI more suitable for non-technical audiences.

Args:

  • doSimpleMode (bool): Whether to enable "Simple UI Mode".

method setTimezone

setTimezone(timezoneName: str)

Sets the Pixelblaze's timezone, which specifies how to adjust the clocktime reference provided by the Electromage Discovery Service.

To clear the timezone, pass an empty string.

Args:

  • timezoneName (str): A Unix tzstring specifying how to adjust the clocktime reference provided by the Electromage Discovery Service.

method wsReceive

wsReceive(binaryMessageType: messageTypes = None)  Union[str, bytes, NoneType]

Wait for a message of a particular type from the Pixelblaze.

Args:

  • binaryMessageType (messageTypes, optional): The type of binary message to wait for (if None, waits for a text message). Defaults to None.

Returns:

  • Union[str, bytes, None]: The message received from the Pixelblaze (of type bytes for binaryMessageTypes, otherwise of type str), or None if a timeout occurred.

method wsSendBinary

wsSendBinary(
    binaryMessageType: messageTypes,
    blob: bytes,
    expectedResponse: str = None
)

Send a binary command to the Pixelblaze, and optionally wait for a suitable response.

Args:

  • binaryMessageType (messageTypes, optional): The type of binary message to send.
  • blob (bytes): The message body to be sent.
  • expectedResponse (str, optional): If present, the initial key of the expected JSON response to the command. Defaults to None.

Returns:

  • response: The message received from the Pixelblaze (of type bytes for binaryMessageTypes, otherwise of type str), or None if a timeout occurred.

method wsSendJson

wsSendJson(command: dict, expectedResponse=None)  Union[str, bytes, NoneType]

Send a JSON-formatted command to the Pixelblaze, and optionally wait for a suitable response.

Args:

  • command (dict): A Python dictionary which will be sent to the Pixelblaze as a JSON command.
  • expectedResponse (str, optional): If present, the initial key of the expected JSON response to the command. Defaults to None.

Returns:

  • Union[str, bytes, None]: The message received from the Pixelblaze (of type bytes for binaryMessageTypes, otherwise of type str), or None if a timeout occurred.

class PBB

This class provides methods for importing, exporting, and manipulating the contents of a Pixelblaze Binary Backup, as created from the Settings menu on a Pixelblaze.

CREATION - fromFile() - fromIpAddress() - fromPixelblaze()

PROPERTIES - deviceName() - getFileList()

MANIPULATION - getFile()/putFile()/deleteFile()

PERSISTENCE - toFile() - toIpAddress() - toPixelblaze()

Note:

The constructor is not intended to be called directly; objects are created and returned from the object creation methods described above.

method __init__

__init__(name: str, blob: bytes)

Initializes a new Pixelblaze Binary Backup (PBB) object.

Args:

  • id (str): The patternId of the pattern.
  • blob (bytes): The binary contents of the pattern.

Note:

This method is not intended to be called directly; use the static methods fromFile(), fromIpAddress() or fromPixelblaze() methods to create and return a Pixelblaze Binary Backup (PBB) object.


property deviceName

Gets the user-friendly name of the device from which this PixelBlazeBackup was made.

Returns:

  • str: The user-friendly name of the device from which this PixelBlazeBackup was made.

method deleteFile

deleteFile(fileName: str)

Removes a particular file from this PixelBlazeBackup.

Args:

  • fileName (str): The name of the file to be deleted.

method fromFile

fromFile(fileName: str)  PBB

Creates and returns a new Pixelblaze Binary Backup whose contents are loaded from a file on disk.

Args:

  • fileName (str): The filename of the Pixelblaze Binary Backup.

Returns:

  • PBB: A new Pixelblaze Binary Backup object.

method fromIpAddress

fromIpAddress(ipAddress: str, proxyUrl: str = None, verbose: bool = False)  PBB

Creates and returns a new Pixelblaze Binary Backup whose contents are loaded from a Pixelblaze specified by IP address.

Args:

  • ipAddress (str): The Pixelblaze's IPv4 address in the usual dotted-quads numeric format (for example, "192.168.4.1").
  • proxyUrl (str, optional): The url of a proxy, if required, in the format "protocol://ipAddress:port" (for example, "http://192.168.0.1:8888"). Defaults to None.
  • verbose (bool, optional): A boolean specifying whether to print detailed progress statements. Defaults to False.

Returns:

  • PBB: A new Pixelblaze Binary Backup object.

method fromPixelblaze

fromPixelblaze(pb: Pixelblaze, verbose: bool = False)  PBB

Creates and returns a new Pixelblaze Binary Backup whose contents are loaded from an existing Pixelblaze object.

Args:

  • pb (Pixelblaze): A Pixelblaze object.
  • verbose (bool, optional): A boolean specifying whether to print detailed progress statements. Defaults to False.

Returns:

  • PBB: A new Pixelblaze Binary Backup object.

method getFile

getFile(fileName: str)  bytes

Returns the contents of a particular file contained in this PixelBlazeBackup.

Args:

  • fileName (str): The name of the file to be returned.

Returns:

  • bytes: The contents of the requested file.

method getFileList

getFileList(fileTypes: fileTypes = <fileTypes.fileAll: 63>)  list[str]

Returns a sorted list of the files contained in this PixelBlazeBackup.

Args:

  • fileTypes (fileTypes, optional): An bitwise enumeration indicating the types of files to list. Defaults to fileTypes.fileAll.

Returns:

  • list[str]: A list of filenames.

method putFile

putFile(fileName: str, fileContents: bytes)

Inserts or replaces the contents of a particular file into this PixelBlazeBackup.

Args:

  • fileName (str): The name of the file to be stored.
  • fileContents (bytes): The contents of the file to be stored.

method toFile

toFile(fileName: str = None, explode: bool = False)

Writes this Pixelblaze Binary Backup to a file on disk.

Args:

  • fileName (str, optional): If specified, the filename of the Pixelblaze Binary Backup to be created; otherwise the originating Pixelblaze name is used. Defaults to None.
  • explode (bool, optional): If specified, also exports the files within the Pixelblaze Binary Backup to a subdirectory. Defaults to False.

method toIpAddress

toIpAddress(ipAddress: str, proxyUrl: str = None, verbose: bool = False)

Restores the contents of this PixelBlazeBackup to a Pixelblaze identified by IP Address.

Args:

  • ipAddress (str): The Pixelblaze's IPv4 address in the usual dotted-quads numeric format (for example, "192.168.4.1")..
  • proxyUrl (str, optional): The url of a proxy, if required, in the format "protocol://ipAddress:port" (for example, "http://192.168.0.1:8888"). Defaults to None.
  • verbose (bool, optional): A boolean specifying whether to print detailed progress statements. Defaults to False.

method toPixelblaze

toPixelblaze(pb: Pixelblaze, verbose: bool = False)

Uploads the contents of this PixelBlazeBackup to the destination Pixelblaze.

Args:

  • pb (Pixelblaze): A Pixelblaze object.
  • verbose (bool, optional): A boolean specifying whether to print detailed progress statements. Defaults to False.

class PBP

This class represents a Pixelblaze Binary Pattern, as stored on the Pixelblaze filesystem or contained in a Pixelblaze Binary Backup.

CREATION - fromBytes() - fromFile() - fromIpAddress() - fromPixelblaze()

PROPERTIES - id() - name() - jpeg() - byteCode() - sourceCode()

PERSISTENCE - toFile() - toIpAddress() - toPixelblaze() - toEPE() - explode()

Note:

The constructor is not intended to be called directly; objects are created and returned from the object creation methods described above.

method __init__

__init__(id: str, blob: bytes)

Initializes a new Pixelblaze Binary Pattern (PBP) object.

Args:

  • id (str): The patternId of the pattern.
  • blob (bytes): The binary contents of the pattern.

Note:

This method is not intended to be called directly; use the static methods fromBytes(), fromFile(), fromIpAddress() or fromPixelblaze() methods to create and return a PBP object.


property byteCode

Returns (as a collection of bytes) the bytecode of the pattern contained in this Pixelblaze Binary Pattern (PBP).

Returns:

  • bytes: The bytecode of the pattern contained in this Pixelblaze Binary Pattern (PBP).

property id

Returns the patternId of the pattern contained in this Pixelblaze Binary Pattern (PBP).

Returns:

  • str: The patternId of the pattern contained in this Pixelblaze Binary Pattern (PBP).

property jpeg

Returns (as a collection of bytes) the preview JPEG of the pattern contained in this Pixelblaze Binary Pattern (PBP).

Returns:

  • bytes: The preview JPEG of the pattern contained in this Pixelblaze Binary Pattern (PBP).

property name

Returns the (human-readable) name of the pattern contained in this Pixelblaze Binary Pattern (PBP).

Returns:

  • str: The (human-readable) name of the pattern contained in this Pixelblaze Binary Pattern (PBP).

property sourceCode

Returns the source code of the pattern in this Pixelblaze Binary Pattern (PBP).

Returns:

  • str: The source code of the pattern as a JSON-encoded string.

method explode

explode(path: str = None)

Exports all the components of this Pixelblaze Binary Pattern (PBP) as separate files.

Args:

  • path (str, optional): If provided, a pathname for the folder in which to export the components; otherwise derived from the patternId. Defaults to None.

method fromBytes

fromBytes(patternId: str, blob: bytes)  PBP

Creates and returns a new Pixelblaze Binary Pattern (PBP) whose contents are initialized from a bytes array.

Args:

  • patternId (str): A patternId for the Pixelblaze Binary Pattern to be created.
  • blob (bytes): The binary contents of the Pixelblaze Binary Pattern to be created.

Returns:

  • PBP: A new Pixelblaze Binary Pattern object.

method fromFile

fromFile(fileName: str)  PBP

Creates and returns a new Pixelblaze Binary Pattern (PBP) whose contents are loaded from a file on disk.

Args:

  • fileName (str): The name of the file to be loaded into a Pixelblaze Binary Pattern.

Returns:

  • PBP: A new Pixelblaze Binary Pattern object.

method fromIpAddress

fromIpAddress(ipAddress: str, patternId: str, proxyUrl: str = None)  PBP

Creates and returns a new pattern Pixelblaze Binary Pattern (PBP) whose contents are downloaded from a URL.

Args:

  • ipAddress (str): The Pixelblaze's IPv4 address in the usual dotted-quads numeric format (for example, "192.168.4.1").
  • patternId (str): The patternId of the Pixelblaze Binary Pattern to be loaded from the Pixelblaze.
  • proxyUrl (str, optional): The url of a proxy, if required, in the format "protocol://ipAddress:port" (for example, "http://192.168.0.1:8888"). Defaults to None.

Returns:

  • PBP: A new Pixelblaze Binary Pattern object.

method fromPixelblaze

fromPixelblaze(pb: Pixelblaze, patternId: str)  PBP

Creates and returns a new pattern Pixelblaze Binary Pattern (PBP) whose contents are downloaded from an active Pixelblaze object.

Args:

  • pb (Pixelblaze): An active Pixelblaze object.
  • patternId (str): The patternId of the Pixelblaze Binary Pattern to be loaded from the Pixelblaze.

Returns:

  • PBP: A new Pixelblaze Binary Pattern object.

method toEPE

toEPE()  EPE

Creates a new Electromage Pattern Export (EPE) and initializes it from the contents of this Pixelblaze Binary Pattern (PBP).

Returns:

  • EPE: A new Electromage Pattern Export object.

method toFile

toFile(fileName: str = None)

Saves this Pixelblaze Binary Pattern (PBP) to a file on disk.

Args:

  • fileName (str, optional): If provided, A name for the Pixelblaze Binary Pattern file to be created; otherwise, the name is derived from the patternId. Defaults to None.

method toIpAddress

toIpAddress(ipAddress: str, proxyUrl: str = None)

Uploads this Pixelblaze Binary Pattern (PBP) to a Pixelblaze identified by its IP address.

Args:

  • ipAddress (str): The Pixelblaze's IPv4 address in the usual dotted-quads numeric format (for example, "192.168.4.1").
  • proxyUrl (str, optional): The url of a proxy, if required, in the format "protocol://ipAddress:port" (for example, "http://192.168.0.1:8888"). Defaults to None.

method toPixelblaze

toPixelblaze(pb: Pixelblaze)

Uploads this Pixelblaze Binary Pattern (PBP) to an active Pixelblaze object.

Args:

  • pb (Pixelblaze): An active Pixelblaze object.

class EPE

This class provides methods for importing, exporting, and manipulating the contents of an Electromage Pattern Export (EPE), as exported from the Patterns list on a Pixelblaze.

CREATION - fromBytes() - fromFile()

PROPERTIES - patternId() - patternName() - sourceCode() - previewImage()

PERSISTENCE - toFile() - explode()

Note:

The constructor is not intended to be called directly; objects are created and returned from the object creation methods described above.

method __init__

__init__(blob: bytes)

Initializes a new Electromage Pattern Export (EPE) object.

Args:

  • blob (bytes): The contents of the Electromage Pattern Export (EPE).

Note:

This method is not intended to be called directly; use the static methods fromBytes() or fromFile() to create and return an Electromage Pattern Export object.


property patternId

Returns the patternId of the pattern contained in this Electromage Pattern Export (EPE).

Returns:

  • str: The patternId of the pattern contained in this Electromage Pattern Export (EPE).

property patternName

Returns the human-readable name of the pattern in this Electromage Pattern Export (EPE).

Returns:

  • str: The human-readable name of the pattern contained in this Electromage Pattern Export (EPE).

property previewImage

Returns (as bytes) the preview JPEG of the pattern contained in this Electromage Pattern Export (EPE).

Returns:

  • bytes: The preview JPEG of the pattern contained in this Electromage Pattern Export (EPE).

property sourceCode

Returns the source code of the pattern contained in this Electromage Pattern Export (EPE).

Returns:

  • str: The sourceCode of the pattern contained in this Electromage Pattern Export (EPE).

method explode

explode(path: str)

Exports the components of this Electromage Pattern Export (EPE) to separate files.

Args:

  • path (str): If provided, a pathname for the folder in which to export the components; otherwise derived from the patternId. Defaults to None.

method fromBytes

fromBytes(blob: bytes)  EPE

Creates and returns a new Electromage Pattern Export (EPE) whose contents are loaded from a bytes array.

Args:

  • blob (bytes): The data from which to create the Electromage Pattern Export (EPE).

Returns:

  • EPE: A new Electromage Pattern Export (EPE) object.

method fromFile

fromFile(fileName: str)  EPE

Creates and returns a new portable pattern EPE whose contents are loaded from a file on disk.

Args:

  • fileName (str): The name of the file from which to create the Electromage Pattern Export (EPE).

Returns:

  • EPE: A new Electromage Pattern Export (EPE) object.

method toFile

toFile(fileName: str = None)

Saves this Electromage Pattern Export (EPE) to a file on disk.

Args:

  • fileName (str, optional): If provided, a name for the file to be created; otherwise derived from the patternId. Defaults to None.

class PixelblazeEnumerator

Listens on a network to detect available Pixelblazes, which the user can then list or open as Pixelblaze objects. Also provides time synchronization services for running synchronized patterns on a network of Pixelblazes.

method __init__

__init__(hostIP='0.0.0.0')

Create an object that listens continuously for Pixelblaze beacon packets, maintains a list of Pixelblazes and supports synchronizing time on multiple Pixelblazes to allows them to run patterns simultaneously. Takes the IPv4 address of the interface to use for listening on the calling computer. Listens on all available interfaces if hostIP is not specified.


method disableTimesync

disableTimesync()

Turns off the time synchronization -- the PixelblazeEnumerator will not automatically synchronize Pixelblazes.


method enableTimesync

enableTimesync()

Instructs the PixelblazeEnumerator object to automatically synchronize time on all Pixelblazes. (Note that time synchronization is off by default when a new PixelblazeEnumerator is created.)


method getPixelblazeList

getPixelblazeList()

method setDeviceTimeout

setDeviceTimeout(ms)

Sets the interval in milliseconds which the enumerator will wait without hearing from a device before removing it from the active devices list.

The default timeout is 30000 (30 seconds).


method start

start(hostIP)

Open socket for listening to Pixelblaze datagram traffic, set appropriate options and bind to specified interface and start listener thread.


method stop

stop()

Stop listening for datagrams, terminate listener thread and close socket.


This file was automatically generated via lazydocs.