2GIG Plugin Broadcasts
Broadcasts informs about events in 2GIG Plugin scripts. 2GIG plugin sends all broadcasts as hub.extensions.plugin.ui_broadcast with special parameters.
add_device
Sent after add_device is finished executing
initiators:
result fields:
Field | Value | Type | Required | Description |
---|---|---|---|---|
event | add_device |
string | + | Event name |
plugin | 2gig |
string | + | Plugin name |
status | string | + | Result of the operation, can be any of 2GIG Addon event statuses | |
details | string | - | Event failure reason |
Examples
{
"id": "ui_broadcast",
"msg_subclass": "hub.extensions.plugin.ui_broadcast",
"result": {
"event": "add_device",
"plugin": "2gig",
"status": "finished"
}
}
{
"id": "ui_broadcast",
"msg_subclass": "hub.extensions.plugin.ui_broadcast",
"result": {
"event": "add_device",
"plugin": "2gig",
"status": "failed",
"details": "Device not supported"
}
}
device_discovering
Sent on operation status update
initiators:
result fields:
Field | Value | Type | Required | Description |
---|---|---|---|---|
event | device_discovering |
string | + | Event name |
plugin | 2gig |
string | + | Plugin name |
status | string | + | Result of the operation, can be any of 2GIG Addon event statuses |
Examples
{
"id": "ui_broadcast",
"msg_subclass": "hub.extensions.plugin.ui_broadcast",
"result": {
"event": "device_discovering",
"plugin": "2gig",
"status": "finished"
}
}
{
"id": "ui_broadcast",
"msg_subclass": "hub.extensions.plugin.ui_broadcast",
"result": {
"event": "device_discovering",
"plugin": "2gig",
"status": "timeout"
}
}
new_device_discovered
Sent when a packet from a new device has been received during device discovering.
initiators:
result fields:
Field | Value | Type | Required | Description |
---|---|---|---|---|
event | new_device_discovered |
string | + | Event name |
plugin | 2gig |
string | + | Plugin name |
serial | int | + | Device serial | |
device_type | int | + | Device type. Can be any of supported device types | |
possible_models | string[] | + | List of integrated devices of the same device type |
Examples
{
"id": "ui_broadcast",
"msg_subclass": "hub.extensions.plugin.ui_broadcast",
"result": {
"event": "new_device_discovered",
"plugin": "2gig",
"serial": 622191,
"device_type": "door_window_sensor",
"possible_models": [
"2GIG-DW10-345"
]
}
}