2GIG module

Module provides an access to a 2GIG functionality.

require "2gig"

subscribe(script_name)

Subscribe a script for 2GIG events. After subscribing the script will be launched for each event happens on a 2GIG addon and information about this event will be passed as parameters.

params:

script_name: string

return:

nil

example:

local twogig = require "2gig"

twogig.subscribe("HUB:2gig/scripts/events_handling")

unsubscribe(script_name)

Unsubscribe a script from 2GIG events.

params:

script_name: string

return:

nil

example:

local twogig = require "2gig"

twogig.unsubscribe("HUB:zigbee/scripts/events_handling")

reset()

Reset 2GIG addon.

params:

none

return:

nil

example:

local twogig = require "2gig"

twogig.reset()

add_device(device_info)

Add 2GIG device by serial.

params:

device_info: table

Field Type Required Description
serial int + Device serial number (7-digit TXID)
model string - Device model (case insensitive). List of supported devices
device_type string - Device type

return:

nil

example:

local twogig = require "2gig"

twogig.add_device({
    serial = 571480,
    model = "2GIG-PANIC1-345"
})

remove_device(serial)

Remove 2GIG device by serial.

params:

serial: int

return:

nil

example:

local twogig = require "2gig"

twogig.remove_device(571480)