# Setting capability value for enums

**URL:** <https://community.homey.app/t/setting-capability-value-for-enums/56779>\
**Category:** Developers\
**Created:** [December 17, 2021, 11:51pm UTC](https://community.homey.app/t/setting-capability-value-for-enums/56779 "2021-12-17T23:51:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![azzlack](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@azzlack](https://community.homey.app/u/azzlack)\
**Post date:** [December 17, 2021, 11:51pm UTC](https://community.homey.app/t/setting-capability-value-for-enums/56779/1 "2021-12-17T23:51:35Z")

</div>

I’m trying to set a capability value for a custom enum capability in my app, but I get a `Error: invalid_capability at Remote Process` error every time.  
Is there a specific way to do this for enums?

climate\_mode.json

```json
{
  "type": "enum",
  "uiComponent": "picker",
  "title": {
    "en": "Climate Control Mode"
  },
  "values": [
    {
      "id": "1",
      "title": {
        "en": "Away"
      }
    },
    {
      "id": "2",
      "title": {
        "en": "Home"
      }
    },
    {
      "id": "3",
      "title": {
        "en": "Boost"
      }
    },
    {
      "id": "4",
      "title": {
        "en": "Travel"
      }
    },
    {
      "id": "5",
      "title": {
        "en": "Off"
      }
    },
    {
      "id": "6",
      "title": {
        "en": "Fireplace"
      }
    }
  ],
  "getable": true,
  "setable": true,
  "insights": false
}

```

This is how I try to set it in device.ts:

```auto
this.setCapabilityValue('climate_mode', '1');

```

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [December 18, 2021, 8:22am UTC](https://community.homey.app/t/setting-capability-value-for-enums/56779/2 "2021-12-18T08:22:27Z")

</div>

Is the capability defined in the driver (app.json)?  
And if it was added after inclusion, did you either add the addCapability function (with appropriate checks) or reinclude the device?

Your way if changing the value is the correct way.

---

<div class="post-metadata">

**Author:** ![azzlack](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@azzlack](https://community.homey.app/u/azzlack)\
**Post date:** [December 18, 2021, 9:09am UTC](https://community.homey.app/t/setting-capability-value-for-enums/56779/3 "2021-12-18T09:09:13Z")

</div>

@Caseda Thanks for the help, it started working after I re-added the device. So I basically need to have some sort of migration if I add capabilities after inclusion?

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [December 18, 2021, 11:16am UTC](https://community.homey.app/t/setting-capability-value-for-enums/56779/4 "2021-12-18T11:16:57Z")

</div>

correct, it is explained here:

> **[Breaking changes](https://apps.developer.homey.app/guides/how-to-breaking-changes#adding-capabilities)**
>
> This guide gives hints and guidance in the case that you need to make a change to your app that might break functionality for current users.
