|  Developer
Updated on May 5, 2022

hub.scenes.blocks.list

  • Version: 1.0
  • Classes: UI
  • Title: Scene manager categories
  • Description: Getting possible conditional/action blocks related to the current device set on the hub for creating the scenes.
Edit
Field Type Required Description
blockType string + enumed literal value. Possible values :
devices stringArray + The array of device IDs are used for filtering of items by device ID
Edit
Field Type Required Description
when JsonArray + Array of the possible blocks related to the current devices/items which are included. By them full set of rules is filtered

OR

Field Type Required Description
then JsonArray + Array of the possible blocks related to the current devices/items which are included. By them full set of rules is filtered
Edit

Here is it an example of usage:

Edit
				
					{
    "id": "_ID_",
    "jsonrpc": "2.0",
    "method": "hub.scenes.blocks.list",
    "params": {
        "blockType": "when",
        "devices": [ "5dd2a8eebfb5be6d20008c55" ]
    }
}				
			
Edit
				
					 {
    "error": null,
    "id": "_ID_",
    "result": {
        "when": [
            {
                "label": {
                    "lang_tag": "ui0_token",
                    "text": "English string"
                },
                "blockOptions":{
                    "method":{
                        "args":{
                            "item":"item",
                            "value":"value",
                            "armed": "armed"
                        },
                        "name":"isItemValue"
                    }
                },
                "blockType":"when",
                "fields":[
                    {
                        "name":"item",
                        "type":"item",
                        "value" : "5dd2a8efc1b5be6d20008c56"
                    },
                    {
                        "name":"value",
                        "type":"bool",
                        "options":[
                            {
                                "value":true,
                                "label": {
                                    "lang_tag": "ui1_token",
                                    "text": "Enable"
                                }
                            },
                            {
                                "value":false,
                                "label": {
                                    "lang_tag": "ui2_token",
                                    "text": "Disable"
                                }
                            }
                        ],
                        "value": true
                    },
                    {
                        "name":"armed",
                        "type":"bool",
                        "value":true
                    }
                ]
            },
            {
                "label":{
                    "lang_tag":"ui0_token",
                    "text":"English string"
                },
                "blockOptions": {
                    "method": {
                        "args": {
                            "item": "item",
                            "comparator":"comparator",
                            "value":"value"
                        },
                        "name": "compareNumbers"
                    }
                },
                "blockType": "when",
                "fields": [
                    {
                        "name": "item",
                        "type": "item",
                        "value": "897607_32771_2"
                    },
                    {
                        "name":"comparator",
                        "type":"string",
                        "options":[
                            {
                                "value":"==",
                                "label":{
                                    "lang_tag":"ui3_token",
                                    "text":"Equal"
                                }
                            },
                            {
                                "value":"!=",
                                "label":{
                                    "lang_tag":"ui4_token",
                                    "text":"Not equal"
                                }
                            },
                            {
                                "value":">",
                                "label":{
                                    "lang_tag":"ui5_token",
                                    "text":"Greater"
                                }
                            },
                            {
                                "value":"<",
                                "label":{
                                    "lang_tag":"ui6_token",
                                    "text":"Less"
                                }
                            },
                            {
                                "value":">=",
                                "label":{
                                    "lang_tag":"ui7_token",
                                    "text":"Greater and equal"
                                }
                            },
                            {
                                "value":"<=",
                                "label":{
                                    "lang_tag":"ui8_token",
                                    "text": "Less and equal"
                                }
                            }
                        ],
                        "value":"=="
                    },
                    {
                        "name":"value",
                        "type":"int",
                        "value": 10
                    }
                ]
            },
            {
                "label": {
                    "lang_tag": "ui0_token",
                    "text": "English string"
                },
                "blockOptions": {
                    "method": {
                        "args": {
                            "item": "item",
                            "value":"value"
                        },
                        "name": "isDictonaryValueState"
                    }
                },
                "blockType": "when",
                "fields": [
                    {
                        "name": "item",
                        "type": "item",
                        "value": "897607_32771_3"
                    },
                    {
                        "name":"value",
                        "type":"token",
                        "options":[
                            {
                                "value":"low_battery",
                                "label": {
                                    "lang_tag": "ui9_token",
                                    "text": "Low battery"
                                }
                            },
                            {
                                "value":"not_detected",
                                "label": {
                                    "lang_tag": "ui10_token",
                                    "text": "Not detected"
                                }
                            }
                        ],
                        "value": "low_battery"
                    }
                ]
            }
        ]
    }
}