Custom Capability and CLI Developer Preview

I have another question: When a new CLI release comes out, do I need to run all my scripts through the CLI again or will broken connections (like commands) just start working? What is the update process? thanks.

2 Likes

@erickv @jody.albritton, I know things must be hectic with the looming deadline of October 14, but any word/ETA on when switches are to work? With 2 weeks until the old app is killed, and it has been well over a month that switches have been broken for custom capabilities, many of us are struggling to get devices to work properly with the new app.

6 Likes

2 posts were merged into an existing topic: Get ready to make the switch!

A post was merged into an existing topic: Get ready to make the switch!

thanks. I am following the instructions to create a simple button for my DTH.
I get tve VID and MNMN returning from the last command and put them in my definition on the groovy file. Then I re-publish the DTH. But nothing happens.

I don’t see the added button.

The json returned from the cli command is :

    cli-win.exe presentation:device-config:create -j -i deviceConfig.json
{
    "type": "dth",
    "iconUrl": null,
    "dashboard": {
        "states": [
            {
                "component": "main",
                "capability": "switch",
                "version": 1,
                "values": [],
                "patch": [],
                "visibleCondition": null
            }
        ],
        "actions": [
            {
                "component": "main",
                "capability": "switch",
                "version": 1,
                "values": [],
                "patch": [],
                "visibleCondition": null
            }
        ]
    },
    "detailView": [
        {
            "component": "main",
            "capability": "switch",
            "version": 1,
            "values": [],
            "patch": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "presenceSensor",
            "version": 1,
            "values": [],
            "patch": [],
            "visibleCondition": null
        },
        {
            "component": "main",
            "capability": "faithboard04631.androidTv",
            "version": 1,
            "values": [],
            "patch": [],
            "visibleCondition": null
        }
    ],
    "automation": {
        "conditions": [
            {
                "component": "main",
                "capability": "switch",
                "version": 1,
                "values": [],
                "patch": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "presenceSensor",
                "version": 1,
                "values": [],
                "patch": [],
                "visibleCondition": null
            }
        ],
        "actions": [
            {
                "component": "main",
                "capability": "switch",
                "version": 1,
                "values": [],
                "patch": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "presenceSensor",
                "version": 1,
                "values": [],
                "patch": [],
                "visibleCondition": null
            },
            {
                "component": "main",
                "capability": "faithboard04631.androidTv",
                "version": 1,
                "values": [],
                "patch": [],
                "visibleCondition": null
            }
        ]
    },
    "presentationId": "99b7ec65-c4e8-3ea8-9807-af89de784b15",
    "manufacturerName": "SmartThingsCommunity",
    "vid": "99b7ec65-c4e8-3ea8-9807-af89de784b15",
    "mnmn": "SmartThingsCommunity"
}

what may be the problem ?

Most likely, your problem is a cache issue with ST. You can try some tricks or just wait about 12 hours or so and potentially, it could appear. If you don’t want to wait, you can try deleting and creating a new device handler, or renaming the device, or just change your device to use a different DTH temporarily and then change it back. Sometimes one or more of these work but no guarantees.

1 Like

ok, I can try these suggestions.
But I don’t like leaving unused definitions anywhere.
How can I delete the capability and presentation and device-config that I’ve already created ?

thanks.

cli-win capabilities:delete <name> <version>

Sorry, no, don’t delete any of those things. Just copy all the text from your DTH, delete it, and then re-create it. I actually should have listed that option last. First try renaming the device which is the simplest option. Then try changing the DTH the device uses. Edit the device, and change the type to something else temporarily and then then change it back to the DTH you created. If neither of those work, you can try deleting and recreating the DTH but you are still using the capability, presentation, and VID you already created. Hope I’m making some sense.

1 Like

ok. my device is based on a presence sensor.
but it has a power button because it also has “switch” capability added.
now I did as you suggested and changed the type to “presense sensor”
the power button disappeared (normally)
then I changed back to my own DTH.
“power” button came back, but my specific capability did not show.

Should I add something to the “tiles” section to show the button for my capability ?
I guess no because “tiles” is not used by new ST app.
am I correct ?

@RBoy, thanks , and how can I delete the “presentation” and “device-config” ?

adding the content of the DTH with a new name solved the issue.
Now I can see the “state” button that I’ve added to my custom capability.
But how can I show the state of the device in this button ?
I mean how shall I bind my device state to the button that I defined here :

{
    "dashboard": {
        "states": [
            {
                "label": "{{currentState.value}}"
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "Current State",
            "displayType": "toggleSwitch",
			"toggleSwitch": {
				"command": {
					"name": "setCurrentState",
					"on": "on",
					"off": "off"
				},
				"state": {
					"value": "currentState.value",
					"on": "on",
					"off": "off",
					"label": "State",
				}
			}
        }
    ],
    "id": "faithboard04631.androidTv",
    "version": 1
}

also how can I add new buttons to my custom capability ?
and bind these buttons to commands that already exist in my DTH ?

The presentation is automatically discarded (AFAIK) when you delete the capability, you can also update a presentation if you don’t want to delete the capability.
There’s no way to delete the config right now, unfortunately that is a hash of all the stuff in the file at this time. If nothing in the config changes then you’ll get the same VID the background updates to the config (e.g. presentation changes) are published every 12 hours in theory. The only way to get a new VID is to change the config

"label": "{{currentState.value}}", in the toggle switch state instead of "label": "State",.

1 Like

ok. so I have to change my json file and regenerate ?
but then how shall I update “currentState.value” of my custom capability in the code ?
how shall I address it ?
and how shall I bind this button to a command in my DTH ?

Switches? We don’t need no stinking switches80189991

1 Like

I am really lost and I can’T find documentation on this.
Please help…

Please read the top post

I’ve read it and I am following the instructions there.
However, it does not answer my questions:
ow shall I update “currentState.value” of my custom capability in the code ?
how shall I address it ?
and how shall I bind this button to a command in my DTH ?

maybe I am not able to see, where does the first post explain how to use the added presentation within the DTH code ?
I want to start a function when the button is clicked and I want to set the value of “currentState.value” within the code at some point.