{"id":17527112,"url":"https://github.com/SimonGolms/homekit-code","last_synced_at":"2025-03-06T06:31:38.452Z","repository":{"id":57266359,"uuid":"451975019","full_name":"SimonGolms/homekit-code","owner":"SimonGolms","description":"Generate a pairing HomeKit QR code label or scannable tag to setup your HomeKit accessory from the command line","archived":false,"fork":false,"pushed_at":"2024-04-03T15:33:51.000Z","size":2901,"stargazers_count":74,"open_issues_count":2,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-30T11:45:39.169Z","etag":null,"topics":["apple","esp32","esp8266","homebridge","homekit","homekit-accessory","pairing","qrcode"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SimonGolms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-25T17:26:44.000Z","updated_at":"2024-12-27T22:53:04.000Z","dependencies_parsed_at":"2024-02-20T20:48:32.377Z","dependency_job_id":"ffe9c204-9463-49e8-806f-15b552b1406a","html_url":"https://github.com/SimonGolms/homekit-code","commit_stats":{"total_commits":112,"total_committers":3,"mean_commits":"37.333333333333336","dds":0.2053571428571429,"last_synced_commit":"cf25920f5b99126f2c0ff9a5e15f4f826cb795c1"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonGolms%2Fhomekit-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonGolms%2Fhomekit-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonGolms%2Fhomekit-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimonGolms%2Fhomekit-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SimonGolms","download_url":"https://codeload.github.com/SimonGolms/homekit-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242161812,"owners_count":20081947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple","esp32","esp8266","homebridge","homekit","homekit-accessory","pairing","qrcode"],"created_at":"2024-10-20T15:03:10.774Z","updated_at":"2025-03-06T06:31:38.153Z","avatar_url":"https://github.com/SimonGolms.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# HomeKit Code\n\nGenerate a pairing HomeKit QR code label or scannable tag to setup your HomeKit accessory\n\n[![npm version](https://img.shields.io/npm/v/homekit-code.svg)](https://www.npmjs.com/package/homekit-code)\n[![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](https://github.com/simongolms/homekit-code#readme)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/simongolms/homekit-code/graphs/commit-activity)\n[![License: MIT](https://img.shields.io/github/license/simongolms/homekit-code)](https://github.com/simongolms/homekit-code/blob/master/LICENSE)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=SimonGolms_homekit-code\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=SimonGolms_homekit-code)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=SimonGolms_homekit-code\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=SimonGolms_homekit-code)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=SimonGolms_homekit-code\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=SimonGolms_homekit-code)\n\n## Usage - QR Code\n\n```sh\nnpx homekit-code qrcode --category=switch --pairingCode=84131633 --setupId=3QYT\n```\n\n### CLI\n\n```txt\nUsage: homekit-code qrcode [options]\n\nGenerate a scannable HomeKit QR Code label\n\nOptions:\n      --version      Show version number  [boolean]\n      --help         Show help  [boolean]\n  -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\"]\n  -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  -n, --name         Name of the generated file  [string] [default: \"homekit-qrcode\"]\n  -o, --output       Format of the generated file  [required] [choices: \"svg\", \"png\"] [default: \"svg\"]\n  -p, --pairingCode  8 digits pairing code  [string] [required]\n  -s, --setupId      Setup Id, required for generating a QR Code  [string] [default: \"\"]\n  -z, --zoom         Zoom factor when the output is an image  [number] [default: 2]\n\nExamples:\n  # Generate a QR code for a HomeKit switch\n  npx homekit-code qrcode --category=switch --pairingCode=84131633 --setupId=3QYT\n\n  # Generate a QR code for a HomeKit switch as switch.png with an image zoom factor of 10\n  npx homekit-code qrcode --category=switch --pairingCode=84131633 --setupId=3QYT --name=switch --output=png --zoom=10\n\n  # Generate a QR code for a IP (2) + WAC (8) HomeKit switch\n  npx homekit-code qrcode -c switch -f 10 -p 84131633 -s 3QYT\n```\n\n### Output\n\n![homekit-qrcode](./docs/homekit-qrcode.png)\n\n## Usage - Tag\n\n```sh\nnpx homekit-code tag --pairingCode=84131633\n```\n\n### CLI\n\n```txt\nUsage: homekit-code tag [options]\n\nGenerate a scannable HomeKit tag label\n\nOptions:\n      --version      Show version number  [boolean]\n      --help         Show help  [boolean]\n  -n, --name         Name of the generated file  [string] [default: \"homekit-tag\"]\n  -o, --output       Format of the generated file  [required] [choices: \"svg\", \"png\"] [default: \"svg\"]\n  -p, --pairingCode  8 digits pairing code  [string] [required]\n  -z, --zoom         Zoom factor when the output is an image  [number] [default: 5]\n\nExamples:\n  # Generate a scannable tag for a HomeKit accessory\n  npx homekit-code tag --pairingCode=84131633\n\n  # Generate a scannable tag for a HomeKit accessory as switch.png with an image zoom factor of 10\n  npx homekit-code tag --pairingCode=84131633 --name=switch --output=png --zoom=10\n```\n\n### Output\n\n![homekit-tag](./docs/homekit-tag.png)\n\n---\n\n## Local Development\n\n### Install Dependencies\n\n```sh\nnpm install\n```\n\n### Start Development Server\n\n```sh\nnpm run start -- qrcode --category=switch --pairingCode=84131633 --setupId=3QYT\n```\n\n### Test\n\n```sh\nnpm test\n```\n\n### Build\n\nTo build `homekit-code` for production, run:\n\n```sh\nnpm run build\n```\n\nAfterwards the executable code is available under `./lib/`.\n\n```sh\ncd lib\nnode index.js --category=switch --pairingCode=84131633 --setupId=3QYT\n```\n\n### Repair\n\nThis command may be useful when obscure errors or issues are encountered. It removes and recreates dependencies of your project.\n\n```sh\nnpm run repair\n```\n\n### Release\n\nFully automated version management and package publishing via [semantic-release](https://github.com/semantic-release). It bumps the version according to conventional commits, publishes the package to npm and release a new version to GitHub.\n\n#### Automatic Release (GitHub Action) [Recommended]\n\nMake sure that the secrets `GITHUB_TOKEN` and `NPM_TOKEN` are available in GitHub repository.\n\n```sh\nnpm run release:ci\n```\n\n#### Manual Release\n\nMake 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`.\n\n```sh\nnpm run release\n```\n\nYou can also test the release manually by running the following command:\n\n```sh\nnpm run release:dry-run\n```\n\n---\n\n## FAQ\n\n### Will my HomeKit accessory be able to pair with the generated QR code?\n\nThe 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.\nThis generated setup payload is the actual content of the QR code and can be generated with the [HomeKit Accessory Simulator (HAS)](https://developer.apple.com/documentation/homekit/testing_your_app_with_the_homekit_accessory_simulator) as well.\n\n![qrcode](./docs/apple-homekit-accessory-simulator.png)\n\n### How do I find out the setup id of my HomeKit Accessory?\n\nScan 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.\n\n```txt\nX-HM://0081YCYEP3QYT ◄── Scanned Setup Payload\n\nX-HM:// 0081YCYEP 3QYT\n  ▲        ▲      ▲\n  │        │      └─── Setup ID\n  │        └── Combination of Parameters (first 9 characters)\n  └─ Starting Content\n```\n\n## Author\n\n**Simon Golms**\n\n- Digital Card: `npx simongolms`\n- Github: [@SimonGolms](https://github.com/SimonGolms)\n- Website: [gol.ms](https://gol.ms)\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n## License\n\nCopyright © 2022 [Simon Golms](https://github.com/simongolms).\u003cbr /\u003e\nThis project is [MIT](https://github.com/simongolms/homekit-code/blob/master/LICENSE) licensed.\n\n## Resources\n\n- https://github.com/maximkulkin/esp-homekit\n- https://developer.apple.com/documentation/homekit/hmaccessorycategory/accessory_category_types#overview\n- https://developer.apple.com/documentation/homekit/testing_your_app_with_the_homekit_accessory_simulator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSimonGolms%2Fhomekit-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSimonGolms%2Fhomekit-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSimonGolms%2Fhomekit-code/lists"}