Giter Club home page Giter Club logo

pykevoplus's Introduction

pykevoplus

Python module for controlling Kwikset Kevo locks

Kwikset does not provide an official API for their Kevo locks; I reverse engineered this module from the mykevo.com web app.

To use this module you will need to have a Kevo Plus installed and a registered account on mykevo.com. You will need your mykevo.com credentials to use this module.

This module is published to pypi so you can install it simply via pip install pykevoplus

It supports Python 2.7 & 3.x.

Usage

The Kevo.GetLocks() function will attempt to scrape the mykevo.com web site to find your locks; as of this writing it can find all of your locks, but scraping the HTML might break at any time if Kwikset changes the website.

from pykevoplus import Kevo
locks = Kevo.GetLocks("[email protected]", "password123")
for lock in locks:
    print(repr(lock))

Output:

KevoLock(name=Front Door, id=cca7cd1d-c1d5-43ce-a087-c73b974b3529, state=Locked)
KevoLock(name=Back Door, id=c60130cd-8139-4688-8ba3-199276a65ad6, state=Locked)

A better way is to explicitly instantiate a KevoLock object using the UUID of the lock. You can get the lock IDs manually by logging into mykevo.com, click Details for the lock, click Settings, the lock ID is on the right.

from pykevoplus import KevoLock
lock = KevoLock.FromLockID("cca7cd1d-c1d5-43ce-a087-c73b974b3529", "[email protected]", "password123")

Locking and Unlocking

from pykevoplus import KevoLock
lock = KevoLock.FromLockID(lock_id, username, password)
lock.Unlock()
print lock.GetBoltState()
lock.Lock()
print lock.GetBoltState()

Output:

Unlocked
Locked

Multiple operations in the same session

The KevoLockSession context manager allows you to perform multiple operations on a lock with a single auth session

from pykevoplus import KevoLock, KevoLockSession
lock = KevoLock.FromLockID(lock_id, username, password)
with KevoLockSession(lock):
    lock.Unlock()
    lock.Lock()

Known Issues

  • Error handling is extremely basic and needs much more work. Communication errors as well as lock bolt errors need to be addressed
  • No unit tests yet

pykevoplus's People

Contributors

cseelye avatar dependabot[bot] avatar jsetton avatar

Watchers

 avatar

Forkers

laurentrivard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.