Homey Community Forum

Create device settings from code

I am trying to create a device setting of the dropdown type and I want my Values collection to be dynamic. In this case I want the user to select from a list of charge cards from their account in my new motion app. I can find and get the setting working if I add it to the driver section of my app.json. But how to add the values based on the app data?

I am already using the device.capabilities collection to push new capability to the device from code. But I have failed to get success with doing this with settings. I had some results through device.driver.setting path but mostly in crashing the app (suggesting that at least it had effect).

So I hope someone is doing just that and can show me code that works.

@Kaoh I’m also trying the same…

Can U share with me code to adding a “dynamic” capability? How do you do to push enum option to this capability?

Have you done any progress on settings way?

Thanks in advance!

Here in the chargepoint.js file its the method module.exports.buildDevice
There is dynamically add several capabilities

So those calls basically update the object that is created by the app.json.
I have tried to add elements to the settings object like this also, but most of those attempts failed. Adding enum options are also something that seem to be impossible.