Custom Capability and CLI Developer Preview

Thanks @RBoy, I literally just found that documentation. I also added --token=xxx to the ends of the commands and that worked too.

Gentle Reminder:

If you come across any kind documentation issues or bugs that you cannot get an answer for here in the community, please send an email to build@smartthings.com so that we can get tickets started.

2 Likes

I have come to find out that custom capabilities still do not support automations yet. If I use standard capabilities then they show up in the automations.

@nayelyz any clue as to when we can expect them to work in the new app?

1 Like

I have managed to convert one of my custom devices (RTI audio system) to work nicely in the new app (YEAH!).
I’ve noticed that the icons in the dashboard can be greyed out when off with some devices, and some even animated when on (i.e. Sonos is playing). Is there a way of controlling this from my devices? It seems that regardless of my switch in the off or on position, the dashboard icon is always in colour.

Also, is there any official list of icons that we can set for the dashboard?

1 Like

Thanks. I didn’t know that.

Just sent philh30’s known issues list.

1 Like

So I am working on converting a classic Smartthings HTD via the CLI. However…I get an unexpected server error when attempting to create a capabilities via the CLI. Even just polling my stuff gives me an error. The authentication webpage pops up, but error in CLI. Any ideas?

Well, I didn’t read through all the pages…but seems the token can be added to the CLI config file, I will try that (I have a personal token that I created, I presume that is okay to use here).

Hello @crazylukedog,
Yes, you should use your Personal Access Token, make sure it has the corresponding scopes for the different endpoints. Take a look at this post above as a reference for the configuration file or the token parameter in the command.

Did you ever figure this error out? I’m getting the same thing too.

EDIT : saw you other post just now about removing those 2 lines. Works now, but like you said, sucks we have to figure this stuff out ourselves.

1 Like

Noob here just wanted to help out with testing/updating some DTH’s. It seems that the developer workspace requires a registration with a company, is there any option at this time to just join the “Smartthings Developer Community” company or something so we can play around with this functionality?

Make up your own name and register it as an organization.

(the wording makes it seem its more restrictive than it actually is)

1 Like

You don’t need to use the Developer Workspace for messing with DTHs. It gains you nothing.

However should you wish to explore, you don’t need to be part of a company. You can register your own organisation.

1 Like

Don’t I need it to get a profile for custom capabilities using the CLI?

No. The DTH is itself the source of the device metadata.

So I have begun to make my first custom device with custom capabilities. I seem to be struggling. I have made two custom capabilities, created their capability presentation, updated the DTH in the Smartthings IDE, and updated the deviceconfig.json.

I can manually run the custom capability commands through the CLI and they work with my device. However, when I add these devices to Smartthings they do not present the custom capabilities that I have added. I can use the CLI to check the presentation of specific devices via their device ID and it does not appear that my custom capabilities are listed (and a bunch of other crap that isn’t mine is there). However, the presentation id’s and vid id’s match in both the IDE and the CLI responses.

I have deleted the devices from my phone, cleared the cache from my phone, and recreated with no luck. Is there a way to check the presentation that will be used for a device before it is actually created?

Custom Capability #1 Json:

{
“dashboard”: {
“states”: [
{
“label”: “{volume.value}”
}
],
“actions”: ,
“basicPlus”:
},
“detailView”: [
{
“label”: “Volume”,
“displayType”: “slider”,
“slider”: {
“range”: [
0,
60
],
“step”: 1,
“command”: “setVolume”,
“value”: “volume.value”
}
}
],
“automation”: {
“conditions”: [
{
“label”: “Volume”,
“displayType”: “slider”,
“slider”: {
“range”: [
0,
60
],
“step”: 1,
“value”: “volume.value”,
}
}
],
“actions”: [
{
“label”: “Volume”,
“displayType”: “slider”,
“slider”: {
“range”: [
0,
60
],
“step”: 1,
“command”: “setVolume”,
}
}
]
},
“id”: “squaresmoke31960.volume”,
“version”: 1
}

Customer Capability #2

{
“dashboard”: {
“states”: [
{
“label”: “Source: {{sourcelist.value}}”,
}
],
“actions”: ,
“basicPlus”:
},
“detailView”: [
{
“label”: “Source”,
“displayType”: “list”,
“list”: {
“states”: {
“label”: “Source”,
“value”: “sourcelist.value”,
“alternatives”: [
{
“key”: “input1”,
“value”: “Input 1”
},
{
“key”: “input2”,
“value”: “Input 2”
},
{
“key”: “input3”,
“value”: “Input 3”
},
{
“key”: “input4”,
“value”: “Input 4”
},
{
“key”: “input5”,
“value”: “Input 5”
},
{
“key”: “input6”,
“value”: “Input 6”
},
]
},
“command”: {
“name”: “setSourceNum”,
“alternatives”: [
{
“key”: “input1”,
“value”: “1”
},
{
“key”: “input2”,
“value”: “2”
},
{
“key”: “input3”,
“value”: “3”
},
{
“key”: “input4”,
“value”: “4”
},
{
“key”: “input5”,
“value”: “5”
},
{
“key”: “input6”,
“value”: “6”
},
]
},
}
}
],
“id”: “squaresmoke31960.sourcelist”,
“version”: 1
}

