Unable to see custom capabilities in UI for "Direct-Connected" device

Desperately seeking help…

I’m pulling my hair during my efforts to design simple custom capabilities and their respective presentations. Let’s just say that the docs are not complete…

I have a device with 11 parameters that the user must be able to set, all are either boolean values or an integer. I’ve written and submitted, with the CLI, all 11 capabilities as well as their presentations.
Normally the user will not want to modify these parameters so they would have been perfect as “Device preferences” but “Device preferences” are not supported by Direct connected devices :slightly_frowning_face:
I’ve added 2 of them to the device profile and placed them in a separate component but they simply do not show up. And here’s the confusing part.
I’ve also made 2 custom capabilities with only text/state i.e "displayType": "state" in the "detailView" and they work fine

working presentation for custom cap

{
	"dashboard":{
		"states":[
		],
		"actions":[		
		]
	},
	"detailView":[
		{
			"label":"Information",
			"displayType":"state",
			"state": {
				 "label": "flowInfo.value",
				 "unit": "flowInfo.unit"
			}
		}
	],
	"automation":{
		"conditions":[],
		"actions":[]
	},
	"id":"themetravel04733.flowinfo",
	"version":1
}

I believe I’ve checked all the vid references etc.
I have tried lots of tweaks for quite some time and I’ve read all the docs I can find.

Any help/tips or pointers to my obvious mistakes would greatly appreciated.

Invisible, i.e. not working, capabilities/presentations

volumewarning capability

{
    "id": "themetravel04733.volumewarning",
    "version": 1,
    "status": "proposed",
    "name": "volumeWarning",
    "ephemeral": false,
    "attributes": {
        "volumeWarning": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "boolean"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setVolumeWarning",
            "enumCommands": []
        }
    },
    "commands": {
        "setVolumeWarning": {
            "name": "setVolumeWarning",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "boolean"
                    }
                }
            ]
        }
    }
}

volumewarning presentation

{
	"dashboard": {
		"states": [],
		"actions": []
	},
	"detailView": [
		{
			"label": "Send warning",
			"displayType": "standbyPowerSwitch",
			"standbyPowerSwitch": {
				"command": {
					"name": "setVolumeWarning",
					"on": "on",
					"off": "off",
					"argumentType": "string"
				}
			},
			"state": {
				"label": "{{volumeWarning.value}}",
				"value": "volumeWarning.value",
				"alternatives": [
					{
						"key": "on",
						"value": "On",
						"type": "active"
					},
					{
						"key": "off",
						"value": "Off",
						"type": "inactive"
					}
				]
			}
		}
	],
	"automation": {
		"conditions": [],
		"actions": []
	},
	"id": "themetravel04733.volumewarning",
	"version": 1
}

volumelow capability

{
    "id": "themetravel04733.volumelow",
    "version": 1,
    "status": "proposed",
    "name": "volumeLow",
    "ephemeral": false,
    "attributes": {
        "volumeLow": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer",
                        "minimum": 50,
                        "maximum": 5000
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "liter"
                        ],
                        "default": "liter"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setVolumeLow",
            "enumCommands": []
        }
    },
    "commands": {
        "setVolumeLow": {
            "name": "setVolumeLow",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "integer",
                        "minimum": 50,
                        "maximum": 5000
                    }
                }
            ]
        }
    }
}

volume low presentation

{
	"dashboard": {
		"states": [],
		"actions": []
	},
	"detailView": [
		{
			"label": "Large volume notification level",
			"displayType": "numberField",
			"numberField": {
				"value": "volumeLow.value",
				"unit": "volumeLow.unit",
				"command": "setVolumeLow",
				"range": [50, 5000]
			},
			"state": {
				"label": "{{volumeLow.value}} {{volumeLow.unit}}",
				"unit": "volumeLow.unit",
				"alternatives": []
			}
		}
	],
	"automation": {
		"conditions": [],
		"actions": []
	},
	"id": "themetravel04733.volumelow",
	"version": 1
}

In the case of the display type standbyPowerSwitch, I don’t know if it could be caused by the value set in the “label”, last time I checked, labels could not be dynamic. I will make tests using your capability.
Also, as the attribute type is “boolean” I think the values of “on”/“off” are not accepted, if the tile appears in the app and you receive the command, do you set the correct value (true/false)?

About numberField, it doesn’t require a “state” property, so it could be confusing when the view is rendered. So, I suggest you modify it and test it.

Can you share the VID used by your device, please? In the case of device profiles created in the Developer Workspace, they are linked to your org MNID, so, please share that one as well so I can query its config.

Hi,

Thanks for quick response.

