How to create a custom string + image capability

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

How can I do that?

Thanks in advance!
Best regards Max

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?

Just so simple

{ 
     "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.

I have this in .homeycompose/capabilities/real_time_solar.json

{
    "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:

"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?

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

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!

1 Like