Skip to main content

Interact with Yale systems

Project description

Yale Client

Yale client is a python client for interacting with the Yale APIs.

This project is largely taken from https://github.com/domwillcode/yale-smart-alarm-client

There exists a cli and programming interface to interact with the yale apis.

Supported functions:

  • alarm api:
    • Arm full (away)
    • Arm partial (away/night)
    • Disarm
    • Get alarm status
  • lock api
    • get status
    • lock
    • unlock

Python version

Tested with the following python versions

  • Python 3.7
  • Python 3.6

CLI

The cli can be used as a standalone python program. Just instsall the client as you usually would by doing a pip install:

pip install yaleclient

The cli optionally reads these variables from envrionment, so you do not have to specify them as arguments.

  • YALE_USERNAME
  • YALE_PASSWORD
  • LOCK_PIN_CODE

Usage

> export YALE_USERNAME=foo
> export YALE_PASSWORD=bar
> export LOCK_PIN_CODE=123456

> yaleclient --api=LOCK --operation=STATUS --lock_id=mydoor
mydoor [YaleLockState.LOCKED]

> yaleclient --api=LOCK --operation=STATUS
mydoor [YaleLockState.LOCKED]
mydoor2 [YaleLockState.LOCKED]

> yaleclient --api=LOCK --operation=OPEN
mydoor [YaleLockState.OPEN]
mydoor2 [YaleLockState.OPEN]

> yaleclient --api=LOCK --operation=CLOSE
mydoor [YaleLockState.LOCKED]
mydoor2 [YaleLockState.LOCKED]

> yaleclient --api=LOCK --help
> yaleclient --api=ALARM --help

Programming api

Usage

Create a client with:

from yaleclient import YaleClient
client = YaleClient(username="", password="")

where username and password are your Yale credentials.

Locks

Iterate the connected locks

for lock in client.lock_api.locks():
    print(lock)

lock a single lock

lock = client.lock_api.get(name="myfrontdoor"):
lock.close()

unlock:

lock = client.lock_api.get(name="myfrontdoor"):
lock.open(pin_code="1234566")

Alarm

Change the alarm state with:

client.alarm_api.arm_full()
client.alarm_api.arm_partial()
client.alarm_api.disarm()

or

client.alarm.set_alarm_state(<mode>)

where 'mode' is one of:

from yaleclient.alarm import (YALE_STATE_ARM_PARTIAL,
                              YALE_STATE_DISARM,
                              YALE_STATE_ARM_FULL)

Is the alarm armed fully or partially:

client.alarm_api.is_armed() # == True

or return alarm status. eg.

client.alarm_api.get_armed_status() is YALE_STATE_ARM_FULL

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

yaleclient-0.2.2.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distributions

yaleclient-0.2.2-py3.7.egg (17.1 kB view hashes)

Uploaded Source

yaleclient-0.2.2-py3-none-any.whl (13.7 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