|  Developer
Updated on February 14, 2023

stringOperation

  • Fulfils selected operation on a string.
  • When the data source is a device/item group, the event is stateless. It arises every time the condition is true, no matter which value of an event was previously. See Stateless comparison.
  • This feature is available since the version. The scene is triggered when the condition of the specified operation is satisfied.
  • operation checks if the item’s value begins with string specified in the parameter.
  • operation checks if the item’s value ends with string specified in the parameter.
  • operation check if the item’s value contains string specified in the parameter.
  • operation checks if the length of the item’s value is equal to the number specified in the parameter.
  • operation checks if the item’s value does not begin with string specified in the parameter.
  • operation checks if the item’s value does not end with string specified in the parameter.
  • operation checks if the item’s value does not contain string specified in the parameter.
  • operation checks if the length of the item’s value is NOT equal to the number specified in the parameter.
Edit
Field Type Required Description
blockOptions.method.args.item
blockOptions.method.args.expression
item
expression
+ Id of an item/expression whose value will be used as an operand for the string operation.
blockOptions.method.args.deviceGroup string Value source will be used as an operand for the string operation. References a device group by its ID. The parameter is required.
blockOptions.method.args.itemGroup string Value source will be used as an operand for the string operation. References an item group by its ID. The parameter is required.
blockOptions.method.args.operation string + Operation, which will be fulfilled. Possible values: , , , , , , , .
blockOptions.method.args.value int/string + Argument of the string operation. for and operations, – for all other cases.
Edit
Internal error code Message Data
SCENE_WRONG_WHEN_BLOCK stringOperation: empty id of an item ezlo.scenes.block.when.wrong
SCENE_WRONG_WHEN_BLOCK stringOperation: “operation” field is empty ezlo.scenes.block.when.wrong
SCENE_WRONG_WHEN_BLOCK stringOperation: “value” field is empty ezlo.scenes.block.when.wrong
SCENE_WRONG_WHEN_BLOCK stringOperation: cannot create valid value: [REASON] ezlo.scenes.block.when.wrong
SCENE_WRONG_WHEN_BLOCK stringOperation: unknown operation: [OPERATION] ezlo.scenes.block.when.wrong
SCENE_WRONG_WHEN_BLOCK stringOperation: “[length/not_length]” operation requires operand to be a number ezlo.scenes.block.when.wrong
SCENE_WRONG_WHEN_BLOCK stringOperation: “[begin/end/contain/not_begin/not_end/not_contain]” operation requires operand to be a non-empty string ezlo.scenes.block.when.wrong
Edit
Edit

Example 1: string operation of an item

				
					{
    "blockType": "when",
    "blockOptions": {
        "method": {
            "name": "stringOperation",
            "args": {
                "item": "item",
                "operation": "operation",
                "value": "value"
            }
        }
    },
    "fields": [
        {
            "name": "item",
            "type": "item",
            "value": "5de64f6a70c7be0541cc0853"
        },
        {
            "name": "operation",
            "type": "string",
            "value": "contain"
        },
        {
            "name": "value",
            "type": "string",
            "value": "operateOnThis"
        }
    ]
}				
			
Edit

Example 2: string operation of any item that matches the device/item group with operation type:

Define a device group, define an item group, make a condition block to make a string operation of an hub.item.updated broadcast with the operation value.

The operation is stateless. It doesn’t have information about previous value of any item in the group.

Operation type: stateless

				
					{
    "blockType":"when",
    "blockOptions":{
        "method":{
            "name":"stringOperation",
            "args":{
                "deviceGroup":"deviceGroup",
                "itemGroup":"itemGroup",
                "operation": "operation",
                "value": "value"
            }
        }
    },
    "fields":[
        {
            "name":"deviceGroup",
            "type":"device_group",
            "value":"5de64f6a70c7be0541cc0853"
        },
        {
            "name":"itemGroup",
            "type":"item_group",
            "value":"5de64f6a70c7be0541cc0854"
        },
        {
            "name": "operation",
            "type": "string",
            "value": "contain"
        },
        {
            "name": "value",
            "type": "string",
            "value": "operateOnThis"
        }
    ]
}				
			

Available since: Group operations filtering is available since .