Device Config

{
“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”: “squaresmoke31960.sourcelist”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
},
{
“component”: “main”,
“capability”: “squaresmoke31960.volume”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
}
],
“automation”: {
“conditions”: [
{
“component”: “main”,
“capability”: “switch”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
},
{
“component”: “main”,
“capability”: “squaresmoke31960.sourcelist”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
},
{
“component”: “main”,
“capability”: “squaresmoke31960.volume”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
}
],
“actions”: [
{
“component”: “main”,
“capability”: “switch”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
},
{
“component”: “main”,
“capability”: “squaresmoke31960.sourcelist”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
},
{
“component”: “main”,
“capability”: “squaresmoke31960.volume”,
“version”: 1,
“values”: ,
“patch”: ,
“visibleCondition”: null
}
]
},
“vid”: “e743a96a-0db3-3651-bcf2-4d4009a87034”,
“mnmn”: “SmartThingsCommunity”
}

So I will add, I did a copy and paste from the original post and found that he has a typo, it is mnmn not mnmm in the metadata section of the DTH. So I fixed that and now when I used the cli to check a specific devices capabilities I can see they are there but they do not appear in the actual app.

And you added the vid and mnmn values to your new dth? That is all the new app looks at for what to display. Everything else in your dth seems to only apply to the old app. Also, I found I had to start a new dth from scratch the first time I started creating for the new app. You can copy and paste your existing dth into a new one but just editing an existing one never seems to work for initial generation of new app capability.

Then created the device presentation using the device config in the CLI and updated the DTH with the mnmn: and vid: from the created presentation?

Yep, using the following command as outlined in the tutorial:

smartthings presentation:device-config:create -j -i deviceConfig.json

In my dth I did have a type (that was copied from this presentation) where in the DTH metadata I had mnmm instead of mnmn. That seemed to help in that when I run the following CLI command after creating an instance of my device I can see the updated device presentation:

smartthings devices:presentation :::::: SPECIFIC DEVICE ID HERE ::::::::::

So that has me even more baffled. @guxdude Yes, I have update the mnmn and the vid in my DTH (as I caught the typo long after the fact with mnmm vs mnmn. I am going to try and made the DTH from scratch though. I’ll post the results.

So I have got this too work. Not sure what the magic step was. But I essentially just went through the motions from start and now the capabilities show in smartthings.

  1. Deleted DTH.
  2. Regenerated deviceconfig.
  3. Edited to my liking and updated presentation.
  4. Copied new vid.
  5. Cleared app cache on phone.
  6. Recreated DTH with new vid.
  7. Created device instance on phone.

Uh…it seems so silly to have to go through all these steps over and over again with so little feedback on what is happening in the black box that is the Samsung CLI. My programming to entering CLI commands over and over is probably 1 to 15. Now if I want to program something small I have to ask myself do I want to spend roughly 15 times that to get it to actually show up.

Or worse yet, one of my capabilities uses the list devicetype. It does not work…gives me a network error. It seems that the labels in the app are not what I listed in my presentation json either, they are in fact the values. So I know something is buggy there…so now I get to edit, resubmit everything and cross my fingers.

I just bought a new home and went with Smartthings because of the ability to program your own stuff. Didn’t realize the transition that was going on at the moment…I feel really bad for folks that have already written a ton of custom stuff and have to redo it.

5 Likes

That’s certainly how I feel! I spent a while building a few integrations for different devices and have a decent userbase, but now I’m sinking in to-do list items, and having to get my own home working with a wide range of stuff, before going through the update to all my public DTHs!

The CLI interface is so archaic! Who programs by submitting random JSON files with complicated names and formatting, and processes nowadays?! Even building an Android app is easier! (And I’m far from an advanced coder)

  • Wheres debugging?
  • Wheres the 5 second feedback loop when saving a DTH in the IDE?
  • Why do I have to do everything again from scratch when it was working well with the old interface?
  • Why is there not an import/update/conversion process from old format/design?
  • Why is there not super detailed and clear documentation?
  • Why are there bugs that make it even harder?
8 Likes