I need help I don't understand this error ERROR 422

AxiosError: Request failed with status code 422:
{“requestId”:“453387167791519067”,“error”:{“code”:“ConstraintViolationError”,“message”:“The request is
malformed.”,“details”:[{“code”:“UnprocessableEntityError”,“target”:“config.yml”,“message”:“Instantiation of
[simple type, class smartthings.sprocket.models.DriverPackage$ConfigFile] value failed for JSON property name due
to missing (therefore NULL) value for creator parameter name which is a non-nullable type\n at [Source:
(ZipInputStream); line: 10, column: 21] (through reference chain:
smartthings.sprocket.models.DriverPackage$ConfigFile["name"])”,“details”:}]}}
Code: ERR_BAD_REQUEST

my code Config.yml is this

driver:
name: My Smart Lock Driver
packageKey: my-smart-lock-driver
version: “1.0.0”
profiles:
- name: my-lock-profile
path: profiles/my-lock-profile.yml
fingerprints:
- path: fingerprints.yml
main: src/init.lua

Hi, @ANOVO_INTELITECH

The config.yml file should only contain something like the sample in the documentation:

name: 'Hello World'
packageKey: 'helloworld.example'
description: 'Hello World example configuration file'
vendorSupportInformation: 'YourBrandName'
permissions:
  lan: {}
  discovery: {}

For Zigbee or Z-Wave, permissions changes to only zigbee: {} or zwave: {}.
The extra lines of “version”, “profiles”, etc. should not be included there.

name: ‘My lock’
packageKey: ‘my-driver’
description: ‘Controlador para cerradura Zigbee HM-034e’
vendorSupportInformation: ‘Damflou’
permissions:
zigbee: {}

it’s OK now?

I’m very new to the smartthings CLI so I don’t understand some things, in case you don’t have a guide that contains steps to create drivers and so on?

with this code I get this

AxiosError: Request failed with status code 422:
{“requestId”:“3331099460349766868”,“error”:{“code”:“ConstraintViolationError”,“message”:“Invalid device profile
specification for 209a90bb-4f8b-4b85-b59c-973e0934d812”,“details”:[{“code”:“NotValidValue”,“target”:“components[0].c
ategories[0]”,“message”:“Lock is not a valid value.”,“details”:}]}}
Code: ERR_BAD_REQUEST

It looks like you have used the category Lock in a profile file. You probably want to use SmartLock instead. The documentation includes a list of categories.

name: “smartlock-profile”
components:

  • id: “main”
    capabilities:
    • id: “smartlock”
      version: 1
    • id: “battery”
      version: 1
    • id: “lockCodes”
      version: 1
    • id: “refresh”
      version: 1
      categories:
    • name: “Cerradura”
      categoryType: “SmartLock”

This is my code, what do I have to change?

It is difficult to tell from the post it has been processed by the forum software. An important thing to understand when working with YAML files is that the amount of indentation has meaning.

The SmartThings house style for indenting YAML files is slightly different than my own, and they tend to favour:

name: smartlock-profile
components:
- id: main
  capabilities:
  - id: smartlock
    version: 1
  - id: battery
    version: 1
  - id: lockCodes
    version: 1
  - id: refresh
    version: 1
  categories:
    name: SmartLock

The categoryType isn’t needed but if you specify it then it should be manufacturer.

2 Likes

Yes, @ANOVO_INTELITECH, as @orangebucket, you should wrap your code with the symbols ``` (at the top and the bottom of the code block) to see if you have the correct indentation, this way the code isn’t formatted as normal text and changes - with list-bullets.
The profile config shared by Graham above is correct.

The property you used of “categoryType” isn’t supported in this section, I believe it doesn’t exist, it seems familiar but I couldn’t find it in other profiles. Are you trying to convert something into a driver? Like a Groovy DTH for example

Edit: ah, I see the property now, it’s included automatically once the device is created. I missed the last note from Graham above. Thanks!

Just FYI, remember that the category determines which icon is assigned to your device, that’s why the category defined in the profile is considered as “manufacturer” because that’s the one the developer defines and for those categories that allow icon change, we can see a new type added called “user” if we choose a new one.

2 Likes

@nayelyz I have a question: smartthings edge:drivers:publish does not work in the CLI, did the code to publish drivers change?

Yes, you must use smartthings edge:channels:assign, where you’ll select the driver and channel where you want to assign it, this is the same as “publish”.
If you omit this step, the channel will have the latest version assigned even if there’s a new driver version created with smartthings edge:drivers:package. This means users enrolled in that channel won’t get the latest version.
To verify your channel has the latest version assigned, you can use the command smartthings edge:channels:metainfo.

1 Like