|  Developer
Updated on February 14, 2023

compareNumberRange

  • Compare number values.
  • This 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 version. Item or expression values are compared according to a conditional comparator that can take two values: or . The default is . The value of the comparator is assumed to be the condition: In the case of not_between: .

When the condition is met, the scene should be triggered.

Edit
Field Type Required Description
blockOptions.method.args.item
blockOptions.method.args.expression
item
expression
+ Id of item or expression which value need to use for checking.
blockOptions.method.args.deviceGroup string Value source will be used as an operand for checking. 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 checking.. References an item group by its ID. The parameter is required.
blockOptions.method.args.startValue int/float + First value of the range.
blockOptions.method.args.endValue int/float + Last value of the range.
blockOptions.method.args.comparator string Type of comparator. Possible values: , . Default value: .
blockOptions.method.args.startValue.scale string Scale value for startValue.
blockOptions.method.args.endValue.scale string Scale value for endValue.
Edit
Internal error code Message Data
BAD_PARAMS Wrong params,
Edit
Edit

Example 1: compareNumberRange operation of an item:

				
					{
   "blockType":"when",
      "blockOptions":{
         "method":{
            "name":"compareNumberRange",
            "args":{
               "item":"item",
               "comparator":"comparator",
               "startValue":"startValue",
               "endValue":"endValue"
            }
         }
      },
      "fields":[
         {
            "name":"item",
            "type":"item",
            "value":"5de64f6a70c7be0541cc0853"
         },
         {
            "name":"comparator",
            "type":"string",
            "value":"between"
         },
         {
            "name":"startValue",
            "type":"int",
            "value":51,
            "scale":"degrees"
         },
         {
            "name":"endValue",
            "type":"int",
            "value":100,
            "scale":"degrees"
         }
      ]
}				
			
Edit

Example 2: compareNumberRange 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 compareNumberRange 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":"compareNumberRange",
            "args":{
                "deviceGroup":"deviceGroup",
                "itemGroup":"itemGroup",
                "comparator":"comparator",
                "startValue":"startValue",
                "endValue":"endValue"
            }
        }
    },
    "fields":[
        {
            "name":"deviceGroup",
            "type":"device_group",
            "value":"5de64f6a70c7be0541cc0853"
        },
        {
            "name":"itemGroup",
            "type":"item_group",
            "value":"5de64f6a70c7be0541cc0854"
        },
        {
            "name":"comparator",
            "type":"string",
            "value":"between"
        },
        {
            "name":"startValue",
            "type":"int",
            "value":51,
            "scale":"degrees"
        },
        {
            "name":"endValue",
            "type":"int",
            "value":100,
            "scale":"degrees"
        }
    ]
}				
			

Available since: Group operations filtering is available since .