|  Developer
Updated on June 23, 2022

hub.scenes.expressions.list

  • Version: 1.0
  • Classes: UI
  • Title: Scene manager categories
  • Description: List all expressions. Can show expressions with or without code field.
Edit
Field Type Required Description
showCode boolean If true, code field will be added. Default value is false.
filterType string Value type to filter list with. only expressions comparable to that value should be shown.
filterTypes array of strings An array of value types to show all expressions of all comparable types.
variable bool If true should show only records with property set to true. If false, shows all records with property is false, OR without that property. If omitted, shows all present records (default).
names array of strings Limit a result set with only listed . Default: return all .
showValue bool Show values of objects. Default: true.
Use to limit amount of traffic.
Edit
Field Type Required Description
expressions array of objects + An array of expressions
expressions[index].name string + An expression name
expressions[index].code string Expression code
expressions[index].value number / string / boolean / object An expression value. It will reflect the current expression state and changes if any item referred to by the expression change. One of and should be present.
expressions[index].error array of strings Expression errors. The error appears if the expression components change. Successfully created expressions do not have an field. A failed expression can be saved with errors, in which case both and fields are possible.
expressions[index].valueType string Required for typed expressions; optional, by default is empty.
expressions[index].metadata any json Metadata of an expression. Can be of valid JSON object. If null, should not be shown.
expressions[index].variable boolean If , the expression is a variable. Variables cannot use the collection.
Edit

Call:

				
					{
   "id":"_ID_",
   "method":"hub.scenes.expressions.list",
   "params":{ 
      "withCode": true
   }
}				
			

Reply:

				
					{
    "error": null,
    "id": "_ID_",
    "result": {
        "expressions":[ {
            "name":"TwoTwo",
            "code": "return 2 + 2",
            "value":"4" 
          }
        ]
    }
}				
			

Show only expressions of types , ,

Call:

				
					{
   "id":"_ID_",
   "jsonrpc":"2.0",
   "method":"hub.scenes.expressions.list",
   "params":{
        "showCode": false,
        "filterTypes": [ "int", "float", "bool"]
   }
}				
			

Show only expressions comparable for type “illuminance”; can be “illuminance”, “int”, “float”. Illuminance has no converters defined.

Call:

				
					{
   "id":"_ID_",
   "jsonrpc":"2.0",
   "method":"hub.scenes.expressions.list",
   "params":{
        "showCode": false,
        "filterType": "temperature"
   }
}				
			

Show only expressions of type “temperature”.

Call:

				
					{
   "id":"_ID_",
   "jsonrpc":"2.0",
   "method":"hub.scenes.expressions.list",
   "params":{
        "showCode": false,
        "filterType": "temperature"
   }
}				
			

Reply:

				
					{
    "error": null,
    "id": "_ID_",
    "result": {
        "expressions":[
            {
                "name": "myVar1",
                "params": {},
                "value": "6",
                "variable": true
            },
            {
                "name": "kitchenHallTempAverage",
                "params": {
                    "items": [
                        {
                            "name": "kitchenTemperatureSetpoint",
                            "_id": "5fecdf73222aaa175f6d6be4"
                        },
                        {
                            "name": "hallTemperatureSetpoint",
                            "_id": "60c7696b933ffb710a8be319"
                        }
                    ]
                },
                "value": { "value": 1.27641, "scale": "fahrenheit" },
                "valueType": "temperature",
                "metadata": { "info": "contents of metadata field" }
            },
            {
                "name": "varWithError",
                "params": {},
                "error": "Some error occurred, error description here"
            },
        ]
    }
}