Smartthings capabilities:create A non-recoverable error condition occurred

veon@veon-XPS-15-9550:~/dev$ ./smartthings capabilities:create
? Capability Name: cubeFace
? Select an action... Add an attribute
? Attribute Name:  face
? Select an attribute type: integer
? Minimum value (default: no minimum):  
? Maximum value (default: no maximum):  
? Unit of measure (default: none):  
? Add a setter command for this attribute? Yes
? If you want to add a basic command, enter a command name now (or hit enter for none):
(Basic commands are simple commands that set the attribute to a specific value.) 
? Select an action... Finish & Create
    Error: Request failed with status code 500: {"requestId":"DB98DA4F-12D3-4C30-A71B-16240BD1C392","error":{"code":"UnexpectedError","message":"A non-recoverable error condition 
    occurred.","details":[]}}

Good catch! Thank you for bringing this up, I’ll mention this to the engineering team right away.

Update:
@veonua, it is working now for me, please check on your side as well.

./smartthings capabilities:presentation:create --input ./capabilities/facePresentation.json

┌───┬────────────────────────────────┬─────────┬──────────┐
│ # │ Id                             │ Version │ Status   │
├───┼────────────────────────────────┼─────────┼──────────┤
│ 1 │ winterdictionary35590.cubeface │ 1       │ proposed │
└───┴────────────────────────────────┴─────────┴──────────┘
? Select a capability. 1
    Error: Request failed with status code 403: {"requestId":"95BDA11E-9EA3-4BDF-BF9F-1062E4369E67","error":{"code":"4040000","message":"404 Not Found: 
    [{\"requestId\":\"838b6516-8228-4245-b3b4-8a3ebf873990\",\"error\":{\"code\":\"NotFoundError\",\"message\":\"Not found\",\"details\":[]}}]","details":[]}}

somehow I’ve got 403, 404 and 4040000 at the same time

any idea what is missing?

Mmm…I can create the presentation successfully. Can you share the content of the facePresentation.json file, please?

Thanks for the information.
What causes this error is the incorrect reference to the capability ID (see here). When you create a custom capability, you get assigned a random namespace, in your case is winterdictionary35590 according to the log you posted. So, to call/refer to the capability, you always need to use the complete ID namespace.capabilityname.

Aside from that, there are a couple of things I noticed in your presentation:

  • The section of “commands” that belongs to the list display type is missing (line 47). The command alternatives need to match the ones in state
  • You’re using the capability name (cubeFace) instead of the attribute name (face) (in line 5, 49, 125)

./smartthings capabilities:presentation:create winterdictionary35590.cubeface 1 --input ./capabilities/facePresentation.json
Error: Request failed with status code 403: {“requestId”:“B57568EA-32F8-4220-B55B-7CDEC8894BF0”,“error”:{“code”:“4030000”,“message”:“FORBIDDEN_ERROR”,“details”:}}

it’s a read-only feature, user should not be able to set it in UI

Are you still receiving the error after using the correct capability ID?

If you want to show the current value, you should use the state display type. If you leave that configuration the tile will display the current state, but when you open the list, it will allow the user to select an option that will trigger a network error because the command property is missing.

yes but it is a new error before it was Not Found, now it is Forbidden. And details will be very useful

ok, please, try the payload below. I’ve seen that kind of error appears when there’s an issue with the presentation’s format or a value in a property, but we need to analyze it.

{
    "dashboard": {
        "states": [
            {
                "label": "{{face.value}}",
                "alternatives": [
                    {
                        "key": "up",
                        "value": "up",
                        "type": "active"
                    },
                    {
                        "key": "down",
                        "value": "down",
                        "type": "active"
                    },
                    {
                        "key": "left",
                        "value": "left",
                        "type": "active"
                    },
                    {
                        "key": "right",
                        "value": "right",
                        "type": "active"
                    },
                    {
                        "key": "front",
                        "value": "front",
                        "type": "active"
                    },
                    {
                        "key": "back",
                        "value": "back",
                        "type": "active"
                    }
                ]
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "Face",
            "displayType": "list",
            "list": {
                "state": {
                    "value": "face.value",
                    "alternatives": [
                        {
                            "key": "up",
                            "value": "up",
                            "type": "active"
                        },
                        {
                            "key": "down",
                            "value": "down",
                            "type": "active"
                        },
                        {
                            "key": "left",
                            "value": "left",
                            "type": "active"
                        },
                        {
                            "key": "right",
                            "value": "right",
                            "type": "active"
                        },
                        {
                            "key": "front",
                            "value": "front",
                            "type": "active"
                        },
                        {
                            "key": "back",
                            "value": "back",
                            "type": "active"
                        }
                    ]
                }
            },
            "state": null
        }
    ],
    "automation": {
        "conditions": [
            {
                "label": "Cube Face",
                "displayType": "list",
                "list": {
                    "alternatives": [
                        {
                            "key": "up",
                            "value": "up",
                            "type": "active"
                        },
                        {
                            "key": "down",
                            "value": "down",
                            "type": "active"
                        },
                        {
                            "key": "left",
                            "value": "left",
                            "type": "active"
                        },
                        {
                            "key": "right",
                            "value": "right",
                            "type": "active"
                        },
                        {
                            "key": "front",
                            "value": "front",
                            "type": "active"
                        },
                        {
                            "key": "back",
                            "value": "back",
                            "type": "active"
                        }
                    ],
                    "value": "face.value"
                }
            }
        ],
        "actions": [
        ]
    },
    "id": "winterdictionary35590.cubeface",
    "version": 1
}
1 Like

thanks, the payload is accepted :+1:.
let me see how it is displayed in the app now.

but now I can not update it, even trying to update with the same configuaration

./smartthings capabilities 1 --json >> original.json
./smartthings capabilities:update 1 --input original.json
Error: Request failed with status code 403

output.json

{
    "id": "winterdictionary35590.cube",
    "version": 1,
    "status": "proposed",
    "name": "cube",
    "attributes": {
        "face": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "string"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        },
        "rotation": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "integer",
                        "minimum": -180,
                        "maximum": 180
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "°"
                        ],
                        "default": "°"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        },
        "action": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "string"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        }
    },
    "commands": {}
}

I’ve not got the CLI to hand but I’ve always found the argument handling a little odd and inconsistent. Certainly some versions of the docs suggest capabilities:update takes a full ID, not the number in the list, while other commands are happy with the latter.

Thanks, @orangebucket!
Graham’s right, @veonua. You need to add the capability ID and version as parameters.
The commands that accept the capability (or another element) index from the list and execute correctly are generally those that don’t use an input file.

smartthings capabilities:update namespace.capabilityname 1 -j -i input.json
//Eg.
smartthings capabilities:update winterdictionary35590.cube 1 -j -i original.json

Also, I noticed you added another attribute to the capability. Please, remember that custom capabilities don’t support multiple attributes, you need to create another one instead.
This is because a capability is used to describe a single property or measure of the device and, we can collect them in the device metadata (profile and device-config).

Whenever you have doubts about a command syntax or parameters, you can use the --help flag. Eg:

smartthings capabilities:update --help

Let me know if you have any doubts. :smiley:

hmmm… I have created the capability using the smartthings cli and it allows to add multiple attributes, creating a new attribute is the default option there.

the reason I wanted to update is to convert a string attribute to an enum (option not available from console).

But after all the time I spent it’s even better to have a more relaxed type. as the update of the capability is a pain, I had to reboot everything trying to fix a typo in the enum.

Yes, it lets you create other attributes and it will let you add them to the capability presentation as well but only one attribute will be displayed, the others can only be used internally.

So, do you want this attribute to store an array, or just want to define the possible options?
The attribute type refers to the kind of value you want to store - “string”, “number”, “integer”, etc.
The “enum” property for “string” attributes is used to define the possible values (this doesn’t configure the presentation automatically). Eg.:

"attributes": {
    "attributeName": {
        "schema": {
            "type": "object",
            "properties": {
                "value": {
                    "title": "attributeState",
                    "type": "string",
                    "enum": [
                        "valueOne",
                        "valueTwo",
                        "valueThree",6
                        ...
                    ]
                }
            },
            "additionalProperties": false,
            "required": [
                "value"
            ]
        },
        "enumCommands": []
    }
}
"action": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "string",
                        "enum": [
                            "slide",
                            "tap",
                            "shake",
                            "toss",
                            "flip90", 
                            "flip180"
                        ]
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        },

also, I am wondering how to make the attribute transient.
In the button capability, there is a “Ready” state that is the default.

Is this behavior available for custom capabilities?

No, that is a feature that is available only for this stock capability.
The engineering team is already aware of this request and is analyzing the best solution for this kind of use case. I suggest you stay tuned on the Announcements and the newsletter (subscribe at the bottom)
There was a similar discussion here:

1 Like

one more thing. Is there any way to force update capability?

When I made a mistake like “valueTree” and to fixed it after. It seems like driver keep expects “valueTree” as the value of the attribute, even after capability and driver update.