How to update a capability's version?

Hi, All:
As mentioned in the title, how to upgrade a capability‘s version? When the capability function has been modified a little bit, wouldn’t it be better if only the version is used to control it without creating a new capability? But I tried many ways, the version is always “1”.

1 Like

Tagging @nayelyz

Up to now, we cannot create multiple versions for the capability’s presentation.
If the presentation changes, you can use the command below and the changes would be applied in the automatic refresh or when you regenerate the device-config.

smartthings capabilities:presentation:update {{capability-id}} 1 -i capabilityPresentation.json

Make sure these changes are effective by querying your device presentation:

smartthings presentation {{vid}}

Thanks, @Andremain!

1 Like

@nayelyz Has this been updated since last year? Is there a way to control the version of a capability? I am still seeing the CLI always generate a version of 1

AFAIK, the behavior is the same, but I’ll ask the team about that to see if they have an update about that

1 Like

Thanks. I have tried updating a few over the last couple of days. Some updated, while some are still showing the old presentation. Do you know how frequently these are updated if the CLI is used to update the presentation?

It’s quicker to create using a new id (customCap1, customCap2,. customCapN. ) than waiting for the update to get updated… :sweat_smile:

True. During testing, I just keep changing the name. I was asking so that I know for when I eventually have to update one that has already been released to users.

I have the id stored in a variable, and use the variable in the code.
When I change the name, just update this variable, profiles, and capabilitydef.lua.

You would also need to port over any attributes from the old capability as well since it holds state. Is that something you typically deal with?

It should be up to 12 hours. I haven’t tested it further in Edge but what I do in other integrations to have more control over the presentation update is the following:

  • Use a custom device config in the device profile. This means using a VID instead of the automatically generated presentation for the device.
  • Every time you update the capability’s presentation, you need to create the device config again and this should refresh it (query its configuration to verify) and then, if we clear the app cache (Android devices only), we can force the refresh.

Another option in the development process (using the generated device-config) is to reinstall the device.

Hello everyone,

I have just talked to the team. Versioning of capabilities is not yet supported by the platform. We are planning to support it, but we do not have a firm date for that feature.

1 Like

Most of my custom states can be pulled from the actual device when it restarts, or use a default value, if null.
If I need to store the value, I use device:set_field.

@nayelyz / @andresg

I updated a capability for a released driver. I added an additional value to a list of enums. It has now been a few weeks since the update. The presentation has updated fine and the new item shows up in the lists for the detailed view and automation views. The issue I am seeing is that I cannot emit this new value after selecting it. The emit call fails saying that the new value is invalid. Everything updated as expected other than not being able to emit the new value. In this example, I did the equivalent of adding C to the possible values for state.

attributes:
  state:
    schema:
      type: object
      properties:
        value:
          type: string
          enum:
            - None
            - A
            - B
            - C
      additionalProperties: false
      required:
        - value
    setter: apply
    enumCommands: []

Hi, @blueyetisoftware

We are looking into this. I will get back to you as soon as we have an answer.

Did you find any insights to this question? It would be helpful if we could better understand how custom capability updates are handled by the hub as they seem to be quite quirky in some cases.

Hi, @joshua_lyon

Linking this post here: When modified custom capabilities are updated on the hub - #11 by joshua_lyon
Sorry for the delay. We’re checking with the team, so, we’ll let you know once we get more info.

1 Like

Hello, everyone

I checked this information with the team. The amount of time we cache a custom capability is 2 hours. You also need to take into account that the Hub syncs every 12 hours, so the max amount of time an update may take to be effective is 14 hours. You can force a quicker update by resetting your Hub, but you will have to wait 2 hours to do that, because of what I said at the beginning. I hope this information helps you. If any doubts come up, please let me know.

I have seen the UI update, but still have updated capabilities that cause the error described a few posts up. I submitted a bug report and allowed log access. I never heard back on a resolution.

This is my number one biggest headache trying to write custom capabilities. Due to this awful delay, when I pull up the device in the mobile app and don’t see what I expect, I never know if I screwed something up or if the capability is just cached. The workaround of having to just create a new capability every time I need to change something is just an awful experience.

3 Likes