Custom Capability and CLI Developer Preview

I checked in both Android and iOS, and the icon works normally. Does it happen continuously, even after restarting the app?

I see what you mean, I’ll investigate this further. Thanks for bringing it up.

Yes, the spinning was happening even after restarting the app. I’ve made some changes now and will have to wait for them to appear in the app and I’ll let you know if it’s still spinning like that.

pushButton

Is this capability working? For both dashboard and details view?

How does it work exactly - from the device app perspective? It seems it would not typically have an attribute. You have a setter command that receives a ‘push’ argument. But then since the capability has no attribute, the device app does not have to send any kind of state update to it. Is this correct? So does it act as kind of a one-way, one-shot command action with no attribute that needs updating?

Dashboard action vs. state

Can you have the action and state on the dashboard from 2 different capabilities? I have one capability I want to show status, that is separate from a button or switch capability that would perform the action. I’m having strange issues trying to do this and it occurred to me that maybe this is not allowed: Does the action and state have to be tied together through a single capability?

Hey, pushButton is under review too. However, @btrial shared how he’s using this display type.

He’s not using the setter command which is the one that expects a state update. Using the other commands, there’s no time out exceeded (network error) if the update isn’t received.

It is not mandatory, but you need to place them and configure them correctly, this means, at the device configuration:

  • The capability for status must be in states
  • The capability for action, only in actions

At the capability presentation, actions and state display must be configured accordingly.

For example:

//Device configuration
"dashboard": {
    "states": [
        {
            "component": "main",
            "capability": "temperatureMeasurement",
            "version": 1,
            "values": [],
            "patch": []
        }
    ],
    "actions": [
        {
            "component": "main",
            "capability": "xxxx.startButton",
            "version": 1,
            "values": [],
            "patch": []
        }
    ]
}
//Capability Presentation
"actions": [
    {
        "displayType": "pushButton",
        "pushButton": {
            "command": "startButton"
        }
    }
]

What issues are you having?

Did they completely mess up multi component devices recently? It’s possible I’m missing something, but the example you provided doesn’t appear to work the way you described…

I’m specifying specific capabilities to display for each child in the parent’s presentation, but the details view is showing all the capabilities of the child devices, even the ones that aren’t included in the details view of the child device’s presentation. I also can’t change the order so the main component is stuck at the bottom.

Automations is only showing the conditions/actions that I specified which is good, but it doesn’t show the component name/label so all you see is a bunch of duplicate attributes/commands.

To make matters worse, the latest version of the Android app ignores the supportedButtonValues attribute so when you select a 4 button multicomponent device you see all 22 button actions and they’re listed 4 times.

Can someone explain to me how to get this card slider

tile bueno

instead of this one

tile malo

I have tried different presentations but there is no way to get it

I would also like to know why the icon always appears inactive in gray instead of black.

Problems related to this DTH:

Thank you.

Hey :slightly_smiling_face:, the stock capability Carbon Monoxide Measurement uses a customized UI and up to now, changing the custom/stock capabilities UI is not available.
About the icon, it changes between active/inactive based on the capability alternatives, for example:

