[ST Edge] Manually add LAN device during development

I am trying to build my first Edge Lua driver for a LAN based device and have packaged, published and installed it to my hub. I don’t have a discovery handler as there is manual configuration that is needed to setup the device, and there is only 1 device that is to be setup if at all.

I tried to go into my app and find the device I just published to add manually, and cannot seem to be able to do it.

So the question is, for a device that cannot be “discovered” but has to be manually configured, how do I add the device to my hub?

Take a look at the ST/SampleDrivers “hello-world” example,
It creates a static device, and then in the profiles, you can add preferences to ask for additional fields (e.g., IP address) which the device can read, and use it.

SampleDrivers/discovery.lua at main · SmartThingsDevelopers/SampleDrivers · GitHub

Thanks - that will solve my problem for now.

Eventually I need to figure out if I publish this driver for others (I need to figure out even how to do that), do they have to have a device automatically added if the driver is added to their hub - that seems a little inefficient than to allow manual addition of a device.

It is not automatic.
Users have to go to ST app > Add device > Scan for nearby devices to add your device.

So I did do all of the above, and the logcat command does not show the log.info at the top of discovery and no device is added. How do I go about debugging what is going on - is there any other debugging tool to find out what may be happening?

Are there any debugging tools to run this outside of the hub in some way? Sorry for the basic questions, but I have been struggling to find comprehensive guides on how to build and test these drivers.

Have you installed the “hello world” driver to your hub?

My way of troubleshooting is by adding log/print to the codes, then install to the hub, and logcat to find the problem, and repeat until I fix the problem. (Yea, I know it’s crazy and time consuming…)

No installed my driver to the hub - it packaged, published and installed ok. The first log.info is in the discovery function that I expect to show up and it does not :slight_smile:

From looking at some other posts it sounds like it should show something about the driver being loaded etc. I see NOTHING after connected…

I think I figured it out - it is because I had removed the discovery: {} from permissions on config.yml.

However, now adding that permission in, causes package to fail with the error…

Error: Request failed with status code 400: “Permissions have been modified”

SOLUTION: driver:delete and then driver:package again - the ID changed when I did that interestingly

1 Like

In the Developer Docs, you can find info about the required structure in the config.yml file:

Yes, the driver ID will change if you delete the package and create it again

Currently, the discovery process is the way @hongtat mentioned, there’s no previous set up to enter properties like IP address and others so the device can be created based on that, at least an initial device needs to be discovered.
After you enter the corresponding preferences (or if you like, you can define custom capabilities for that purpose), you could change the device’s metadata to display the necessary capabilities.
This can be done with the function try_update_metadata which consists of using a previously packaged device profile to overwrite the one being used.