Custom Capability and CLI Developer Preview

Hi, @mikedill24

In the meantime we take a look at this, I recommend you to create a personal access token and use it with the --token flag, e.g.:

$ smartthings devices --token <personal_access_token>

Or you can configure it as expressed here.

2 Likes

Hi @erickv

Thanks for the quick reply. That has me up and running.

1 Like

I can’t get my custom capability to work. Not sure if I’m missing something (most likely) or if it’s a bug or a combination.

A couple of points/questions:

  1. I can’t get anything to show up in Live Logging. I read somewhere this was previously reported. Is this still an outstanding issue? Or, is there a workaround or specific manner to get logs to show up? This would help in troubleshooting.
  2. detailView is not actionable. Meaning, the button does not actuate. The tile renders but it’s read-only. I read this was an issue at the detail level. Is this still outstanding?

I followed the tutorial and have everything in place, I believe. I have my capability created and created a DTH. Since detailView is not working I’ve added the command at the Dashboard level to test this out.

The button on the Dashboard is actionable, I can press it, it just not do anything.

I’m simply trying to call a URL when I push a button. I’ll get more advanced once I get this working but for now it’s a simple URL call.

This is what I have for capability:

{
    "id": "XXXXX.launchUrl",
    "version": 1,
    "status": "proposed",
    "name": "Launch URL",
    "attributes": {
        "url": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "string"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setURL",
            "enumCommands": []
        }
    },
    "commands": {
        "setURL": {
            "name": "setURL",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "string"
                    }
                }
            ]
        }
    }
}

Should the status be “proposed”? I’ve seen many posts where it’s in this status but I’ve also seen other posts where the status is “live”.

This is what I have for capability presentation:

{
    "dashboard": {
        "states": [
            {
                "label": "URL Controller"
            }
        ],
        "actions": [
            {
                "displayType": "pushButton",
                "pushButton": {
                    "command": "setURL",
                    "argument": "url.value"
                }
            }
        ],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "Call URL",
            "displayType": "pushButton",
            "pushButton": {
                "command": "setURL",
                "argument": "url.value"
            }
        }
    ],
    "automation": {
        "conditions": [
            {
                "label": "Call URL",
                "displayType": "textField",
                "textField": {
                    "value": "url.value"
                },
                "emphasis": false
            }
        ],
        "actions": [
            {
                "label": "Call URL",
                "displayType": "textField",
                "textField": {
                    "command": "setURL"
                }
            }
        ]
    },
    "id": "XXXX.launchUrl",
    "version": 1
}

In the arguments I’ve tried url.value as well as setURL.value.

This is what I have in the DTH (the structure and almost all content is from an example in this post):

metadata {
    definition (name: "URL Call-New App", namespace: "Dizzle", author: "Mike Dill", mnmn: "SmartThingsCommunity", vid: "XXXXXXXXXXX") {
        capability "XXXXX.launchUrl"
}
}

//**
def parse(String description) {
	log.trace "parse($description)"
}

// *** [ Initialization Methods ] *********************************************
def refresh() {
	log.trace "Executing 'refresh'"
	initialize()
}
def installed() {
	log.trace "Executing 'installed'"
	initialize()
}

def updated() {
	log.trace "Executing 'updated'"
	initialize()
}

private initialize() {
	log.trace "Executing 'initialize'"
	sendEvent(name: "url", value: "http://someURL")
}


def setURL(String arg) {
	log.trace "Executing URL: ${arg}"
	sendEvent(name: "url", value: "http://someURL")
}

Hello.
Any updates with capability presentation caching issue?

2 Likes

Also wondering this. Everything is a mess for me after the custom capabilities came back. The only good thing is that units is now displayed in the detail view. :stuck_out_tongue_closed_eyes:

1 Like

I made a bunch of junk capabilities last night to try to see which display types are/aren’t working. I only tested a couple in the dashboard, but got everything except stepper (which seems to have bigger issues) to show in detailView. Live logging is really acting up, but I think below is accurate. I didn’t get into alternatives or anything else too crazy - just seeing if they’d render, display data, and trigger a command.

  • list: Displays and triggers command in detailView. It seems like the issue with key and value being swapped has been resolved.
  • numberField: Displays and triggers command in detailView.
  • playPause: Didn’t test.
  • playStop: Didn’t test.
  • pushButton: Displays and triggers command on dashboard. Displays in detailView but does not trigger command.
  • slider: Displays and triggers command in detailView.
  • standbyPowerSwitch: Displays in detailView but does not trigger command.
  • state: Displays on dashboard and detailView.
  • stepper: Displays and triggers command in detailView. Documentation shows command in the wrong format - should be “command”: { “name”: “function”},
  • switch: Displays in detailView but does not trigger command. Rendered as a sliding toggle in detailView, which I think should be the toggleSwitch based on the docs.
  • textField: Displays in detailView but does not trigger command.
  • toggleSwitch: Displays and triggers command on dashboard. Displays in detailView but does not trigger command. The docs say this should be a sliding toggle, but it rendered as a pushButton on the dashboard and an on/off switch in detailView.