using CLI I get "vid": "ST_299bcc92-b2ec-4191-951e-9d354c2ed39d", and `“mnid”: “0A5d”

I want the user to be able to set a number of on/off switches and enter a number integers, that’s all…

I’ve written some C-code that can receive commands and values for my custom caps. I checked that they worked by issuing commands with the CLI.

/Anders

P.S I’m assuming that custom caps should be visible in the app (Android(iOS)) even if they have not been set from device code.
P.S 2 I have not yet figured out how to set a boolean value from the device with the macros defined in st-device-sdk-c/APIs.md at master · SmartThingsCommunity/st-device-sdk-c · GitHubSolved!
Reading a command with boolean parameter works.

Hi,

I made some changes based on your suggestions and I can now see the entries in the app (iOS & Android).
However, the defined setter commands are not sent/passed to the device through the Smartthings backend, i.e no mqtt message to catch on the device.
When the switch for the boolean parameter is changed the app show a local notification stating that there is a network or server error. I can, however, initiate the same commands using the CLI with smartthings devices:commands and see that they are received, and parsed, by the device. So it seems like the app doesn’t send anything.

Cheers

I have one remaining custom capability that is presented in the app but no command is sent from the phone OR the Smartthings backend. No mqtt message is received by the device.
This is the remaining issue for me in this thread, the other issue with the numberField was resolved.

I tried changing the alternatives in the presentation “command” to “true”/“false” and it did not appear to help but… how can I make sure that the app/backend sees an updated capability/presentation? Can I force an update?

capability

{
    "id": "themetravel04733.volumewarning",
    "version": 1,
    "status": "proposed",
    "name": "volumeWarning",
    "ephemeral": false,
    "attributes": {
        "volumeWarning": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "boolean"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setVolumeWarning",
            "enumCommands": []
        }
    },
    "commands": {
        "setVolumeWarning": {
            "name": "setVolumeWarning",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "boolean"
                    }
                }
            ]
        }
    }
}

presentation

{
    "dashboard": {
        "states": [],
        "actions": []
    },
    "detailView": [
        {
            "label": "Send warning",
            "displayType": "standbyPowerSwitch",
            "standbyPowerSwitch": {
                "command": {
                    "name": "setVolumeWarning",
                    "on": "on",
                    "off": "off",
                    "argumentType": "boolean"
                }
            },
            "state": {
                "alternatives": [
                    {
                        "key": "on",
                        "value": "On",
                        "type": "active"
                    },
                    {
                        "key": "off",
                        "value": "Off",
                        "type": "inactive"
                    }
                ]
            }
        }
    ],
    "automation": {
        "conditions": [],
        "actions": []
    },
    "id": "themetravel04733.volumewarning",
    "version": 1
}

Cheers

Yeah, I made tests with the standbyPowerSwitch display and I also had issues updating the presentation when using boolean values, it was weird…
So I created a new one using string values and it works correctly, please, check this capability: commonsmall09402.volumewarningtwo using the CLI. Eg.:

//Capability definition
smartthings capabilities commonsmall09402.volumewarningtwo [-j or -y]
//Capability presentation
smartthings capabilities:presentation commonsmall09402.volumewarningtwo [-j or -y]

So, I will check that with the team and report it if needed, in the meantime, you could create a new capability and change them to boolean to continue working on your integration.

I applied your changes/modifications and it works.

Thanks

I am not sure if my issue is the same, but in my case, I am creating a direct connected device using ESP32 following the tutorial. I am able to create a device profile with capabilities including “switch” and one of my custom capabilities (a slider that is pretty much identical to switchLevel). However, when I added two more capabilities onto the device profile in developer workspace (one is “notification”, one is another slider), both of the capabilities are not shown in detailview UI. But the UI rendering works when I add switchLevel capability in the device profile. It is rendered as gray since I didn’t add switchlevel into ESP code.
I create my project based on the switch example. Can you tell me if there is anything I miss in this case? From my understanding, even if the code on ESP32 doesn’t have the proper handler for specific capabilities, as long as the capabilities are added to the device profile, they should at least be rendered right? @AlejandroPadilla
Thanks!

Hi @jackj first we can check it the device profile save correctly the capabilities, Are you familiar with the SmartThings CLI?

with this command to check the deviceprofile

smartthings deviceprofiles [deviceprofileId] -j 

Hello, yes I have used CLI. For deviceprofile, I think it is saved correctly since under components, it list out all the correct capabilities. However, when I use smartthings devices [deviceID], the capabilities included are not updated.

Okay, how do you update the device profile?

I just edit the capabilities under the device profile section and click save. I also checked the onboarding_config.json after updating the capabilities, and it is the same as the previous one. Does capabilities change result in a different profile ID?
Also couple of things I tried:

  1. when I use smartthings devices [deviceID]in CLI, the profile id under the device is an ID that is different to the device profile ID I have in my developer workspace. I use smartthings deviceprofiles [deviceprofileId] -j to check this profile, and somehow this profile status is listed as “published” instead of “development”. I don’t recall publish this profile;
  2. If I delete capabilities from the current device profile in workspace, the deletion will be reflected on device card in SmartThings app. However, adding any capabilities doesn’t work.