Skip to main content

Async Python client for the Sifely Smart Lock Cloud API

Project description

pysifely

Async Python client for the Sifely Smart Lock Cloud API.

Installation

pip install pysifely

Quick start

import asyncio
import aiohttp
from pysifely import SifelyApiClient, DEFAULT_BASE_URL

async def main():
    async with aiohttp.ClientSession() as session:
        # Login
        creds = await SifelyApiClient.login(
            base_url=DEFAULT_BASE_URL,
            username="your@email.com",
            password_md5=SifelyApiClient.md5_password("yourpassword"),
            client_id="home_assistant",
            session=session,
        )

        client = SifelyApiClient(
            base_url=DEFAULT_BASE_URL,
            access_token=creds["access_token"],
            session=session,
            refresh_token=creds["refresh_token"],
        )

        locks = await client.get_locks()
        for lock in locks:
            print(lock["lockId"], lock.get("lockAlias"))

asyncio.run(main())

API reference

SifelyApiClient

Method Description
login(base_url, username, password_md5, client_id, session) Classmethod — authenticate and return tokens
get_locks() List all locks on the account
get_lock_detail(lock_id) Detailed info (firmware, battery, …)
get_lock_state(lock_id) Current open/closed state
unlock(lock_id) Remote unlock
lock(lock_id) Remote lock
list_passcodes(lock_id) List keyboard passcodes
add_passcode(lock_id, ...) Add a passcode
delete_passcode(lock_id, keyboard_pwd_id) Delete a passcode

Exceptions

  • SifelyApiError — general API error
  • SifelyAuthError(SifelyApiError) — authentication failure (bad credentials or expired token)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysifely-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysifely-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file pysifely-0.1.0.tar.gz.

File metadata

  • Download URL: pysifely-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pysifely-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7e301ea1a91e2015d78ff1e598f20b2b1895a3f12044f56c810a1dfa5d85d00b
MD5 7de343392cb93f62df2661cef96c1675
BLAKE2b-256 4dc45400d30dfa7def42915d442977053c2b8a29ace75791d41b7c1d7b4062fe

See more details on using hashes here.

File details

Details for the file pysifely-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysifely-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pysifely-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4602cd6ebb1318d4b62806a2db32c2f766b111b673686d9ab19dfffe2ecb81bc
MD5 52e1b35112f45256f67b9a2b8a92034a
BLAKE2b-256 c336cf1453a563daf5ba5613dc94b6a2d90d169f67a64ff50801ac6b3456dd7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page