Skip to content

Commit

Permalink
Merge pull request #208 from dknowles2/comment
Browse files Browse the repository at this point in the history
Clarify a comment
  • Loading branch information
dknowles2 authored Nov 25, 2024
2 parents b1c0ef9 + c893272 commit 17eca14
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pyschlage/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,8 @@ def save(self):
command = "updateaccesscode" if self.access_code_id else "addaccesscode"
resp = self._device.send_command(command, self.to_json())

# Either `{ "accesscodeId": "XXX" }` appears to be returned on `addaccesscode`;
# otherwise {} is returned when updated.
# Thus, calling `self._update_with()` does now work here as it calls
# `from_json()` which currently requires the presence other parameters.
# NOTE: We don't call self._update_with() here because the API only returns
# the accesscodeId field.
resp_json = resp.json()
if "accesscodeId" in resp_json:
self.access_code_id = resp_json["accesscodeId"]
Expand Down

0 comments on commit 17eca14

Please sign in to comment.