Correct Z-Wave Lock API Command

Hi all,

I am moving from Vera to Smartthings. On Vera I have a a Siri shortcut that goes through my Airbnb booking and grabs the last 4 digits of the guest’s phone number and then programs my Yale pushbutton lock (through vera REST API) with this code.

On Smartthings, I can’t seem to figure out the correct REST command to do the same thing. Devices that are simple on/off are easy:

curl --request POST
–url https://api.smartthings.com/v1/devices/ef8bbc69-dcc7-49b8-afad-da15bc4***/commands
–header 'authorization: Bearer *****
–header ‘content-type: application/json’
–data ‘{
“commands”: [
{
“component”: “main”,
“capability”: “switch”,
“command”: “off”
}
]
}’

For a z-wave lock? Does anyone have an example for SET, GET codes??? Also, looks like scheduling code expiration is not possible in the provided DTH, is that right?

If you have access to RBoy apps check out this app which provides a comprehensive REST API for remote lock user programming and actions with a variety of options and also verifies that programming was successful.

2 Likes

Thanks, but I don’t need all that. The Smartthings api does what I need, I just need to figure out the right syntax :frowning:

@fdanna, did you ever figure this out? I can help you with the GET, but you should know that you can only get the name and ID of a code, but not the code itself (and rightfully so).

There are two ways that I can see,

Get Lock Codes

  1. uri: devices/{deviceId}/status
  • once you have the response, you should see the codes in the following json path:
    components/{componentId}/{capabilityId}
  1. uri: devices/{deviceId}/components/{componentId}/capabilities/{capabilityId}/status

I am using Schlage so I know that capabilityId in my case is lockCodes, but it should be specific to your device.

Get Device Capabilities
You can find your device’s capabilities by api endpoint: devices/{deviceId}
Then you will see them in the json path components/capabilities

Set Lock Codes
I’ve been trying to do this myself and can’t seem to find a way yet. One thing we know for certain is that it is possible since we know @RBoy figured it out. If you figure this one out, I’d be interested to see how you did it. More importantly I’d like to know how you found out, since I have a lot more I would like to do with my devices.

Hi Sam, never figured it out. I did figure out that since my account was registered in the wrong region I didn’t see the smart lock guest access app. Samsung told me I should be able to use the api to configure the locks through the api with the smart lock app. It doesn’t seem apparent to me how that is supposed to go :frowning:

I got you bro (I think). It looks like even if a command is not exposed publicly on the API you can still call it if the device has it. This means that for a Schlage Connect lock:

devices/{deviceId}/commands
with this body:

{
  "commands": [
    {
      "component": "main",
      "capability": "lockCodes",
      "command": "setCode",
      "arguments": [
        3,"1235","Test Code"
      ]
    }
  ]
}

will properly set a new code, while:
devices/{deviceId}/commands
with this body:

{
  "commands": [
    {
      "component": "main",
      "capability": "lockCodes",
      "command": "deleteCode",
      "arguments": [
        3
      ]
    }
  ]
}

will effectively delete the code you created.

I REALLY wish there was a way to see which commands were available for a given capability. I cannot believe it is not supported yet.

If you (or anyone else) find out any more info on how to do this, I would really appreciate posting the answer here.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.