# Correct Z-Wave Lock API Command

**URL:** <https://community.smartthings.com/t/correct-z-wave-lock-api-command/171573>\
**Category:** Support\
**Tags:** yale, lock, developers\
**Created:** [August 28, 2019, 12:00pm UTC](https://community.smartthings.com/t/correct-z-wave-lock-api-command/171573 "2019-08-28T12:00:42Z")\
**Posts on this page:** 1\
**Showing post:** 68

<div class="post-metadata">

**Author:** ![orangebucket](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/orangebucket/32/81590_2.png) [@orangebucket](https://community.smartthings.com/u/orangebucket)\
**Post date:** [January 26, 2023, 7:56am UTC](https://community.smartthings.com/t/correct-z-wave-lock-api-command/171573/68 "2023-01-26T07:56:19Z")

</div>

Not really my thing, but I find myself more intrigued by this code in the lock notification report …

**st/zwave/defaults/lock.lua**

```lua
          local lock_codes = device:get_field(constants.LOCK_CODES)

```

\>8 – Snip a bit – \>8

```lua
          local code_name = lock_codes[code_id] == nil and lock_codes[code_id] or "Code " .. code_id
          event["data"] = { codeId = code_id, codeName = code_name, method = event["data"].method}

```

I can’t get my head around how that code could be right. I want it to say `~= nil`.

As it stands I see:

If the slot doesn’t have a name then use the name which it doesn’t have, but as it doesn’t have one use ‘Code x’.  
If the slot does have a name then use ‘Code x’.

---

_[View the full topic](https://community.smartthings.com/t/correct-z-wave-lock-api-command/171573)._
