def FromLockID(lockID, username, password): """ Create a KevoLock from the ID of the lock Args: lockID: the UUID of the lock (str) username: your mykevo.com username (str) password: your mykevo.com password (str) Returns: A ready to use lock object (KevoLock) """ lock = KevoLock() lock.lockID = lockID lock.username = username lock.password = password lock.Refresh() return lock
def FromJSON(lockJSON, username, password): """ Create a KevoLock from the JSON metadata of the lock Args: lockJSON: the JSON data of the lock (dict) username: your mykevo.com username (str) password: your mykevo.com password (str) Returns: A ready to use lock object (KevoLock) """ lock = KevoLock() lock.username = username lock.password = password lock.data = lockJSON lock.lockID = lock.data["id"] lock.name = lock.data["name"] lock.state = lock.data["bolt_state"] return lock