When modified custom capabilities are updated on the hub

Hi,

I created a custom capability with single command.
Then I created a driver that prints that capability in device_init callback.
I created device and could see the printed capability. It looked fine.

I then added another command to the capability and used

smarthings capabilities:update

to update it. I validated that the capability is indeed updated in the cloud with

smarthings capabilities -y capability id

However, it seems that the hub contains the old version, the new command is not printed in device init.
I tried

  • to delete the capability and create it again
  • to reboot the hub
  • to delete device, delete the driver then build the new driver and add device
    Nothing works, the hub does not see the new version with two commands.

What can be done to force the hub to retrieve the updated capability?
Thanks

Hi @ygerlovin

My practical experience is delete the capability and create new adding a number behind de name of capability and leave the attributes and commands with the same name and create a new presentation of the capability. In this way in the Driver code you just have to change the profile capability name and declaration of the Custom Capability, the rest is valid

Another way that usually works immediately is to create a vid with the new presentation of capability. This makes the presentation update.

If you have to modify it again, you have to create another different vid, for that you can add capabilities that the device does not have, It will not affect the operation of the vid, it will only show the capabilities that the device have.

I do not understand how they do not fix this for a capability update is a truth update.

@nayelyz say to me that in 24 hours they are automatically updated, but this has never worked for me and I have tried it several times.

But in this case, I think, @ygerlovin is experiencing the error in the “capability definition”. It happened to me a while ago, that I changed the capability’s attribute name and I got an error in the driver that there was no attribute with that name (which I confirmed was correct).
What I did was:

  1. Delete the device and driver completely
  2. Reboot the Hub
  3. After the reboot, create the driver package again with a different name

Please, let me know your results, that should force a complete refresh, but I’ll try to replicate the issue again so I can report it to the team. I thought I did something wrong that caused this error, but now that you’ve also seen it, it is worth investigating.

Hi @nayelyz ,
Thank you for you response.
Unfortunately, this didn’t help

the best workaround is to create second capability and swap them back and forth for tests.

it will create a lot of noise on the ST servers , but there is no better way (or it’s not obvious) to force the update

@veonua
Renaming capability indeed works, but swapping back doesn’t. When I change the capability name to the original one, I get the old version

1 Like

I’ve never had any luck trying to update an existing custom capability. Have always had to create a new one.

2 Likes

I just experienced this as well. I had an object type capability with a list of enums. I wanted to add an additional enum for the next release. I regenerated the custom vid and got it to show up in the UI, but I am still unable to use this new value. I get this error when I try to use it to set the state.

Office thread encountered error: [string "st/dispatcher.lua"]:233: Error encountered while processing event for <Device: XXX (My Device)>:
    arg1: table: 0x2bba790
[string "st/dispatcher.lua"]:233: Error encountered while processing event for <Device: XXX (My Device)>:
    arg1: table: 0x2bba790
[string "st/capabilities/init.lua"]:226: Value myNewValue is invalid for myCapability.myState

@nayelyz Since the UI updated, do you think the capability itself will update as well?

I’ve seen it can take a while, for example, once I made a change in the custom capability definition, and I was able to use the new version the next day; but, I also had my Hub turned off for several hours so I don’t know exactly what triggered the update.
I already reported this issue to the team, I’ll ask them for an update, so, please help me monitor the behavior of your driver.

In this case, are you trying to update a driver in production (used by others)?

1 Like

Yes. The capability is being used by people that have installed the driver.

1 Like

Has there been any update on this?

Is there any way to force the hub to pull down the updated custom capability definition? Or are there any insights into when / how the hub decides to pull in the updated capability definition?