pyhomekit

Python interface to control HomeKit accessories.


Keywords
homekit, bluetooth, home, home-automation, python
License
MIT
Install
pip install pyhomekit==0.0.1.4

Documentation

PyHomeKit - HomeKit for Python

Author: Henri Dwyer
https://api.travis-ci.org/henridwyer/pyhomekit.png Latest Version Python Versions

PyHomeKit is a set of python libraries that let you control HomeKit compatible accessories, both BLE and HTTP.

For more information about HomeKit, see the Apple Developper HomeKit page.

Bluetooth Low Energy device compatibility is provided by bluepy, which uses bluez.

Important

PyHomeKit is currently in pre-alpha. Many features are not yet implemented or broken.

Getting Started

Usage

Connect to a HAP accessory view its HAP characteristics:

import pyhomekit

device_mac = "aa:aa:aa:aa:aa"
device = pyhomekit.ble.HapAccessory(mac=device_mac)
characteristics = device.discover_characteristics()

print(characteristics)

Interact with HAP characteristics:

# View the value of a characteristic
device.lock_target_state()
>>> 0

# Set the value of a characteristic
device.lock_target_state(value=1)

Installation

pyHomeKit is on Pypi, so you can pip install it:

pip install pyhomekit

If you want to install from source, clone the repository:

git clone git://github.com/henridwyer/pyhomekit.git
cd pyhomekit
pip install -r requirements.txt
pip install -e .

Then you can build the documentation:

make doc

And run the tests:

make tests

Requirements

pyHomeKit is only compatible with python 3.6 for the moment.