[ST Edge] Restriction on driver.try_create_device method?

I’m implementing an edge driver for Terncy hub, it may expose lots of devices (up to 100) to SmartThings via the try_create_device method. And I find that the result of the method seems not to be stable enough. Some of devices created are not shown in Smartthings app. User have to perform search devices lots of times, and the devices will be shown gradually.
Is there any restriction on the number of device a driver can expose, or the frequency that a driver can call try_create_device method?
What is the return value of this method, the log showed it is always 1, no matter if the device successfully added to the driver. It’s not specified in the document.

Thanks in advance.

1 Like

If I recall correctly, the function that device:try_create_device(...) method is calling under the hood should retrieve an error message as second return value, e.g.:

local _, err_message = device:try_create_device(metadata)

And I think that debugging is even more effective if you use Lua’s error handling methods, e.g.:

local _, err_message = pcall(device.try_create_device, device, metadata)

Note: you might find useful this thread.

1 Like