Skip to content

mrstegeman/homekit_python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HomeKit Python

With this code it is possible to implement a HomeKit Controller.

Limitations

  • This code only works with HomeKit IP Accessories. no Bluetooth LE Accessories (yet)!
  • No reaction to events whatsoever.

The code presented in this repository was created based on release R1 from 2017-06-07.

Installation

Use pip3 to install the package:

pip3 install --user homekit

HomeKit Controller

The following tools help to access HomeKit Accessories.

discover.py

This tool will list all available HomeKit IP Accessories within the local network.

Usage:

./discover.py

Output:

Name: smarthomebridge3._hap._tcp.local.
Url: http://192.168.178.21:51827
Configuration number (c#): 2
Feature Flags (ff): Paired (Flag: 0)
Device ID (id): 12:34:56:78:90:05
Model Name (md): Bridge
Protocol Version (pv): 1.0
State Number (s#): 1
Status Flags (sf): 0
Category Identifier (ci): Other (Id: 1)

identify.py

This tool will use the Identify Routine of a HomeKit IP Accessory.

Usage:

./identify.py -d ${DEVICEID}

Output:

Either identify succeeded. or identify failed followed by a reason (see table 5-12 page 80).

pair.py

This tool will perform a paring to a new accessory.

Usage:

./pair.py -d ${DEVICEID} -p ${SETUPCODE} -f ${PAIRINGDATAFILE}

The file with the pairing data will be required to for any additional commands to the accessory.

get_accessories.py

This tool will read the accessory attribute database.

Usage:

./get_accessories.py -f ${PAIRINGDATAFILE} [-o {json,compact}]

The option -o specifies the format of the output:

  • json displays the result as pretty printed JSON
  • compact reformats the output to get more on one screen

get_characteristics.py

This tool will read values from one or more characteristics.

Usage:

./get_characteristics.py -f ${PAIRINGDATAFILE} -c {Characteristics} [-m] [-p] [-t] [-e]

The option -c specifies the characteristics to read. The format is <aid>.<cid>[,<aid>.<cid>]*.

The option -m specifies if the meta data should be read as well.

The option -p specifies if the permissions should be read as well.

The option -t specifies if the type information should be read as well.

The option -e specifies if the event data should be read as well.

HomeKit Accessory

Tests

The code was tested with the following devices:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%