diff --git a/plugins/homekit/package-lock.json b/plugins/homekit/package-lock.json index b5d8e81d1..1e39327ed 100644 --- a/plugins/homekit/package-lock.json +++ b/plugins/homekit/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/homekit", - "version": "0.0.95", + "version": "0.0.96", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/homekit", - "version": "0.0.95", + "version": "0.0.96", "dependencies": { "hap-nodejs": "file:../HAP-NodeJS", "lodash": "^4.17.21", diff --git a/plugins/homekit/package.json b/plugins/homekit/package.json index 4269c5d58..ceaa82cb1 100644 --- a/plugins/homekit/package.json +++ b/plugins/homekit/package.json @@ -40,5 +40,5 @@ "@types/qrcode": "^1.4.1", "@types/url-parse": "^1.4.3" }, - "version": "0.0.95" + "version": "0.0.96" } diff --git a/plugins/homekit/src/main.ts b/plugins/homekit/src/main.ts index cf1c3fba5..d994a0950 100644 --- a/plugins/homekit/src/main.ts +++ b/plugins/homekit/src/main.ts @@ -10,6 +10,7 @@ import qrcode from 'qrcode'; import packageJson from "../package.json"; import { randomPinCode } from './pincode'; import { EventedHTTPServer } from '../HAP-NodeJS/src/lib/util/eventedhttp'; +import { AddressInfo } from 'net'; const { systemManager, deviceManager } = sdk; @@ -83,13 +84,15 @@ class HomeKit extends ScryptedDeviceBase implements MixinProvider, Settings, Hom getHomeKitHubs(): string[] { try { - return JSON.parse(this.storage.getItem('homekitHubs')); + return JSON.parse(this.storage.getItem('homekitHubs')); } catch (e) { } } async getSettings(): Promise { + const addresses = (Object.entries(os.networkInterfaces()).filter(([iface]) => iface.startsWith('en') || iface.startsWith('wlan')) as any) + .flat().map(([, entry]) => entry.address).filter((address: string) => address); return [ { title: "Manual Pairing Code", @@ -112,7 +115,9 @@ class HomeKit extends ScryptedDeviceBase implements MixinProvider, Settings, Hom title: 'Bridge Address', value: localStorage.getItem('addressOverride'), key: 'addressOverride', - description: 'Optional: The network address used by the Scrypted bridge. Set this to the wired address to prevent usage of wireless address.' + description: 'Optional: The network address used by the Scrypted bridge. Set this to the wired address to prevent usage of wireless address.', + choices: addresses, + combobox: true, }, { title: 'HomeKit Hubs',