Animations
Because of the real-time nature of controlling WS281x and similar LEDs, this module does not provide direct control of them. Instead it controls them with special Python functions called animations that are triggered by sending commands to MQTTany. There are a handful of built-in animations, and you can write any number of custom animations for your application.
Triggering
Animations can be triggered by sending a command to the array on the path
{array-id}/animation/set
. The command must be a JSON string containing
some parameters that can modify the behavoir of the animation. The animation
name will be published to {array-id}/animation
when it is started, when
an animation ends a blank message is published.
Commands
Commands must be JSON strings with the following elements:
{
"anim": "ANIMATION_NAME", # required
"priority": 1, # optional
"repeat": 1, # optional
"arg": "value" # any additional arguments for animation
}
Parameter |
Description |
---|---|
|
The name of the animation (Ex. |
|
The priority with which to process the animation.
Optional, default |
|
How many times to repeat the animation, can be any
positive integer, Optional, default |
|
Any other values will be passed to the animation function as keyword arguments when called. |