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 🙏

© 2024 – Pkg Stats / Ryan Hefner

homekit-code

v1.2.13

Published

Generate a pairing HomeKit QR code label or scannable tag to setup your HomeKit accessory.

Downloads

74

Readme

HomeKit Code

Generate a pairing HomeKit QR code label or scannable tag to setup your HomeKit accessory

npm version Documentation Maintenance License: MIT Conventional Commits semantic-release: angular Reliability Rating Maintainability Rating Security Rating

Usage - QR Code

npx homekit-code qrcode --category=switch --pairingCode=84131633 --setupId=3QYT

CLI

Usage: homekit-code qrcode [options]

Generate a scannable HomeKit QR Code label

Options:
      --version      Show version number  [boolean]
      --help         Show help  [boolean]
  -c, --category     Category of the HomeKit accessory, required for generating a QR Code  [choices: "airConditioner", "airport", "airPurifier", "appleTv", "bridge", "dehumidifier", "door", "doorLock", "fan", "faucet", "garage", "heater", "humidifier", "ipCamera", "lightbulb", "other", "outlet", "programmableSwitch", "rangeExtender", "securitySystem", "sensor", "showerHead", "speaker", "sprinkler", "switch", "targetController", "television", "thermostat", "videoDoorBell", "window", "windowCovering"] [default: "airConditioner"]
  -f, --flag         Flag how to connect to the HomeKit accessory. (1 = NFC; 2 = IP; 4 = BLE; 8 = Wireless Accessory Configuration (WAC)/Apples MFi)  [number] [default: 2]
  -n, --name         Name of the generated file  [string] [default: "homekit-qrcode"]
  -o, --output       Format of the generated file  [required] [choices: "svg", "png"] [default: "svg"]
  -p, --pairingCode  8 digits pairing code  [string] [required]
  -s, --setupId      Setup Id, required for generating a QR Code  [string] [default: ""]
  -z, --zoom         Zoom factor when the output is an image  [number] [default: 2]

Examples:
  # Generate a QR code for a HomeKit switch
  npx homekit-code qrcode --category=switch --pairingCode=84131633 --setupId=3QYT

  # Generate a QR code for a HomeKit switch as switch.png with an image zoom factor of 10
  npx homekit-code qrcode --category=switch --pairingCode=84131633 --setupId=3QYT --name=switch --output=png --zoom=10

  # Generate a QR code for a IP (2) + WAC (8) HomeKit switch
  npx homekit-code qrcode -c switch -f 10 -p 84131633 -s 3QYT

Output

homekit-qrcode

Usage - Tag

npx homekit-code tag --pairingCode=84131633

CLI

Usage: homekit-code tag [options]

Generate a scannable HomeKit tag label

Options:
      --version      Show version number  [boolean]
      --help         Show help  [boolean]
  -n, --name         Name of the generated file  [string] [default: "homekit-tag"]
  -o, --output       Format of the generated file  [required] [choices: "svg", "png"] [default: "svg"]
  -p, --pairingCode  8 digits pairing code  [string] [required]
  -z, --zoom         Zoom factor when the output is an image  [number] [default: 5]

Examples:
  # Generate a scannable tag for a HomeKit accessory
  npx homekit-code tag --pairingCode=84131633

  # Generate a scannable tag for a HomeKit accessory as switch.png with an image zoom factor of 10
  npx homekit-code tag --pairingCode=84131633 --name=switch --output=png --zoom=10

Output

homekit-tag


Local Development

Install Dependencies

npm install

Start Development Server

npm run start -- qrcode --category=switch --pairingCode=84131633 --setupId=3QYT

Test

npm test

Build

To build homekit-code for production, run:

npm run build

Afterwards the executable code is available under ./lib/.

cd lib
node index.js --category=switch --pairingCode=84131633 --setupId=3QYT

Repair

This command may be useful when obscure errors or issues are encountered. It removes and recreates dependencies of your project.

npm run repair

Release

Fully automated version management and package publishing via semantic-release. It bumps the version according to conventional commits, publishes the package to npm and release a new version to GitHub.

Automatic Release (GitHub Action) [Recommended]

Make sure that the secrets GITHUB_TOKEN and NPM_TOKEN are available in GitHub repository.

npm run release:ci

Manual Release

Make sure that the environment variables GITHUB_TOKEN and NPM_TOKEN are set or declared in .env and a productive build was previously created via npm run build.

npm run release

You can also test the release manually by running the following command:

npm run release:dry-run

FAQ

Will my HomeKit accessory be able to pair with the generated QR code?

The QR code is not the same as the pairing code, instead it consists of several parameters such as the category, a specific version and other parameters. This generated setup payload is the actual content of the QR code and can be generated with the HomeKit Accessory Simulator (HAS) as well.

qrcode

How do I find out the setup id of my HomeKit Accessory?

Scan the QR code with a QR scanner of your choice. You should get a text starting with X-HM://.... . The next 9 characters are the combination of the different parameters like the pairing code and the category. The remaining characters are the setup id.

X-HM://0081YCYEP3QYT ◄── Scanned Setup Payload

X-HM:// 008YCYEP 3QYT
  ▲        ▲      ▲
  │        │      └─── Setup ID
  │        └── Combination of Parameters (first 9 characters)
  └─ Starting Content

Author

Simon Golms

Show your support

Give a ⭐️ if this project helped you!

License

Copyright © 2022 Simon Golms. This project is MIT licensed.

Resources

  • https://github.com/maximkulkin/esp-homekit
  • https://developer.apple.com/documentation/homekit/hmaccessorycategory/accessory_category_types#overview
  • https://developer.apple.com/documentation/homekit/testing_your_app_with_the_homekit_accessory_simulator