# How to create a custom string + image capability

**URL:** <https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733>\
**Category:** Questions & Help\
**Tags:** app, homey-pro\
**Created:** [August 22, 2023, 5:18pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733 "2023-08-22T17:18:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Klevebrand](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/max_klevebrand/32/84788_2.png) [@Max\_Klevebrand](https://community.homey.app/u/Max_Klevebrand)\
**Post date:** [August 22, 2023, 5:18pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733/1 "2023-08-22T17:18:16Z")

</div>

Hi!

I am making an app to my Homey but I am struggling to add a custom capability.

I just want to add a custom capability that is a string and simply an icon that looks almost like the default ones for measure\_power.

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/b/ebf1d3212bc29c814f8ba31aa8ebb96cefd755d9.png)

How can I do that?

Thanks in advance!  
Best regards Max

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [August 22, 2023, 5:27pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733/2 "2023-08-22T17:27:57Z")

</div>

> [@Max\_Klevebrand](#):
>
> How can I do that?

> **[Capabilities](https://apps.developer.homey.app/the-basics/devices/capabilities#custom-capabilities)**
>
> A capability is a programmatic representation of a device's state.

---

<div class="post-metadata">

**Author:** ![Max\_Klevebrand](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/max_klevebrand/32/84788_2.png) [@Max\_Klevebrand](https://community.homey.app/u/Max_Klevebrand)\
**Post date:** [August 24, 2023, 4:38pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733/3 "2023-08-24T16:38:49Z")

</div>

I cannot figure out which “uiComponent” should be used for the capability to be displayed in frontend. Its just a string, which one can I use?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 24, 2023, 5:00pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733/4 "2023-08-24T17:00:51Z")

</div>

Just so simple

```auto
{ 
     "type": "string", 
     "title": { 
         "en": "Value", 
         "de": "Wert", 
         "nl": "Waarde" 
     }, 
     "getable": true, 
     "setable": false, 
     "insights": true, 
     "icon": "/assets/capability_icons/measure_generic.svg" 
 }

```

This is shown in sensor view.

---

<div class="post-metadata">

**Author:** ![Max\_Klevebrand](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/max_klevebrand/32/84788_2.png) [@Max\_Klevebrand](https://community.homey.app/u/Max_Klevebrand)\
**Post date:** [August 24, 2023, 5:05pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733/5 "2023-08-24T17:05:08Z")

</div>

I have this in .homeycompose/capabilities/real\_time\_solar.json

```auto
{
    "type": "string",
    "title": { 
        "en": "Solar grid now generating"
     },
    "getable": true,
    "setable": false,
    "uiComponent": "toggle",
    "uiQuickAction": false,
    "icon": "/assets/solar-panel.svg"
  }

```

And in my driver-compose.json:

```auto
"capabilities": [
    "measure_battery",
    "button",
    "meter_power",
    "measure_power",
    "real_time_solar"
  ],

```

But I cannot see it in the frontend app when its ran on the Homey?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 24, 2023, 5:06pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733/6 "2023-08-24T17:06:58Z")

</div>

toggle can only be used for boolean capabilities.  
If you just want to show the value, display it as sensor.

---

<div class="post-metadata">

**Author:** ![Max\_Klevebrand](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/max_klevebrand/32/84788_2.png) [@Max\_Klevebrand](https://community.homey.app/u/Max_Klevebrand)\
**Post date:** [August 24, 2023, 5:10pm UTC](https://community.homey.app/t/how-to-create-a-custom-string-image-capability/87733/7 "2023-08-24T17:10:06Z")

</div>

Now I see, I had to “remove” the device and add it again for it to show up. Otherwise nothing changed when editing the driver-compose. Thanks for the help!
