|  Developer
Updated on March 8, 2023


  • Register a device for a specific gateway.
  • params: device (table). Note, don’t pass id into table, it’s auto-generated.
  • return: device id (string) or nil if failed to add a device.

Note: If parent_device_id is set to a child device id, then the return value would be nil and no device will be created.

					require "core"

local gateway = core.get_gateway()
local device = core.add_device( { gateway_id = gateway.id, ... } )