Actions

Actions can be called from any events within the Workflow like on button pressed, on received message etc.

Create an Action

self.addAction(Name, Group, FunctionToCall)

Example

circle-info

The Group is "optional" and helps within the menu to organize a larger amount of actions. Leave Group empty and the action will be found directly within the root of the plugin and won't be organized within folders.


Action with parameter


Action with dynamic changeable data target parameter

If actions needs dynamic parameter its possible to use the entities data structure for these.

Example:


Action with multiple parameters

circle-exclamation

Using data response within an Action

It´s possible, that an action returns data into the data workflow "pipeline".

A response need to be a sp.ValueTree():

Or sp.ValueTree.fromDict():


Force an Action to trigger the "failed" pin

If not other defined within the callback(), the Action will always trigger the "success" pin from your action, as long the plugin is enabled.

There are many reasons why an action will be not successful, like being not connected to the device etc.

In this cases the plugin should "catch" these behaviors and use callback(response, failed=True):

or like:

Last updated