Skip to main content

Python interface for Kwikset Halo API

Project description

aiokwikset - Python interface for the Kwikset Halo API

Python library for communicating with the Kwikset Halo Devices via the Kwikset Halo cloud API.

WARNING

  • This library only works if you have signed up for and created a home/had a home shared with you from the Kwikset Application.
  • IOS
  • Android

NOTE:

  • This library is community supported, please submit changes and improvements.
  • This is a very basic interface, not well thought out at this point, but works for the use cases that initially prompted spitting this out from.

Supports

  • locking/unlocking
  • retrieving basic information

Installation

pip install aiokwikset

Examples

import asyncio

from aiohttp import ClientSession

from aiokwikset import async_get_api


async def main() -> None:
    """Run!"""
    api = await async_get_api("<EMAIL>", "<PASSWORD>")

    # Get user account information:
    user_info = await api.user.get_info()

    # Get home/homes information
    homes_info = await api.user.get_homes()

    # Get devices information
    devices = await api.device.get_devices(homes_info['homeid'])

    # Get a device specific information
    device_info = await api.device.get_device_info(devices['data'][0]['deviceid'])

    # Lock the specific device
    lock = await api.device.lock_device(devices['data'][0], user_info)


asyncio.run(main())

By default, the library creates a new connection to Kwikset with each coroutine. If you are calling a large number of coroutines (or merely want to squeeze out every second of runtime savings possible), an aiohttp ClientSession can be used for connection pooling:

import asyncio

from aiohttp import ClientSession

from aiokwikset import async_get_api


async def main() -> None:
    """Create the aiohttp session and run the example."""
    async with ClientSession() as websession:
        api = await async_get_api("<EMAIL>", "<PASSWORD>", session=websession)

    # Get user account information:
    user_info = await api.user.get_info()

    # Get home/homes information
    homes_info = await api.user.get_homes()

    # Get devices information
    devices = await api.device.get_devices(homes_info['homeid'])

    # Get a device specific information
    device_info = await api.device.get_device_info(devices['data'][0]['deviceid'])

    # Lock the specific device
    lock = await api.device.lock_device(devices['data'][0], user_info)


asyncio.run(main())

Known Issues

  • not all APIs supported

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

aiokwikset-0.0.2.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distribution

aiokwikset-0.0.2-py3-none-any.whl (19.6 kB view hashes)

Uploaded Python 3

Supported by

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