Edge Drivers - Driver Presentation and Custom Capabilities

Apologies if I am being ‘lazy’.

I have just gone through the 92 posts of ‘Custom Capabilities for a driver’ and it seems like it would be very helpful if the process was summarised into a concise set of steps that specify the CLI commands and the files that need to be created to add a custom capability and a custom device presentation. (Specifically for the edge driver scenario)

I appreciate the process is evolving, however, even noting the ‘work arounds/expected to change in the future’ would also be helpful. We could even keep the post updated

If There is a better thread for me to work through, please point me in the right direction

Here is the beginning (I am reasonably confident this is correct)

To create <namespace.newCapability> and use in a new edge driver

  1. Edit a json or yaml file to define the capability call it <newCapability.json>
  2. Execute CLI - smartthings capabilities:create -j -i=<newCapability.json>
  3. Edit a json or yaml file to define the capability presentation call it <newPresentation.json>
  4. Execute CLI - smartthings capabilities:presentation:create <namespace.newCapability> -j -i=<newPresentation.json>
  1. Execute smartthings edge:drivers:package

I think this is an example of where the documentation could do with a bit of improvement

1 Like

Here are the basic steps. Each of these is potentially a topic by itself, and I’d recommend looking at the API docs for reference on how to build the various inputs for each.

Create the capability:

smartthings capabilities:create -j -i new_cap.json

Create translations for the capability. You can also use update or create, but upsert will avoid errors since the en locale is created by default when the capability is created.

smartthings capabilities:translations:upsert -j -i new_cap_translation.json

Create the capability presentation, referencing the translations you just created for any labels.

smartthings capabilities:presentation:create -j -i new_cap_presentation.json

Add the capability to the profile.yml in your driver (and elsewhere in your driver as necessary). That’s usually enough, but if you need something special like a multi-attribute dashboard or visible conditions then create a device configuration and add the resulting vid and mnmn to your profile.yml.

smartthings presentation:device-config:create -j -i new_device_config.json

Assuming you’ve already created a channel and enrolled your hub, you can package/assign/install in one step.

smartthings edge:drivers:package driver_package_directory -I

Many thanks,

At the moment im struggling with

Trying to have a multi-attribute dashboard … Any where I can look to get info?
docs Doesn’t really explain it

I’ve created the config for my implemented driver and it includes all the capabilities but does not display them as I want

Thanks… Post 1423/1431 -:slight_smile: Would have taken a while to get to that.

The steps you shared above to use a custom capability in a driver are not needed anymore. This means you don’t have to create the JSON file, the Hub doesn’t expect the capability from a file.
There was an issue where the capabilities weren’t found and that’s why we needed to include them from a file.
In a driver, you can just reference it as follows:

local capabilityVar = capabilities["your_namespace.capabilityId"]

Here’s an example: SampleDrivers/init.lua at main · SmartThingsDevelopers/SampleDrivers · GitHub

Note: In the sample above, the files for the capability and presentation are for reference only, they don’t need to be included in the driver package

It’s a long thread full of painful memories… I wouldn’t recommend reading from the top since the first 1000+ posts are outdated.


But surely we still need to add the presentations and configs using the CLI?

These are still relevant arent they?

Yes, you still need to create all the configurations using the API (the CLI helps you with this)
The Device presentation (device-config) is not mandatory, it’s only used when you need a special configuration as Phil said.

Yes, this is updated. (thank you @philh30 for sharing them :smiley:)
The only comment I can add is:
Editing the translation of the capability (or creating a new one for another locale/language) is needed if you want to modify the labels that appear for the capability. This is something recent, that’s why the documentation isn’t very clear, I already reported that.