npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

homebridge-ttlock-accesscode

v2.3.0

Published

Plugin that uses TTLock Cloud API to communicate with TTLock Devices connected to the G2 Gateway.

Readme

Homebridge TTLock Access Code Plug-In

This is a Homebridge plug-in based for integrating TTLock smart locks with the TTLock Cloud API.

This plug-in lets you control TTLock locks in the Apple Home app with lock/unlock status, control, and access code management if supported.

Requirements

  • Homebridge Supported Versions: 1.11.2 or later, including Homebridge 2.x.
  • Node.js Supported Versions: 22 and 24.
  • TTLock Smart Lock.
  • TTLock Gateway for non-Wi-Fi locks.
  • Remote Unlock enabled in the TTLock mobile app.
  • TTLock Open API account with an approved OAUTH2.0 App.

Current Supported and Tested Devices

  • I have tested this plug-in with a G2 Gateway setup and TTLock lock access code features in Apple Home. More lock models and gateway setups are expected to work, but may vary by TTLock firmware and account setup.

Features

  • Get the status of your TTLock devices.
  • Lock and unlock your TTLock devices.
  • Manage passcodes for your TTLock devices in Apple Home.
  • Expose optional manual doors from IKEA DIRIGERA open/close sensors.
  • Block linked TTLock lock/unlock commands when a manual door is open or unavailable.
  • Automatic API usage protection with adaptive polling.
  • Periodic discovery and offline recovery handling.

Installation

  • Install from the Homebridge UI or with npm.
  • After installing, configure your TTLock credentials and API App values in the Homebridge UI, then restart Homebridge.
npm install -g homebridge-ttlock-accesscode

Configuration Notes

  • Create an account in the TTLock Cloud API
  • Create your OAUTH2.0 App, approval may take a few days.
  • Use your TTLock mobile app username/password and OAUTH2.0 App client_id and client_secret in the plugin settings.
  • For non-Wi-Fi locks, make sure your gateway is online and near the lock.
  • The default settings are tuned for TTLock's monthly API limits.
  • Polling is automatically slowed when monthly allowance gets lower.
  • Manual door DIRIGERA polling is local to the hub and does not count against TTLock API usage.
  • The Homebridge UI can test TTLock credentials, discover TTLock locks, pair DIRIGERA hubs, and list supported sensors.

Access Code Notes

  • Access code support is exposed through the Apple Home App.
  • Existing passcodes are loaded from TTLock and mapped into the Apple Home App.
  • Add/Delete/List/Read flows are handled through the Apple Home App.

Manual Door Notes

  • Manual doors are optional and are configured under externalDoors.
  • Only IKEA DIRIGERA open/close sensors are supported at this time.
  • Add paired DIRIGERA hubs under externalDoors.hubs.
  • Add HomeKit doors under externalDoors.doors.
  • Remove a hub or door when you no longer want those manual door accessories exposed.
  • Door accessory IDs are generated from externalDoors.doors[].name. Renaming a door creates a new HomeKit door accessory and removes the old cached one.
  • The DIRIGERA open/close sensor is not exposed as a separate HomeKit contact sensor. The plugin exposes a HomeKit Door service only.
  • Manual doors cannot be opened or closed from HomeKit. HomeKit door position follows the DIRIGERA sensor state.
  • Each manual door requires sensor, set to the DIRIGERA open/close sensor ID, and lock, set to the TTLock device_id/lock ID protected by that door.
  • In the Homebridge UI, use the discovered TTLock lock list when linking a manual door.
  • When a linked manual door is open, unknown, or unavailable, lock and unlock commands for that TTLock lock are ignored.

Example Configuration

{
  "bridge": {
    "name": "Homebridge",
    "username": "11:22:33:AA:BB:CC",
    "port": 12345,
    "pin": "001-02-003"
  },
  "description": "This is an example configuration file.",
  "platforms": [
    {
      "platform": "TTLockAccessCode",
      "name": "TTLockAccessCode",
      "clientId": "YourClientID",
      "clientSecret": "YourClientSecret",
      "username": "YourUsername",
      "password": "YourPassword",
      "totalApiCallsPerMonth": 30000,
      "pollingInterval": 300,
      "discoveryPollingInterval": 12,
      "offlineInterval": 7,
      "waitTimeUpdate": 100,
      "externalDoors": {
        "doorPollingInterval": 60,
        "hubs": [
          {
            "ip": "192.168.1.50",
            "accessToken": "DIRIGERA_ACCESS_TOKEN"
          }
        ],
        "doors": [
          {
            "name": "Front Door",
            "sensor": "IKEA_CONTACT_SENSOR_ID",
            "lock": "TTLOCK_LOCK_ID"
          }
        ]
      }
    }
  ],
  "accessories": []
}

Known Limitations

  • Apple HomeKey is not supported by TTLock readers.
  • Gateway-dependent locks will return gateway-offline conditions if the gateway is unavailable.
  • TTLock Cloud API limits and behavior can change without notice.