{
    "dashboard": {
        "states": [
            {
                "label": "{{lockstate.value}}",
                "alternatives": [
                    {
                        "key": "disarmed",
                        "value": "Disarmed",
                        "type": "active"
                    },
                    {
                        "key": "armed",
                        "value": "Armed",
                        "type": "inactive"
                    }
                ]
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "Security State",
            "displayType": "state",
            "state": {
                "label": "{{lockstate.value}}",
                "alternatives": [
                    {
                        "key": "disarmed",
                        "value": "Disarmed",
                        "type": "active"
                    },
                    {
                        "key": "armed",
                        "value": "Armed",
                        "type": "inactive"
                    }
                ]
            }
        }
    ]
}

Note: @Luis_Mijares, the capability that will use the alternatives to change the icon must be in the Dashboard View States property.
The OCF type x.com.st.d.airqualitysensor icon doesn’t seem to change, though. I will check if it’s a configuration matter.

Where could I find the presentación and alternatives for air qualiry sensor capability?

Once I Know those alternativas how could I change them in my DTH?

What is the name/URL for that lock icon?! I’d like to use it :grin:

Thank- you for your reply. I’ve delayed responding because I’ve wanted to try some different things before I did. Here is what I have found so far regarding the use of a custom capability switch for the dashboard action, and separate custom capability label for the dashboard state:

  1. If I don’t include an alternatives section in my presentation json for the dashboard state label, then whatever my app sets for the attribute gets blanked out (it flashes for a brief moment but then disappears. The API documentation does not show that alternatives is a mandatory json section for dashboard, but it appears that it is.

  2. If the device application doesn’t update the dashboard state label value as well as the switch attribute when the switch is pressed, then the switch will spin for about 12 seconds. I found that updating the state label stops this spinning. So there does seem to be some kind of dependency between the action and state on the dashboard even if they are two separate capabilities.

  3. In the capability presentation json, trying to set any of the dashboard state label alternative types to “inactive” results in no state being shown for any value; and no change to the icon coloration. I want certain values to cause the icon to be greyed out vs. colored, and I thought this was the purpose of type=active/inactive in the alternatives section. However this doesn’t seem to be working with custom capabilities.

Just picking up on this from a week ago. I’ve not been playing around with this stuff much of late. I could cope with waiting for the functionality I wanted to arrive (it still hasn’t and I’ve been waiting from pretty much day one - I need individual commands but implementing setter commands seems to have been given priority) but I more or less gave up when capability presentations were changed so they updated devices directly. Yes it was good not having to create a new unique presentation ID to pick up capability changes, but it wasn’t good that I had to wait up to twelve hours to see if they worked as there was no apparent way of making them take effect immediately, and it wasn’t good that if I did mess up others using my capabilities might have found out before I did. So no tweaking of live capabilities any more.

However the one thing you could always rely on was that once you had a new presentation in your handler, all you had to do was wait for your app to pick it up. Your alternatives seemed to be:

  • Wait for up to twelve hours for a cache in the app to expire.
  • Wipe the cache in the mobile app manually (tedious and a little unreliable).
  • Update something non-trivial like the device name in the IDE (my preferred route) and the app would take notice.
  • Create a completely new device.

I now find that the last three options no longer have the desired result.

I see the current device presentation displayed in the API simply doesn’t update immediately. It isn’t something I ever really looked at but I always assumed that it must do and the real issue was breaking the caching on the app. Something fundamental has changed though. There is no way that creating a completely new device should be picking up a VID that wasn’t in the handler when it was created.

Has the cache fairy been leaving unwanted gifts again?

Update: I see @bangali reported this behaviour last November. I remember his post, I just didn’t realise it was so long ago. I am surprised anyone has got anything useful done since. My presentation did update eventually. Don’t know when but it took less than five hours. Unfortunately I made a mistake so I may have wait a few hours to see if I got it right second time around. This used to be a five to ten minute job.

Second update: it feels like there are two caches in play now. One to apply the presentation to the DTH/device, and a second to apply that change to the app.

A further comment.

Just as I can progress with testing capability presentations by creating a completely new copy of the capability, I can presumably progress with testing device presentations by creating a completely new copy of the device handler. This all rather sucks. However if there was a functioning versioning system in place it might actually make perfect sense. It might require hobbyists to be a little more methodical about what they do but that isn’t necessarily a bad thing. There isn’t one though, or if there is we haven’t been told about it, which is the equivalent of there not being one.

Throw us a bone here.

I am legitimately concerned at this point that these particular items may never get fixed :frowning: This stuff is hard enough as it is without losing hours upon hours renaming devices and still being unsure whether or not my changes even took effect.

I understand that this was promoted as a ‘developer preview’ or ‘alpha test’.

Yes, the CLI was there and more than adequate on day one. That was and is a good alpha test product and if the feature set were frozen (please don’t) it wouldn’t be far off a beta product. It is already invaluable.

Yes, custom capabilities as replacements for custom attributes and commands were there on day one. If that aspect of them isn’t finished, it isn’t obvious. They too are already really useful.

However …

Capability presentations? Not every stock capability had one on day one and I’m not sure they all do now. In any case it doesn’t appear they were, or are, being used for stock capabilities, not only because in many cases the capability presentation bears little relation to what is actually displayed, but because much of the functionality clearly doesn’t exist yet. I feel they were a bit oversold because they were used in a tutorial but the reality was they were mostly vapour. Very much a preview feature lagging a long way behind. Unfortunately they are a feature that we need to use in production now.

Device configs and presentations? The device presentations feel like they’ve been around a while in a similar or identical form but weren’t really designed to work with capability presentations. The device configs looked like something that was retrofitted to make them more sympathetic to user configuration. Useful from day one though.

I still don’t know where we are in the development process with this stuff.

don’t know about others but i certainly haven’t.

As the Air Quality Sensor capability has a numeric attribute, it doesn’t have alternatives, you can query its presentation using:

smartthings capabilities:presentation airQualitySensor -j

The alternatives are used automatically when you include them in dashboard > states (device-config) as they are part of the capability presentation.

For direct or cloud connected devices, when you create your device profile, selecting the Device Type SmartLock will assign the icon through the properties deviceTypeId and ocfDeviceType. For example:

{
    "id": "xxx-xxx-xxx",
    "name": "customSwitch",
    "components": [
        {
            "label": "main",
            "id": "main",
            "capabilities": [
                {
                    "id": "xxx.customswitch",
                    "version": 1
                }
            ],
            "categories": []
        }
    ],
    "metadata": {
        "vid": "ST_fdfe9507-4cc2-426c-xxxx-xxxx",
        "deviceType": "SmartLock",
        "mnmn": "0AMA",
        "ocfDeviceType": "oic.d.smartlock",
        "deviceTypeId": "SmartLock",
        "ocfSpecVer": "core 1.1.0",
        ...
    },
    "status": "DEVELOPMENT",
    "preferences": []
}

You might need to re-add the device to see the new icon, just remember that for this icon:

  • active = lock open.
  • inactive = lock closed.

For DTH, you need to use the same properties (and values) in the metadata, eg.:

metadata {
	definition (name: "DTHname", author:"nayely",vid: "xxx-xxx-xxx", mnmn: "SmartThingsCommunity", deviceTypeId:"SmartLock",ocfDeviceType:"oic.d.smartlock") {
    ... 
    }
    ...
}

Thanks for the info about the lock icon. I’m dismayed to see it will take device app changes to use though! Maybe I’ll try it if I ever get other things working acceptably…

I’m with you. It seems very concerning that it’s been more than 6 months and we’ve seen no changes/improvements in anything - not even documentation. It makes you wonder if Samsung is walking away from this platform for anything other than whatever they wanted to support their own electronics & appliances. If that’s being too pessimistic then one can only assume that the team is very short-staffed and/or they are on an old-school, monolithic waterfall development cycle where they can only release major versions infrequently. They really need to switch to agile methodology and get more responsive before EVERYONE abandons this thing.