pyschlage
Python 3 library for interacting with Schlage Encode WiFi locks.
Note that this project has no official relationship with Schlage or Allegion. Use at your own risk.
Usage
Basic usage
from pyschlage import Auth, Schlage
# Create a Schlage object and authenticate with your credentials.
s = Schlage(Auth("username", "password"))
# List the locks attached to your account.
locks = s.locks()
# Print the name of the first lock
print(locks[0].name)
"My lock"
# Lock the first lock.
locks[0].lock()
Managing access codes
from pyschlage.code import AccessCode
lock = locks[0]
# Add a new access code to a lock.
guest_code = AccessCode(name="Guest", code="1234")
lock.add_access_code(guest_code)
# List the access codes currently on the lock.
lock.refresh_access_codes()
for access_code in lock.access_codes.values():
print(access_code.name, access_code.code)
# Remove an access code from the lock.
guest_code.delete()
Reading activity logs
# Fetch the 10 most recent log entries, newest first.
for log_entry in lock.logs(limit=10, sort_desc=True):
print(log_entry.created_at, log_entry.message)
Handling errors
All requests to the Schlage cloud service can raise
pyschlage.exceptions:
from pyschlage.exceptions import NotAuthorizedError, UnknownError
try:
locks = s.locks()
except NotAuthorizedError:
print("Invalid username or password.")
except UnknownError as ex:
print(f"Something went wrong: {ex}")
Installation
Pip
To install pyschlage, run this command in your terminal:
$ pip install pyschlage
Source code
Pyschlage is actively developed on Github, where the code is always available.
You can either clone the public repository:
$ git clone https://github.com/dknowles2/pyschlage
Or download the latest tarball:
$ curl -OL https://github.com/dknowles2/pyschlage/tarball/main
Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily:
$ cd pyschlage
$ python -m pip install .
Documentation
API reference can be found on Read the Docs
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyschlage-2026.8.0.tar.gz.
File metadata
- Download URL: pyschlage-2026.8.0.tar.gz
- Upload date:
- Size: 98.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a70f929d6ba2910080c586625a2048573d3bb9bfe7df35d106f24151d1315a61
|
|
| MD5 |
a178d6f102e8bcfbf185a636006a1960
|
|
| BLAKE2b-256 |
e4c6efadd7b20bc4be2cabe9f1cdc9421dacf6d83da1d81244ee1ed8df2220db
|
Provenance
The following attestation bundles were made for pyschlage-2026.8.0.tar.gz:
Publisher:
publish-python.yml on dknowles2/pyschlage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyschlage-2026.8.0.tar.gz -
Subject digest:
a70f929d6ba2910080c586625a2048573d3bb9bfe7df35d106f24151d1315a61 - Sigstore transparency entry: 2625721407
- Sigstore integration time:
-
Permalink:
dknowles2/pyschlage@7e40fea73df7b66e682b38f7545926b8ea5fcea4 -
Branch / Tag:
refs/tags/2026.8.0 - Owner: https://github.com/dknowles2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@7e40fea73df7b66e682b38f7545926b8ea5fcea4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyschlage-2026.8.0-py3-none-any.whl.
File metadata
- Download URL: pyschlage-2026.8.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c7146bc437848c63a0f579415a52902ce3506f2226f9f89cebc660e5829f16e
|
|
| MD5 |
dd707b9fef003adc16e78b7368dfd282
|
|
| BLAKE2b-256 |
2339eb53e8c9c0178403f73b9bc6bbbac438025bf626a179b3471f980d9d55f5
|
Provenance
The following attestation bundles were made for pyschlage-2026.8.0-py3-none-any.whl:
Publisher:
publish-python.yml on dknowles2/pyschlage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyschlage-2026.8.0-py3-none-any.whl -
Subject digest:
6c7146bc437848c63a0f579415a52902ce3506f2226f9f89cebc660e5829f16e - Sigstore transparency entry: 2625721415
- Sigstore integration time:
-
Permalink:
dknowles2/pyschlage@7e40fea73df7b66e682b38f7545926b8ea5fcea4 -
Branch / Tag:
refs/tags/2026.8.0 - Owner: https://github.com/dknowles2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@7e40fea73df7b66e682b38f7545926b8ea5fcea4 -
Trigger Event:
release
-
Statement type: