aso824 / yeehack

Alternative way to control bluetooth Yeelock devices
Apache License 2.0
20 stars 2 forks source link

Logo

Yeehack

Simple way to control your Yeelock bluetooth device, without official app.

Installation

Note: you need to have Python 3.8+ and configured Bluetooth adapter.

  1. Pull the source code

  2. Activate virtualenv

    python3 -m venv venv source venv/bin/activate

  3. Install required packages

    pip install -r requirements.txt

Usage

Tip: run python3 yeehack.py --help to see all available options.

First, you need to acquire S/N and sign key for your lock(s). To do that, run:

python3 yeehack.py fetch

and follow instructions on the screen. You should get list of your locks.
Copy and store somewhere S/N and sign key.

Then you can interact with your lock using commands like:

python3 yeehack.py battery [S/N]
python3 yeehack.py do lock [S/N] [sign key]

Web server

You can also run a simple webserver to control any lock in range of your PC/RPi etc. This way, you can interact with your locks from Home Assistant, using NodeRED.

python3 yeehack.py server

Default port is 8080, add --port [PORT] to change.

Fetch info about lock (currently only battery state):

curl -XPOST http://localhost:8080/info -d '{"sn": "...", "timeout": "5"}'

Lock or unlock:

curl -XPOST http://localhost:8080/do -d '{"sn": "...", "sign_key": "...", "timeout": "5", "action": "unlock"}' 

Supported actions: lock, unlock, temp_unlock (unlock and lock after a while).
timeout is optional, default is 10 seconds.

Home Assistant integration

See https://github.com/codyc1515/hacs_yeelock to install a HACS integration that adds support for Yeelock to Home Assistant.

Development

See PROTOCOL.md for details and feel free to create a pull request with improvements.
Note: I don't plan to focus on this repo, because I'll try to create integration for Home Assistant.

Credits

License

The Apache License 2.0. Please see LICENSE for more information.