kormax / apple-home-key-reader

Apple Home Key Reader Implementation
Apache License 2.0
557 stars 45 forks source link
aliro apple apple-home-key copernicus copernicus-home ecp enhanced-contactless-polling express-mode iso18013 nfc pta unified-access unified-access-home

Apple Home Key Reader

![Home Key on an iPhone with PN532] ![Home Key on an Apple Watch with PN532] ![Home Key on an Apple Watch with ACR122U]

Overview

This project offers a demonstration of an Apple Home Key Reader built in Python. It includes:

It's intended for makers and developers interested in building practical and user-friendly applications using this example.
Feel free to give it a try! :)

Requirements

Running this project requires the following:

When using a PC, connect the PN532 to a UART adapter, and then connect the adapter to the PC as follows:

![Connecting PN532]

Installation & running

Code has been tested using Python 3.9, 3.10, 3.11 on macOS and Linux. Windows support status is unknown.
Other OS + Python version combos were not verified but may still work.

  1. (Optionally). Create and activate a venv:

    python3 -m venv ./venv
    
    source ./venv/bin/activate
  2. Install dependencies:
    python3 -m pip install -r requirements.txt
  3. Configure the application via the text editor of choice:

    nano configuration.json 

    3.1. Find NFC device port:

    # linux
    ls /dev/*
    
    # macOS
    ls /dev/tty.*

    3.2. Copy the port without the tty. part, insert it into port field;
    3.3. If you don't use a PN532, set broadcast to false and driver to appropriate value, otherwise leave as is.

  4. Run application:
    python3 main.py

Configuration

Configuration is done via a JSON file configuration.json, with the following 4 blocks configurable:

Project structure

Project is split into following primary modules:

Other modules:

Two files will be created as the result of you running the application, assuming no settings were changed:

Terminology

Contributing

The project is quite far from ideal since most of the codebase remains unchanged from my original local project, which was primarily utilized during the reverse-engineering phase.

As a result, there are numerous opportunities for enhancement:

In case you're planning on tackling one of those, feel free to raise an issue to discuss potential solution and approach.

Codebase is formatted with default black and isort configurations, linted with pylint.
Before making a contribution, verify that they were used for best code diffs and quality;

Notes

Credits

This project would have been impossible without the contributions of:

Special thanks to:

References