-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix adding/updating access codes. #203
Fix adding/updating access codes. #203
Conversation
…y value returned when updating/adding code.
Can you update the tests? |
Unit tests have been updated. I removed one assertion. I was unable to test the api being able to pick up any out-of-band updates. The response from the api was returning either A couple other call outs: I am unclear as to what "notification" even represents. In all of my codes, both configured to notify and not notify, all responses from the getaccesscodes has been 0. It appears when adding/updating an access code, it is under I am not fully up to speed on notifications within the API and left it untouched. In some cases in the app, the notificationId was included in the update/add POST command, but other times it was not. I am leaving this detail out of scope for this PR. I have tested this on my two locks which are |
pyschlage/code.py
Outdated
@@ -194,14 +194,14 @@ def from_json(cls, auth: Auth, device: Device, json: dict[str, Any]) -> AccessCo | |||
else: | |||
schedule = TemporarySchedule.from_json(json) | |||
|
|||
access_code_length = json.get("accessCodeLength") or 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be
json.get("accessCodeLength", 4)
(The second argument to get()
is the default value if the key is not in the dictionary)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thanks! |
Add accessCodeLength and notificationEnabled. accesscodeId is the only value returned when updating/adding code.