|  Developer
Updated on December 5, 2022

IsDeviceState

  • Triggered if the state of the device (states of some device parameters) begins to match the conditions of the block.
  • For example, if in block set parameter with value then scene should be triggered if state of given device (by this deviceId) will change to value. If in the block given a few params for example and then the scene should be triggered if both ( and ) these parameters state in a given device start to be matched with both block conditions.
  • These events also arise when the data source is a device 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 advanced_scenes/1.52.
Edit
Field Type Required Description
blockOptions.method.args.device string + A device identifier
blockOptions.method.args.armed bool A value of a device.armed flag to track
blockOptions.method.args.reachable bool A value of a device.reachable flag
blockOptions.method.args.deviceGroup string Value source for the left part of the comparison operator. References a device group by its ID. The parameter is required.
Edit
Internal error code Message Data
BAD_PARAMS Wrong params,
Edit
Edit

One condition: triggers when the field is changed to

				
					{
    "blockOptions": {
        "method": {
            "args": {
                "device": "device",
                "armed": "armed"
            },
            "name": "isDeviceState"
        }
    },
    "blockType": "when",
    "fields": [
        {
            "name": "device",
            "type": "device",
            "value": "deviceId"
        },
        {
            "name": "armed",
            "type": "bool",
            "value": true
        }
    ]
}				
			
Edit

One condition: triggers when the is changed to

				
					{
    "blockOptions": {
        "method": {
            "args": {
                "device": "device",
                "reachable": "reachable"
            },
            "name": "isDeviceState"
        }
    },
    "blockType": "when",
    "fields": [
        {
            "name": "device",
            "type": "device",
            "value": "deviceId"
        },
        {
            "name": "reachable",
            "type": "bool",
            "value": true
        }
    ]
}				
			
Edit

Multiple conditions: triggers, when the is equal to and the , is equal to the first time. Holds the state till any of these fields change their values

				
					{
    "blockOptions": {
        "method": {
            "args": {
                "device": "device",
                "reachable": "reachable",
                "armed": "armed"
            },
            "name": "isDeviceState"
        }
    },
    "blockType": "when",
    "fields": [
        {
            "name": "device",
            "type": "device",
            "value": "deviceId"
        },
        {
            "name": "armed",
            "type": "bool",
            "value": false
        },
        {
            "name": "reachable",
            "type": "bool",
            "value": true
        }

    ]
}				
			
Edit
  • Example: compare value of any device that matches the device group:
  • Define a device group, make a condition block to make a comparison of an hub.device.updated broadcast with the condition value.
    The comparison is stateless. It doesn’t have information about previous value of any device in the group.
  • Comparison type: stateless
				
					{
    "_id": "6388c7200000005ae756292c",
    "actionGroup": "6388c7200000005ae756292c",
    "blockOptions": {
        "method": {
            "args": {
                "armed": "armed",
                "deviceGroup": "deviceGroup",
                "reachable": "reachable"
            },
            "name": "isDeviceState"
        }
    },
    "blockType": "when",
    "fields": [
        {
            "name": "deviceGroup",
            "type": "device_group",
            "value": "6388c7200000005ae7562929"
        },
        {
            "name": "armed",
            "type": "bool",
            "value": false
        },
        {
            "name": "reachable",
            "type": "bool",
            "value": false
        }
    ]
}