Custom Capability and CLI Developer Preview

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…

@orangebucket had posted couple of days back about a similar issue about no longer being able to force a new vid to display. one additional step i use along with what you did, that sometimes works, is to kill the ST app then starting it again.

It’s good to hear I’m not alone.

Thanks for the suggestion about restarting the app, but I just opened the device on my iPhone which has been off since the weekend and it’s only showing battery and button so the issue I’m running into today isn’t a caching issue on the phone.

Is anyone else concerned that the long awaited update, that’s supposed to fix the issues reported back in August, is going to end up breaking the features that are currently working and we’ll basically be screwed for another couple of months…?

2 Likes

think they might be using server side caching on a per device basis which is why sometimes i will see my phone update but not my tablet till i kill the app on it also.

almost guaranteed. their release pattern suggests they don’t quite do agile so it will be next quarterly release before the broken things work and the working things break. :wink:

2 Likes

For some things maybe, but my iPhone has been off for 4+ days and the vids I’ve been fighting with were created today so if it was any type of device related caching issue the iPhone should have seen the latest version as soon as I turned i on…

Hopefully the update after that will be stable, but by that time they’ll probably be close to retiring the IDE and we’ll have to start all over again anyways…