[ST Edge] What is the meaning of "command.name" in list display type?

Hi, all.

I have a question about custom capability.

This My Custom Capability

After some evaluation, I choose “list” as my presentation type.
This part of my presentation.yaml

  - label: '{{i18n.label}}'
    displayType: list
        name: startSelfCheck
          - key: startSelfCheck
            value: '{{i18n.commands.startSelfCheck.label}}'
            type: active
        argumentType: string

I discovered something strange that above presentation definition doesn’t work with an empty argument command.

❯ diff bad-selfCheck.yaml good-selfCheck.yaml
<     arguments: []
>     arguments:
>       - name: state
>         optional: false
>         schema:
>           type: string
>           enum:
>             - startSelfCheck

I got error

 "Command is not found for command name : startSelfCheck"

With the help of others, we found that remove “name: startSelfCheck” from presentation.yaml could avoid this error.

I ask this question here because it’s a very hidden issue i think (Maybe I didn’t read doc carefully)
What I got from doc are

  1. Command supports empty arguments
  2. Example definition of list DisplayType

When I put above two points together, I got the error when i run cli presentation:update xxx

"Command is not found for command name : startSelfCheck"

I don’t why empty arguments will cause this error…


Hi, @liuyd96
I did some tests and saw the same behavior you mentioned with the empty command, so, I’ll ask the engineering team about the error.
However, another solution is defining an argument for the command but setting the argument property as "optional": true. This way, the presentation can have the property “name” in “command” and:

  1. When you send commands through the API, it won’t need to include an argument
  2. The app will include the value in “key” of the alternatives as the argument for the command automatically. For example:
"detailView": [
        "label": "{{i18n.label}}",
        "displayType": "list",
        "list": {
            "command": {
                "name": "startSelfCheck",
                "alternatives": [
                        "key": "startSelfCheck",
                        "value": "start",
                        "type": "active"
            "state": {
                "value": "selfCheckState.value",
                "valueType": "string",
                "alternatives": [
                        "key": "idle",
                        "value": "IDLE",
                        "type": "active"
                        "key": "selfChecking",
                        "value": "Self Checking",
                        "type": "active"
                        "key": "selfCheckCompleted",
                        "value": "Self Check Completed",
                        "type": "active"
received command: {"args":{"start":"startSelfCheck"},"capability":"commonsmall09402.selfCheck","command":"startSelfCheck","component":"main","positional_args":["startSelfCheck"]}

I’ll keep you updated.

1 Like

Hi, @liuyd96
Following up, the engineering team provided more details about the “list” display type.
This is the sum up:

  1. There are two types of commands can be defined for a capability:
    a. Command with arguments
    b. enumCommands (the capability “Switch” is an example of their definition)
  2. When we use command.name a command with arguments is expected
    a. The command called is the one specified in name and its argument is the selected option of the alternatives, specifically, the value in “key”.
  3. If we remove the property name from command, an enumCommand is expected and it can omit the argument.
    a. In this case, the command name will be looked up in the “key” property of “alternatives”

We’ll create a ticket to add this information to the developer documentation to avoid confusion in the future.


Thanks for sharing :wink: