|  Developer
Updated on May 25, 2022

Exceptions in Actions

  • Exceptions define if the associated action will be executed. If the exception’s condition is not satisfied (i.e. exception state is evaluated to ), the action will not be executed.
  • In case the action was skipped due to the dissatisfied state of an exception, the action will be considered successfully completed. I.e. if all actions during a scene execution will be skipped, “finished” is sent in hub.scene.run.progress broadcast.
    But in case the exception’s state cannot be evaluated the action will be skipped and considered failed. For example, this might happen if the exception referencing deleted scene block. This will affect hub.scene.run.progress broadcast accordingly.
  • Exceptions might be used in any kind of actions: in then blocks, in else blocks and in those action, which are placed in action groups.
FieldTypeRequiredDescription
typestring+Type of the exception. Possible values are: , .
sceneIdstringScene identifier. Used when the exception is of type and a block from the another scene is referenced.
blockIdstringWhen block identifier, which belongs to the scene, pointed by the parameter. If the is missing, a when block from the current scene is addressed. Required when the exception is of type.
namestringName of an expression variable of value type. Required when the exception is of type.
  • might be referencing a block from the current scene. To avoid the necessity to create and then modify the scene with id of the newly created block, id placeholders might be used. Scenes engine is now able to generate the unique id for a block and replace all same id placeholders with the generated id. To use this feature it is needed to add a block reference in the exception’s configuration with the fake identifier like “${idplaceholder-1}” during scene creation/editing and use the same placeholder in the definition of referenced block

Example: block reference

				
					{
   "blockOptions":{
      "method":{
         "args":{ "item":"item", "value":"value" },
         "name":"setItemValue"
      }
   },
   "control": {
      "exception": {
         "type": "block_reference",
         "blockId": "${block1}"
      }
   },
   "blockType":"then",
   "fields":[
      {
         "name":"item",
         "type":"item",
         "value" : "62615f3f00000014c9b4921b"
      },
      {
         "name":"value",
         "type":"int",
         "value": 1
      }
   ]
}				
			

Example: expression reference

				
					{
   "blockOptions":{
      "method":{
         "args":{ "item":"item", "value":"value" },
         "name":"setItemValue"
      }
   },
   "control": {
      "exception": {
         "type": "expression_reference",
         "name": "variable"
      }
   },
   "blockType":"then",
   "fields":[
      {
         "name":"item",
         "type":"item",
         "value" : "62615f3f00000014c9b4921b"
      },
      {
         "name":"value",
         "type":"int",
         "value": 1
      }
   ]
}				
			

This feature is available since advanced_scenes/1.44.

Exceptions of the expression_reference type are available since advanced_scenes/1.46.