Skip to main content

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()

Asynchronous usage

pyschlage.aio offers the same functionality to callers running inside an event loop. Its models are immutable snapshots and the client makes every request, so a method that changes a lock returns an updated snapshot.

import pyschlage.aio

async with pyschlage.aio.connect("username", "password") as schlage:
    locks = await schlage.get_locks()
    print(locks[0].name)

    # A method that changes a lock returns an updated snapshot.
    locked = await schlage.set_locked(locks[0], True)
    print(locked.is_locked)

    # Access codes are managed through the client too.
    from pyschlage.aio import NewAccessCode

    guest = await schlage.add_access_code(
        locks[0], NewAccessCode(name="Guest", code="1234")
    )
    await schlage.delete_access_code(guest)

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

Metadata

Release files for pyschlage 2026.11.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyschlage 2026.11.2
File Size Uploaded Provenance Actions
pyschlage-2026.11.2.tar.gz 254.6 kB With provenance Details for pyschlage-2026.11.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyschlage 2026.11.2
File Interpreter ABI Platform Actions
pyschlage-2026.11.2-py3-none-any.whl Python 3 none any Details for pyschlage-2026.11.2-py3-none-any.whl

Total release size: 303.1 kB

Release files / pyschlage-2026.11.2.tar.gz

Download URL pyschlage-2026.11.2.tar.gz
Size 254.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a0076b6a5cd29fd7a37df19280e82e0a766a8644936a612e9ec979265038ecc5
BLAKE2b-256 checksum
How to use checksums
d5afe5e6311b53907c851abd4acee49c1305ca47b58687e359fa6343c8e5d4da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pyschlage-2026.11.2-py3-none-any.whl

Download URL pyschlage-2026.11.2-py3-none-any.whl
Size 48.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9726471caa2e393778df6ed12ecf7a5911eeee1f49f6d3d6ddc6746f9d05fea5
BLAKE2b-256 checksum
How to use checksums
36efef2d201fe49ee53a010e1011b84b75592c70ec5c737fbc58350f66364423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for pyschlage 2026.11.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyschlage-2026.11.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2026.11.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page