4 Likes

Also doesn’t trigger commands in detailView
and the presentation isn’t updated (it remains cached)

There are many other issues (like static and dynamic values aren’t being restricted as per the configuration JSON) which have been reported but these (@philh30) are the critical one to get started.

1 Like

My experience is that when you pick something from the list, it immediately displays the alternative that was picked. When you then change it via sendEvent, it shows exactly what you sent, not invoking the alternative. We might be saying the same thing.

I had the same issue as @orangebucket with state alternatives. When using one on the dashboard, it was consistently stuck on the initial setting. I’ve abandoned alternatives for now except on the action side of list.

I’ve seen that with toggleSwitch, but haven’t tested switch on the dashboard yet. Dashboard activates, and the text updates in both dashboard and detailView, but the icon on detailView never changes to reflect the new state.

1 Like

I’m trying to view the JSON for some of the stock VIDs not in the community mnmn. How can these be queried? For example, the following does not work and results in a not found error:

smartthings presentation generic-arrival SmartThings -j

odd… On the other hand, I just tested:
smartthings presentation generic-dimmer-power SmartThings

… and that does work. Is there a listing of the confirmed stock VIDs somewhere?

I think it may depend on which docs. According to at least one part of the REST API a ‘switch’ is a sliding switch and so is rendered correctly. The description is the same as for ‘standbyPowerSwitch’.

I first expected to see a two position sliding switch but the docs say a ‘button style switch element’ and that does make sense for certain interpretations of ‘toggle’ where the states of the attribute don’t really represent active and inactive, such as what we in the UK call a two-way switch.

I must revisit state as I’ve been getting blanks when I’ve tried it on new capabilities lately.

I had the Nodon Wall Switch DTH working in the previous version, and though I would get it “upgraded”. I would like it to be able to do work like the IKEA 5-button puck. Assigning a push action on the button details itself. But I have a hard time digging through the capabilities and understanding the new stuff.

Anyone have any pointers on what I need to add to make the DTH act similar to the IKEA puck? Right now you can’t really see much in the device, but I can of course still use the buttons in WebCore.

I took a quick look at a Nodon DTH. Is it something like a four button device with pressed/held on each, using the old buttonNumber in the event data fudge to differentiate between the buttons?

If so capabilities aren’t really an issue.
It just needs to be rewritten as a composite device with a child device for each button. It’ll probably still be able to use the button number for backward compatibility. The IKEA Button handler would be excellent for providing the basic structure.

1 Like

I am about ready to give up. I think I am starting to understand the flow of everything. I created the capability, then presentation, then generic device-config, and then specific. I have tried with multiple attributes and single attributes. I have tried with ‘stepper’ and with ‘slider’ display types. Nothing ever shows up in the new app except 'status: connected". I just don’t understand what I might be doing wrong. I have followed the process at the beginning of this thread with no errors reported. So far I don’t seem to be able to generate a device-config that actually displays anything. arghh.

I can make things show up in the new app using standard capabilities and not using the CLI at all.

Any further suggestions?

1 Like

Hello @mikedill24,

The issue with the pushbutton display type has been documented and reported. In this case, the lack of logs when trying to interact with it is because no commands are being generated. Our team continues working to have it fixed as soon as possible.

2 Likes

Hello guys.
I made a new presentation based on this example.

The problem is that in dashboard, I don’t see anything to be appeared on the device icon and in detailview I get only the value displayed.
Is something to do with caching issue? I’m on iOS

Also , why these are two statements of

attr.unit

both specified on “label” and “unit” on detailview?
Thanks

I note that the dashboard tile state is now working with alternative text. I shall do a small happy dance while getting a belated breakfast.

3 Likes

Any ETA on when switch and toggleSwitch commands will start working in detailView?

3 Likes

On the latest vids I have created, the ordrer of the capabilites are actually reflected back in the mobile app. Anyone else seeing this or was it just some lucky coincidence? :stuck_out_tongue_closed_eyes:

This is a great summary. Will you keep it updated as people give some report ?
In my case, I am having problem with textField just like as you mentioned and with usage of multiple attributes in a single capability. It just shows up the first attribute.