Action Block Structure
Field | Type | Required | Description |
---|---|---|---|
blockOptions | JsonObject | + | Action block options |
blockOptions.method | JsonObject | + | Action description |
blockOptions.method.args | JsonObject | + | Action description arguments that should be read from attribute |
blockOptions.method.name | string | + | Name of action |
fields | JsonArray | + | Array of fields that must be extracted by the names |
fields[].name | string | + | Name of the field block corresponding of the declaration in |
fields[].type | string | – | Represents the Item Value Type |
fields[].value | string | + | Value should be corresponded to the |
delay | JsonObject | – | Delay to action after event arises. If this field is absent or is empty then delay is absent. |
blockMeta | JsonObject | – | Block metadata information. Intended to save data needed for user interfaces. |
delay.seconds | int | – | Seconds number of delay |
delay.minutes | int | – | Minutes number of delay |
delay.hours | int | – | Hours number of delay |
delay.days | int | – | Days number of delay |
control | JsonObject | – | Control flow of execution of this action |
control.exception | JsonObject | – | Exceptions for execution of the action |
exec_policy | string | – | It is execution policy of block. The block policy have higher priority then policy of scene ( see description of hub.scenes.create ). If block policy is absent then block inherits policy of scene. The block policy can have next states: – result of execution each block should checked and scene should be failed in case if block is failed; – result of execution each block should be ignored and checked only in the end of scene execution. If any action was failed than partially_finished status. If all blocks have this status and all of them are failed than failed status. |
Execution policies
- The execution policy is a rule for executing actions in a scene. It determines how actions are executed and what error statuses are available. If no execution policy is specified for an action or the scene, the policy is used to run actions.
Sequence of actions
If a policy is set on the scene level: Actions from the action block are started in the order they are placed in the array.- – all actions are started one by one. For durable actions, the following action doesn’t wait for the previous action to complete. The scene progress status is calculated later when all actions are completed.
- – all actions are executed sequentially, from first to last. If an action is durable, the following action will wait for the previous one to finish. If an action fails, the following actions are not executed. The scene progress status is set to or .
- – all actions are executed sequentially, from first to last. If an action is durable, the following action will wait for the previous action to finish. The following action is started even if the previous action has failed. In case of an error, the scene progress status is set to or .
- – runs the following action just after the current action is started.
- – runs the following action after the current one only if the current action is successfully finished.
- – runs the following action after the current one is finished or failed.
Error checking
- – the result of executing each block is ignored and checked only at the end of scene execution.
- – the result of executing each block is checked, and the scene marked as failed if any block has failed.
- – is a mix of and . Scenes with the exec_policy wait_result should execute their actions one by one, i.e., start the next action after the previous one has finished. Execution continues even if the previous action fails.