Custom Capability and CLI Developer Preview

thanks.
I got it. I had to use the Dryer type, as in the icon image it seemed close to a Coffee Machine.
So I used the following value pair in the device definition:
ocfDeviceType: "oic.d.dryer", deviceTypeId: "Dryer"

But before that, I tried “Water heater” with these values:
ocfDeviceType: "x.com.st.d.waterheater", deviceTypeId: "Water heater"

that one didn’t work.

is it possible to use any custom icons btw ?

I didn’t understand that.
I don’t know how how to edit a capability that already exists.
In fact, I didn’t understand what you mean by that. I only have the capabilities that I created for this device. Since I created them all , they are all in same condition.

and what do you mean by :
“creation of a new capability presentation is not available yet.”

isn’t this what I am trying to do ?

The feature to use custom icons is not available yet. Our team is working to support this in a future release, however, there’s no ETA that we can share at this point.

Sorry for the confusion. What I meant is that you can use a capability that is not included in another device but has its presentation already created with smartthings capabilities:presentation:create because this function is being fixed by the engineering department.
These commands are used to update the definition and presentation of the capability

smartthings capabilities:update capabilityID 1 -j -i capabilityDef.son 
smartthings capabilities:presentation:update capabilityID 1 -i capabilityPres.son

any update on the roadmap? if your managers are keeping you from sharing it just blink twice :wink:

2 Likes

Hi, are you looking into my presentation issue that I reported few days ago?

Regards.

I see that in the capability presentation, you included the units but in your capability definition, you didn’t add the property. I am using the following capability configuration and it is shown correctly.

//Capability definition
{
    "name": "volume",
    "attributes": {
        "capNumber": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "dB"
                        ],
                        "default": "dB"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setCapNumber",
            "enumCommands": []
        }
    },
    "commands": {
        "setCapNumber": {
            "name": "setCapNumber",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 50
                    }
                }
            ]
        }
    }
}
//Capability presentation
{
    "dashboard": {
        "states": [
            {
                "label": "test {{capNumber.value}}"
            }
        ]
    },
    "detailView": [
        {
            "label": "Current",
            "displayType": "slider",
            "slider": {
                "range": [
                    0,
                    50
                ],
                "step": 1,
                "unit": "capNumber.unit",
                "command": "setCapNumber",
                "argumentType": "integer",
                "value": "capNumber.value",
                "valueType": "integer"
            }
        }
    ]
}

Have you verified the presentation used by your device? Get the devices list and make sure that the presentationId property is correct.
If you still have issues, please share a picture to see how it’s displayed.

ok. but which capability can I use for this purpose ?
I mean , I only created 3 capabilities and all of them for this device.
So if my current capability has this issue and I need to use a new capability, then I have no choices.
Am I wrong ?

Your faithboard04631.coffeemachine capability only shows the last order sent to the coffee machine, so, you could replace its configuration and let the list capability send the command and show the last option selected.
You could add it back in the future if you want. This way you will be able to keep controlling the device.

Hi @nayelyz,

I try again, it can show in detail view, but its tile is not like yours. The dashboard views is still broken. I found that it does not change to new presentation immediately, is this cache issue?

Here is my DTH definition, I use my namespace because I use the custom color temperature capability.

definition (name: "colorTemperature", namespace: "tigerpanel18153", author: "Ray", mnmn: "SmartThingsCommunity", vid: "0a72a17d-39e4-3ae2-8f7b-b17b05742a6e") {
    capability "tigerpanel18153.colorTemperature"
}

By the way, the slider of display type could be controlled like following picture, how could I do if I only want the tile like battery tile that only show information and non-controlled?

Up until recently, there was an issue where the capability presentations were baked into the device presentations, which meant you needed to update the device presentations every time the capability presentations were changed, and were stymied if your device config was already correct as you had nothing left to force that change.

A week or so ago (I’ve lost track of time), a ‘fix’ for this problem rolled out. I found that it now meant that I had absolutely no control over the capability presentation at all. When I changed it, it would eventually be picked up by the app in any devices that were using it (probably on a twelve hour cache) and there was now nothing I could do to break that cache. If I screwed up, tough, I had to wait all day or overnight to test my changes. It also didn’t matter what the device presentation said was to be displayed for the capability, it was bypassed.

I understood the mechanism previously. Obviously it was broken but you could work with it in the mean time by using disposable device handlers to develop capabilities in isolation and only installing them in your real devices once they were ready. You’d just be hosed if you wanted to change the way the capabilities were presented.

After the changes I could change the capability presentation and there was nothing I could do to prevent them being used (unless version numbers are actually enforced now) and I had to wait up to half a day to discover if I’d cocked up, during which time other users of my capability might already be seeing my mistakes. So now the development process involves working with dummy capability names until they are ready and waiting half a day to test instead of a minute.

I don’t know if any of that equates with what you are now seeing and I’ve no idea what the current mechanism is supposed to be any more. Last time I checked development was now impractical.

1 Like

so, should I add the “listElement” attribute and “setListElement” command to the first capability with only “lastorder” attibute ?
and then add both display types to the same capability ?
“displayType”: “list”
“displayType”: “state”

is this supported now ? because I was told that 2 display items in one capability is not supported yet.

my final presentation would be :

