From 68577ce30fb8d412ff169f2b48d9d7cf125fd43a Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Wed, 25 May 2022 09:24:30 -0700 Subject: [PATCH] homekit: fixup settings groups --- plugins/homekit/src/hap-utils.ts | 4 +++- plugins/homekit/src/homekit-mixin.ts | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/homekit/src/hap-utils.ts b/plugins/homekit/src/hap-utils.ts index ebb81fc1b..b67fd3a5d 100644 --- a/plugins/homekit/src/hap-utils.ts +++ b/plugins/homekit/src/hap-utils.ts @@ -100,15 +100,17 @@ export function getRandomPort() { return Math.round(30000 + Math.random() * 20000); } -export function createHAPUsernameStorageSettingsDict(): StorageSettingsDict<'mac' | 'qrCode'> { +export function createHAPUsernameStorageSettingsDict(group?: string): StorageSettingsDict<'mac' | 'qrCode'> { return { qrCode: { + group, title: "Pairing QR Code", type: 'qrcode', readonly: true, description: "Scan with your iOS camera to pair this Scrypted with HomeKit.", }, mac: { + group, hide: true, title: "Username Override", persistedDefaultValue: createHAPUsername(), diff --git a/plugins/homekit/src/homekit-mixin.ts b/plugins/homekit/src/homekit-mixin.ts index 944018751..b6cade4c1 100644 --- a/plugins/homekit/src/homekit-mixin.ts +++ b/plugins/homekit/src/homekit-mixin.ts @@ -10,6 +10,7 @@ export const HOMEKIT_MIXIN = 'mixin:@scrypted/homekit'; export class HomekitMixin extends SettingsMixinDeviceBase { storageSettings = new StorageSettings(this, { standalone: { + group: 'HomeKit Pairing', title: 'Standalone Accessory Mode', description: 'Advertise this to HomeKit as a standalone accessory rather than through the Scrypted HomeKit bridge. Enabling this option will remove it from the bridge. The accessory will then need to be re-paired to HomeKit. The pairing code will be available after the HomeKit plugin has been reloaded.' + (this.interfaces.includes(ScryptedInterface.VideoCamera) @@ -20,8 +21,9 @@ export class HomekitMixin extends SettingsMixinDeviceBase { // todo: change this at some point. persistedDefaultValue: false, }, - ...createHAPUsernameStorageSettingsDict(), + ...createHAPUsernameStorageSettingsDict('HomeKit Pairing'), resetAccessory: { + group: 'HomeKit Pairing', title: 'Reset Pairing', description: 'Resetting the pairing will resync it to HomeKit as a new device. Bridged devices will automatically relink as a new device. Accessory devices must be manually removed from the Home app and re-paired. Enter RESET to reset the pairing.', placeholder: 'RESET', @@ -45,7 +47,6 @@ export class HomekitMixin extends SettingsMixinDeviceBase { this.storageSettings.settings.qrCode.hide = !this.storageSettings.values.standalone; } - alertReload() { log.a(`You must reload the HomeKit plugin for the changes to ${this.name} to take effect.`); }