Custom Capability and CLI Developer Preview

On that note, I understand that there are things to be fixed and features to added. However given that we are now releasing DTH’s into production based on the current documentation, I hope that the documentation (expected behavior) does not change in future as that could create a problem with the released DTH’s. I have over 60 DTH’s here to work through and I hope we don’t have to rework them in future :slight_smile: (hopefully the DTH’s work as currently documented once the bugs are fixed)
Another example is supportedValues and visibleConditions, almost all DTH’s we have released have this built into their configuration files. While it doesn’t work now (yes, I’ve submitted tickets for them), I’m hoping it will start working as documented and then the controls and values will start appearing/hiding when they’ve fixed.

Actually I need a “button” to send a single command. (not on/off)
what display type should I use for this purpose ?
and is there a list of all available display types ?
I can’T find a documentation page for “display types”

@jody.albritton @nayelyz @morgan.bridges @guxdude
I would like to think I’ve done everything correctly, however when I create the device it doesn’t show any of my custom capabilities in the app. I have uploaded the device config, put in the vid and mnmn, changed my namespace, and even initialized the capabilities with a send event for each of them to set a default value.

You can see my deviceconfig, each capability’s json, and the groovy code here at my GitHub:

Thanks to everyone who has helped me so far.

did you change the device name or assigned DTH to trigger a UI refresh?

Yes and I’ve deleted and made it again too

1 Like

Looking at your GitHub, your Always Finish capability looks like it defines the wrong attribute name.

Your DTH says "mnmn": and "vid": when it should be mnmn: and vid:. That might perhaps be significant.

1 Like

@orangebucket
I knew I was missing something. Thanks!
Maybe next time I won’t do this late at night.

I’ve fixed alwaysFinish and tried to upload the json again to create the presentation but I get this error.
I have the json set to version 2 and tried version 2 in the command but it doesn’t work.

Is it possible to update a capability or do I have to start from scratch and make a new one with a new name?
@jody.albritton @nayelyz @morgan.bridges

is there anything wrong with the following presentation ?
I only see a “current state” empty space on detail view.

{
    "dashboard": {
        "states": [
            {
                "label": "{{state.value}}"
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "Current State",
            "displayType": "pushButton",
			"pushButton": {
							"command": "setActive",
							"state": {
								"value": "state.value",
								"on": "on",
								"off": "off",
								"on?": "on?",
								"off?": "off?",
								"turningOn": "turningOn",
								"turningOff": "turningOff",
								"label": "{{state.value}}",
							}
			}
        },
        {
            "label": "Last Order",
            "displayType": "state",
			"state": {
							"state": {
								"value": "lastorder.value",
								"label": "{{lastorder.value}}",
							}
			}
        }
    ],
    "id": "faithboard04631.coffeemachine",
    "version": 1
}

All I’m getting is this:

It’s just doing . . . . . .how long does the command take to generate the json file?
Or do I need to first load a basic json file first?
This whole process has been made confusing :confused: Do I need the CLI?

finished but failed: How do I fix this?


What other alternatives are there to update DTH?

A ‘pushButton’ display type doesn’t have any state. It is just the command and an argument.

I’ve lost track of the current state of play with multiple attributes and/or display types per capability.

You can see the format of the display types in the API documentation.

I had this problem in the beginning. The documentation is not clear. You need to create a folder and then it will work fine. See this post:

ok. but I also have a “state” display type in the presentatin. why don’t I see the state ?
also I don’T see any pushbutton .
what is wrong in my presentation ?
I tried removing the pushbutton, but I still did not see the “state” display type.

Has anyone had a problem displaying whole numbers in the state displayType in detailView? It does not seem to matter if the field in the capability is a string or integer. Oddly, results display as expected in History.

For example,
“bosco” displays as bosco
“10.0” displays as 10.0
“10” displays as 12:00 AM

With some trial and error, whole numbers 13-31 display as Invalid Date, until I refresh, at which point they display as the correct number. Whole numbers 0-12 and >31 (up to around 200000) display 12:00 AM. Obviously, it seems to be expecting a date, although I have no idea why. Adding a decimal seems to force the number to display as expected.

Here’s my capability:

{
    "id": "titlewonder37618.saltStatus",
    "version": 1,
    "status": "proposed",
    "name": "Salt Status",
    "attributes": {
        "saltStatus": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer"
                    },
                    "unit": {
                        "type": "string",
                        "default": "ppm"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setSaltStatus",
            "enumCommands": []
        }
    },
    "commands": {
        "setSaltStatus": {
            "name": "setSaltStatus",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "integer"
                    }
                }
            ]
        }
    }
}

And the associated presentation:

>{
    "dashboard": {
        "states": [
            {
                "label": "Salt Status: {{saltStatus.value}} ppm"
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "Salt Status",
            "displayType": "state",
            "state": {
                label: "{{saltStatus.value}}",
                unit: "saltStatus.unit"
            }
        }
    ],
    "id": "titlewonder37618.saltStatus",
    "version": 1
}

So, has anyone had any success version updating their capability and uploading a new json for it? I still can’t get it to work. I’d rather not make a new capability with a different name.

Yes, but it takes some time to update. Capability presentation usually updates within a day, but updating the capability takes several days for me before the updates takes affect.

Yes, I have also seen this issue. I gave up that capability because I was just getting confused. So I don’t have any solution for it, just confirming that you are not alone :stuck_out_tongue_closed_eyes:

@cscheiene
That’s not what I mean. I need to upload a revised json because there is a mistake in my original, but I get an error when doing so. I tried to put version 2 in the json file AND the command, that doesn’t work (tried both -2 and 2 in the command)

Obviously if I try to make a new capability with the same name it just says capability already exists. I don’t want to have to change the name of my capability, so how can I fix this? There is no way to delete a capability and start over?

never mind, I found the answer by accident.

You need to do smartthings capabilities:delete xxxx

where xxxx is your capability ID.
this should be better documented, the official documentation says you are supposed to type in the capability ID and version number but when I did this it did not work

And you should use the update command instead of the create command when updating an existing capability or capability presentation

1 Like

that’s good to know, thanks.