Added homekit-decode.sh to the mix, and updated the readmes.

This commit is contained in:
Scott Garrett committed 2026-09-01 10:56:23 -04:00
1 parent 27ebf13f6f
commit 589ebaff46
3 files changed
+131 -12

No files matched your search

+7 -8
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
#
# homekit-decode.fixed.sh — corrected decoder for a HomeKit setup payload.
# homekit-decode.sh — decoder for a HomeKit setup payload.
#
# This is a fixed copy of homekit-decode.sh. It decodes using the *correct*
# HomeKit bit layout (the one composeSetupUri in the homekit-code package
# actually encodes), instead of the misaligned bit positions in the original.
# It decodes using the *correct* HomeKit bit layout (the one composeSetupUri in
# the homekit-code package actually encodes), instead of the misaligned bit
# positions an earlier version used.
#
# Correct layout, least-significant bit first:
# bits 0-26 pin (27 bits)
@@ -13,7 +13,7 @@
# bits 39-42 reserved (4 bits)
# bits 43-45 version (3 bits)
#
# Fixes vs homekit-decode.sh:
# Fixes vs the earlier version:
# - categoryId was (val >> 27) & 0xFF, which mixed in the flag field; the
# categoryId field starts at bit 31, so it is now (val >> 31) & 0xFF.
# - The original "IP/BLE/Thread" flags read bits 35/36/37, which live inside
@@ -25,9 +25,8 @@
# - the category id is resolved to its HAP name (e.g. 8 -> "Switch"); ids not
# in the known table print as "unknown".
#
# Usage: ./homekit-decode.fixed.sh [PAYLOAD]
# Defaults to the demo payload "005KEOUCE" when no argument is given, matching
# the original so the two scripts decode the same thing by default.
# Usage: ./homekit-decode.sh [PAYLOAD]
# Defaults to the demo payload "005KEOUCE" when no argument is given.
# The output also prints the setup id and a reconstructed "X-HM://" payload
# rebuilt from the decoded fields: a complete record for recreating the barcode.