Home Assistant integration for TTLock locks
  • Python 99.8%
  • Shell 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jonas Bergler d76b5e959e
Merge pull request #332 from thanoskas/feat/m2-ble-read
ble: read lock state locally over GATT, cloud as fallback
2026-09-04 16:33:20 +12:00
.github Exclude test code from coverage measurement 2026-07-25 05:53:27 +00:00
.vscode add some tests for auto unlock/passage mode filtering 2023-04-23 08:33:40 +00:00
custom_components Merge pull request #332 from thanoskas/feat/m2-ble-read 2026-09-04 16:33:20 +12:00
docs Move the webhook setup prompt from a persistent notification to a repair issue 2026-07-25 14:39:01 +12:00
script Harden pytest config and add script/ dev-loop wrappers 2026-07-19 11:23:06 +12:00
tests ble: read lock state locally over GATT, cloud as fallback 2026-09-02 14:55:04 +03:00
.gitignore ignore file 2023-04-01 19:52:22 +00:00
.pre-commit-config.yaml Exclude vendored doc mirror from codespell 2026-07-19 01:25:19 +00:00
CLAUDE.md Address review: prefer vendored TTLock docs, drop redundant Implement entry 2026-07-25 10:58:52 +12:00
CONTEXT.md Record shared-webhook-per-application decision for issue #70 2026-07-25 13:34:35 +12:00
hacs.json configure releases in hacs.json 2023-04-02 00:32:31 +00:00
LICENSE Add MIT LICENSE 2026-07-19 10:57:13 +12:00
pyproject.toml Reduce TTLock cloud API usage with tiered, configurable polling 2026-08-23 16:07:00 +12:00
README.md Move the webhook setup prompt from a persistent notification to a repair issue 2026-07-25 14:39:01 +12:00
uv.lock Migrate type checking from mypy to Astral's ty 2026-07-19 10:37:06 +12:00

hass-ttlock

Home Assistant integration for TTLock based locks.

Overview

This integration uses the TTLock Cloud to communicate with your lock. It supports the following features:

  • Locking and unlocking
  • Discovery of locks on startup
  • Real-time updates via a webhook (no periodic polling which wastes battery)
  • Additional sensors for battery, last operator + reason
  • Add new pass codes
  • Delete expired pass codes
  • List passcodes
  • List records history (lock, unlock etc)

Known working locks

If this integration is working for you, please leave a comment here

Usage

Requirements

  1. A TTLock based smart lock
  2. A Gateway (if your lock doesn't have integrated wifi)
    • These can be purchased from the vendor of your lock or direct from Aliexpress
  3. Remote unlock must be enabled for each lock
    • This must be done while in bluetooth range of the lock, from the mobile app
    • Here is a youtube video which explains the process

Creating an OAuth APP

  1. Go to https://open.ttlock.com/manager and create an account
  2. Register an application (this will take a few days to get approved)
  3. Install the extension via HACS and restart Home Assistant
  4. Setup the integration via Home Assistant UI
    • The first credentials you will be prompted for are the Application Client ID & Secret that you created earlier.
    • The second credentials you will be prompted for are the username/password you use to login to the ttlock app on your phone.
  5. Once the integration is working you should see a repair notice under Settings > Repairs with the webhook url
    • Go back to https://open.ttlock.com/manager
    • Select your application, and edit the "callback url". Enter the webhook url from the repair notice
    • Test by unlocking your door
    • If the event data was received by home assistant the repair notice will resolve itself, indicating that everything is working.

Troubleshooting

Common issues

  1. Invalid client_id
    • Your Application (ie oauth) Client ID & Client Secret for the application you created on open.ttlock.com.
    • These are stored in the "Application Credentials" feature of Home Assistant. If you need to remove/update them, please follow the official docs
    • If you get this error, you need to remove the invalid credentials and re-setup the integration with the correct ones.
  2. Invalid username or password
    • The username/password for open.ttlock.com is only used for managing API credentials for the ttlock cloud - do not use these within home assistant.
    • The username/password for the ttlock (or 3rd party branded) mobile app. This is the account that will work.
  3. "Failed to execute the action lock/lock." or "The function is not supported for this lock"
    • This is most likely because you haven't enabled remote unlock, please follow the instructions in the requirements section.
  4. Entities are unavailable and debug logs show hasGateway: 0
    • TTLock cloud can occasionally lose the gateway association for a lock.
    • First, reboot your TTLock gateway/hub (for example, G2) and re-check the integration.
    • If that does not fix it, remove and re-add the lock in the TTLock app.

Reporting issues

When reporting issues, please attach the diagnostic information and consider enabling debug logging to provide extra information.

Development

You can find all the TTLock API calls here https://euopen.ttlock.com/document

Say thanks

If you found this helpful and you'd like to say thanks you can do so via buy me a coffee or a beer. I've put a bunch of time into this integration and it always puts a smile on my face when people say thanks!