buzz-me-in 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/homekit.js +12 -4
  2. package/package.json +1 -1
package/homekit.js CHANGED
@@ -766,14 +766,22 @@ function setOnHapSessionStarted(handler) {
766
766
  /**
767
767
  * Graceful shutdown: tear down streaming sessions and unpublish the
768
768
  * accessory so the mDNS advertisement does not linger after exit.
769
+ *
770
+ * MUST be unpublish(), never destroy(). Both tear down the HAP server and the
771
+ * mDNS advertiser, but destroy() additionally calls
772
+ * Accessory.cleanupAccessoryData(), which deletes AccessoryInfo,
773
+ * IdentifierCache and ControllerStorage from persist/ — i.e. it erases every
774
+ * HomeKit pairing. destroy() means "this accessory is gone for good"; a
775
+ * restart is not that. Using it here silently unpaired the accessory on every
776
+ * clean stop, restart and reboot.
769
777
  */
770
778
  function shutdown() {
771
779
  endHapSession();
772
780
  removeSdpDir();
773
- accessory.destroy().catch((error) => {
774
- logger.error('Failed to destroy HAP accessory during shutdown', {
775
- event: 'accessory-destroy-failed',
776
- reason: 'destroy-threw',
781
+ accessory.unpublish().catch((error) => {
782
+ logger.error('Failed to unpublish HAP accessory during shutdown', {
783
+ event: 'accessory-unpublish-failed',
784
+ reason: 'unpublish-threw',
777
785
  error,
778
786
  });
779
787
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "buzz-me-in",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "HomeKit-compatible apartment intercom via Twilio media streams",
5
5
  "main": "server.js",
6
6
  "bin": {