[ST Edge] Custom Capability Not Showing

I am trying to create a custom capability similar to that of a contact sensor. I am able to create the capability and presentation with the CLI and my device is packaged when that capability is used in the profile. However, I can’t get it to show up in the UI. Here are the yml files:

Capability

name: Aux Contact Sensor
attributes:
  contact:
    schema:
      type: object
      properties:
        value:
          type: string
          enum:
            - open
            - closed
      additionalProperties: false
      required:
        - value
    enumCommands: []
id: myId.auxContactSensor
version: 1

Presentation

dashboard:
  states:
    - label: "{{contact.value}}"
      alternatives:
        - key: open
          value: Open
        - key: closed
          type: inactive
          value: Closed
  actions: []
  basicPlus: []
detailView:
  - label: Aux Contact Sensor
    displayType: state
    state:
      label: "{{contact.value}}"
      alternatives:
        - key: open
          type: active
          value: Open
        - key: closed
          type: inactive
          value: Closed
automation:
  conditions: []
  actions: []
id: myId.auxContactSensor
version: 1

Any ideas what I may be missing? I plan to add some commands to this capability once I get this working

I’ve been under the impression that enum on the capability is a problem. I’ve stopped including that on mine.

They are using it in the ST sample driver for demo-ing custom capabilities. The code works. I can update the attributes and see them in the logs:

Got it working. The files are fine. I didn’t see it anywhere in the documentation, but it looks like custom capability presentations only work with custom device presentations. I was trying to just add the capability to the profile as I didn’t need an entire device presentation.

Hi @blueyetisoftware,

It is not necessary to create a custom device presentation, vid, for custom capabilities to be displayed.

They just need to have a capability presentation made and add the capability to the profile in the desired order.

I have some devices with custom capabilities and without a custom vid

This is what I tried with the capability above. It was not showing up in the device. As soon as I made a custom vid, it showed right up. Maybe it is a sync issue?

the profile did not have a vid prior to the incorporation of the custom capability, right?

Correct. It was pretty simple:

name: garage
components:
- id: main
  capabilities:
  - id: doorControl
    version: 1
  - id: lock
    version: 1
  - id: myId.auxContactSensor
    version: 1
  categories:
  - name: GarageDoor

Well, I would try again leaving the profile without any vid. should work too, But if it works well with the vid it’s perfect

@Mariano_Colmenarejo is right.
If you added the device and then modified the profile without doing anything more, you could have hit the issue with the cache, this means that the modification to the profile takes some time to appear.
You need to verify the following:

  • Presentation used by the device to see if the capability was added correctly
  • If the point above is “true”, clearing the SmartThings app cache should help you to show the capability (only for Android devices)

If you continue using the VID, remember that every change to the profile or the custom capability presentation needs a refresh of the VID, this means using the command smartthings presentation:device-config:create again.

Thanks. I ran into this as well. I found it out through trial and error :slight_smile: I am going to assume it was the caching issue. I ran into that a few times, where I needed to remove and re-add my device to get the new presentation to appear.

@nayelyz, @blueyetisoftware

For what it’s worth, I’ve seen that if you make a custom presentation and not include the Refresh capability in the presentation/detailView, when you refresh the device in the App, the refresh command is not executed in the driver.

I had to redo some presentation because I hadn’t included it and I checked the refresh execution was not seen in the logcat.

"detailView": [
        {
            "component": "main",
            "capability": "refresh",
            "version": 1,
            "values": [],
            "patch": []
        },

I have also seen that something has changed in the update of changes in the presentations:
Now if you make a change in the dashboard/group name of the presentation, another different VID is generated and the change is displayed perfectly. Before, a new VID was not generated if you made a mistake in the name of the group and wanted to modify it. :+1:

This has allowed me to create different VIDs with different group names and thus identify the different switches of a strip o multi switch names selected from preferences.

{
    "mnmn": "SmartThingsCommunity",
    "vid": "e445cc36-925e-3998-af4b-c371700df31e",
    "version": "0.0.1",
    "type": "profile",
    "iconUrl": null,
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "switch",
                "version": 1,
                "idx": 0,
                "group": "main",
                "values": [],
                "composite": true
            },
            {
                "component": "switch1",
                "capability": "switch",
                "version": 1,
                "idx": 0,
                "group": "Luz Terraza",
                "values": [],
                "composite": true
            },

{
    "mnmn": "SmartThingsCommunity",
    "vid": "9c708a8d-4513-3c90-ba7f-30fb0847706e",
    "version": "0.0.1",
    "type": "profile",
    "iconUrl": null,
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "switch",
                "version": 1,
                "idx": 0,
                "group": "main",
                "values": [],
                "composite": true
            },
            {
                "component": "switch1",
                "capability": "switch",
                "version": 1,
                "idx": 0,
                "group": "Lámpara Salón",
                "values": [],
                "composite": true
            },

I would only request @nayelyz that the name of the group be allowed to be created with a value of a variable, for example: device.preferences.customName or value of attribute from a custom capability