Homey Community Forum

When is custom capabilities added?

Hi all

I’m currently struggling with understanding when new device capabilities are added to existing code.

I’ve extended my code to include 2 new capabilities and they’re listed during the debug process when running my app.
However even though I’ve deleted and created a new device based on my app, I still only see the old capabilities (and even one of those, are with a temporary name, that I gave it in the beginning of the development). That has also been renamed.

So my question is probably more in the direction on, how do I make certain that my device gets the latest changes to capabilities?

Hope someone can give som insight :smiley: because no matter how much I clean, delete and add as new, I keep getting a device using the old capabilities and their names.

If you add a new device it should get the new capabilities.
If you are using homey compose make sure you are adding them to the correct place and if they are device specific the ensure the filter is set correctly (done automatically if you add then to the drivers folder).
Maybe you could share your code so we can see where it might be going wrong.

Hi,
new capabilities are not added to existing devices automatically.
You should check in your device.js (in onInit()) if the new capabilities are present and add them if not.

// Add new capabilities (if not already added)
if (!this.hasCapability(‘alarm_warnings’))
{
await this.addCapability(‘alarm_warnings’);
}

Edit:
Perhaps I misunderstood.
If you deleted and re-added the device, it should get all capabilities.
Please check like Adrian mentioned, if the capabilities are defined in the correct place. Perhaps they got overwritten in app.json if you didn’t change the file im /.homeycompose.

Thanks guys. You brought me onto the right track :slight_smile: Things are working now. Seems to have been a combination of a cached file and a mistake from my side with the name of a capability added as a title instead of a filename :slight_smile:

Cheers.