{
    "dashboard": {
        "states": [
            {
                "label": "{{lastorder.value}}"
            }
        ],
        "actions": [],
        "basicPlus": []
    },
"detailView": [
        {
            "label": "Last Order",
            "displayType": "state",
			"state": {
								"label": "last ordered : {{lastorder.value}}"
			}
        },
        {
            "label": "Order Item",
            "displayType": "list",
            "list": {
                "state": {
                    "value": "listElement.value",
                    "alternatives": [
                        {
                            "key": "espresso",
                            "value": "Espresso"
                        },
                        {
                            "key": "capuccino",
                            "value": "Capuccino"
                        },
                        {
                            "key": "capuccinomix",
                            "value": "CapuccinoMix"
                        },
                        {
                            "key": "americano",
                            "value": "Americano"
                        }
                    ]
                },
                "command": {
                    "name": "setListElement",
                    "alternatives": [
                        {
                            "key": "espresso",
                            "value": "Espresso"
                        },
                        {
                            "key": "capuccinomix",
                            "value": "CapuccinoMix"
                        },
                        {
                            "key": "capuccino",
                            "value": "Capuccino"
                        },
                        {
                            "key": "americano",
                            "value": "Americano"
                        }
                    ]
                }
            }
        }
    ],
	    "id": "faithboard04631.coffeemachine",
    "version": 1
}

I just tried this now and this time, only one of the display items were displayed.
So I need to use 2 capabilities to show both ?
then what is the solution to display both and get rid of the “network error” ?

I see that you included the units in the presentation, but you haven’t set it in the capability’s definition yet.
Here’s how I modified it, this way both Views are ok:

{
    "name": "Color Temperature",
    "attributes": {
        "colorTemperature": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer",
                        "minimum": 2200,
                        "maximum": 7000
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "K"
                        ],
                        "default": "K"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setColorTemperature",
            "enumCommands": []
        }
    },
    "commands": {
        "setColorTemperature": {
            "name": "setColorTemperature",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "integer",
                        "minimum": 2200,
                        "maximum": 7000
                    }
                }
            ]
        }
    }
}

The state display type can help you to show only the value, configuration should be:

"detailView": [
    {
        "label": "Color Temperature",
        "displayType": "state",
        "state": {
            "label": "colorTemperature.value",
            "unit": "colorTemperature.unit"
        }
    }
]

Is there a way to change the range for builtin capabilities (and their respective controls)?

This is what i tried with the config file:

   {
    "component": "main",
    "capability": "thermostatHeatingSetpoint",
    "version": 1,
		"values": [
			{
				"key": "setpoint",
				"range": [
					15,
					75
				],
				"step": 1
			}
		],
    "patch": [],
    "visibleCondition": null
}

doesn’t seem to deliver the desired results.

Unfortunately when i check the presentations it still gives me:

    "capability": "thermostatHeatingSetpoint",
    "version": 1,
    "label": "___PO_CODE_SMARTTHINGS_DREAM_SAC_TMBODY_HEATING_TEMPERATURE",
    "displayType": "slider",
    "toggleSwitch": null,
    "standbyPowerSwitch": null,
    "switch": null,
    "slider": {
        "range": [
            0,
            40
        ],
        "step": null,
        "unit": "heatingSetpoint.unit",
        "command": "setHeatingSetpoint",
        "argumentType": "number",
        "value": "heatingSetpoint.value",
        "valueType": "number"
    }

So, can you provide any help on this?

It would be appreciated.

Please I need to learn how to solve this issue.

No, multiple attributes are not supported yet. The change I’m talking about is to replace the entire configuration from the faithboard04631.coffeemachine capability with the list capability configuration. So this one will have the same as faithboard04631.coffeemachineselect just be careful when you update it, don’t leave anything out of place like the wrong capability ID or structure.

I just saw in your presentation that you used the wrong attribute. If I use your capability in my device handler, I cannot create the presentation because of that.
You’ll have to update it with the correct values, like this:

"states": [
            {
                "label": "{{zoneSetpoint.value}} {{zoneSetpoint.unit}}"
            }
        ]

Use the command smartthings capabilities:presentation:update capabilityID 1 -i newCapabilityPres.json
Remember that you have to regenerate the presentation.

For “key”, you should use the attribute value. This is what I included in the device presentation:

{
    "component": "main",
    "capability": "thermostatHeatingSetpoint",
    "version": 1,
    "values": [
        {
            "key": "heatingSetpoint.value",
            "range": [
                15,
                75
            ],
            "step": 1
        }
    ],
    "patch": [],
    "visibleCondition": null
}

Then the range changes correctly in the presentation and the device.

"capability": "thermostatHeatingSetpoint",
"version": 1,
"label": "___PO_CODE_SMARTTHINGS_DREAM_SAC_TMBODY_HEATING_TEMPERATURE",
"displayType": "slider",
"toggleSwitch": null,
"standbyPowerSwitch": null,
"switch": null,
"slider": {
    "range": [
        15,
        75
    ],
    "step": 1,
    "unit": "heatingSetpoint.unit",
    "command": "setHeatingSetpoint",
    "argumentType": "number",
    "value": "heatingSetpoint.value",
    "valueType": "number"
}

Is anyone else suddenly having issues getting new vids to display?

I released 9 new handlers over the weekend that all had custom device configs with custom capabilities and I didn’t have any issues, but I’ve just spent about 2 hours fighting with a single handler and I still can’t get the damn thing to display anything except button and battery…

The 100% reliable method for forcing a new vid to display used to be creating a new handler with a name you’ve never used before and then creating a new virtual device with the new handler, but now nothing works…