# Create device settings from code

**URL:** <https://community.homey.app/t/create-device-settings-from-code/19271>\
**Category:** Developers\
**Created:** [October 14, 2019, 4:24pm UTC](https://community.homey.app/t/create-device-settings-from-code/19271 "2019-10-14T16:24:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaoh](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kaoh/32/9283_2.png) [@Kaoh](https://community.homey.app/u/Kaoh)\
**Post date:** [October 14, 2019, 4:24pm UTC](https://community.homey.app/t/create-device-settings-from-code/19271/1 "2019-10-14T16:24:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gerard\_Ricart](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/gerard_ricart/32/12451_2.png) [@Gerard\_Ricart](https://community.homey.app/u/Gerard_Ricart)\
**Post date:** [December 17, 2019, 6:27am UTC](https://community.homey.app/t/create-device-settings-from-code/19271/2 "2019-12-17T06:27:04Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![Kaoh](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kaoh/32/9283_2.png) [@Kaoh](https://community.homey.app/u/Kaoh)\
**Post date:** [December 22, 2019, 9:55pm UTC](https://community.homey.app/t/create-device-settings-from-code/19271/3 "2019-12-22T21:55:00Z")

</div>

> **[kaohlive/com.newmotion.my](https://github.com/kaohlive/com.newmotion.my/tree/beta/drivers/chargepoint)**
>
> Homey app for interacting with a private chargepoint by newmotion. Only works with private chargepoints that are tied to your my newmotion account. - kaohlive/com.newmotion.my

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.
