|  Developer
Updated on November 24, 2021

hub.scene.added

  • Sent as a confirmation when a user adds a new scene to the hub via the UI. This broadcast is a response to a hub.scenes.create command.

    A scene is an ‘If-Then’ rule whereby an action is carried out as the result of a trigger (or ‘condition’). For example, users can create a scene to automatically turn the lights on (action) when a motion detector detects movement (trigger). Scenes can be triggered manually, or by a device, or by a time schedule. Users can also set up scenes to send notifications upon specific triggers.

    In the API, the trigger conditions are called ‘when’ blocks, and the resulting actions are called ‘then’ blocks.
Edit

See the table of parameters in hub.scenes.create

Edit
				
					{
    "id": "ui_broadcast",
    "msg_subclass": "hub.scene.added",
    "result": {
        "_id": "5c7ff48b7f00002a07a408e3",
        "enabled": true,
        "group_id": null,
        "is_group": false,
        "name": "testRule",
        "parent_id": "5c6ec961cc01eb07f86f9dd9",
        "syncNotification":true,
        "then": [
            {
                "blockOptions": {
                    "method": {
                        "args": {
                            "item": "item",
                            "value": "value"
                        },
                        "name": "setItemValue"
                    }
                },
                "blockType": "then",
                "fields": [
                    {
                        "name": "item",
                        "type": "item",
                        "value": "5c7fea737f00000ab55f2e5d"
                    },
                    {
                        "name": "value",
                        "type": "bool",
                        "value": false
                    }
                ]
            }
        ],
        "when": [
            {
               "blockOptions":{
                  "method":{
                     "args":{  
                        "sunstate":"sunrise",
                        "time":"time"
                     },
                     "name":"isSunState"
                  }
               },
               "blockType":"when",
               "fields":[
                  {
                     "name":"sunrise",
                     "type":"string",
                     "value":"before"
                  },
                  {
                     "name":"time",
                     "type":"hms_interval",
                     "value":"10:30"
                  }
               ]
            }
        ]
    }
}