add_device()
- Register a device for a specific gateway.
Edit
- 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.
Edit
require "core"
local gateway = core.get_gateway()
local device = core.add_device( { gateway_id = gateway.id, ... } )