diff --git a/CHANGELOG.md b/CHANGELOG.md index f5cc1938d..e9c27c0f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to `hap-nodejs` will be documented in this file. This projec ### Changed - Set `Avahi` as the default advertiser when available, otherwise fallback to `Ciao` +- Update HK definition files - Updated dependencies ### Homebridge Dependencies diff --git a/src/lib/Service.ts b/src/lib/Service.ts index 99987a2ec..9548883aa 100644 --- a/src/lib/Service.ts +++ b/src/lib/Service.ts @@ -21,7 +21,6 @@ import type { CameraRTPStreamManagement, CarbonDioxideSensor, CarbonMonoxideSensor, - CloudRelay, ContactSensor, DataStreamTransportManagement, Diagnostics, @@ -71,7 +70,6 @@ import type { Thermostat, ThreadTransport, TransferTransportManagement, - Tunnel, Valve, WiFiRouter, WiFiSatellite, @@ -235,10 +233,6 @@ export class Service extends EventEmitter { * @group Service Definitions */ public static CarbonMonoxideSensor: typeof CarbonMonoxideSensor; - /** - * @group Service Definitions - */ - public static CloudRelay: typeof CloudRelay; /** * @group Service Definitions */ @@ -435,10 +429,6 @@ export class Service extends EventEmitter { * @group Service Definitions */ public static TransferTransportManagement: typeof TransferTransportManagement; - /** - * @group Service Definitions - */ - public static Tunnel: typeof Tunnel; /** * @group Service Definitions */ diff --git a/src/lib/definitions/CharacteristicDefinitions.ts b/src/lib/definitions/CharacteristicDefinitions.ts index c96151ef1..e555c135b 100644 --- a/src/lib/definitions/CharacteristicDefinitions.ts +++ b/src/lib/definitions/CharacteristicDefinitions.ts @@ -1,5 +1,5 @@ // THIS FILE IS AUTO-GENERATED - DO NOT MODIFY -// V=884 +// V=886 import { Access, Characteristic, Formats, Perms, Units } from "../Characteristic"; diff --git a/src/lib/definitions/ServiceDefinitions.spec.ts b/src/lib/definitions/ServiceDefinitions.spec.ts index 2a17fe5d3..2d534f3b5 100644 --- a/src/lib/definitions/ServiceDefinitions.spec.ts +++ b/src/lib/definitions/ServiceDefinitions.spec.ts @@ -357,28 +357,6 @@ describe("ServiceDefinitions", () => { }); }); - describe("CloudRelay", () => { - it("should be able to construct", () => { - const service0 = new Service.CloudRelay(); - const service1 = new Service.CloudRelay("test name"); - const service2 = new Service.CloudRelay("test name", "test sub type"); - - expect(service0.displayName).toBe(""); - expect(service0.testCharacteristic(Characteristic.Name)).toBe(false); - expect(service0.subtype).toBeUndefined(); - - expect(service1.displayName).toBe("test name"); - expect(service1.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service1.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service1.subtype).toBeUndefined(); - - expect(service2.displayName).toBe("test name"); - expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service2.subtype).toBe("test sub type"); - }); - }); - describe("ContactSensor", () => { it("should be able to construct", () => { const service0 = new Service.ContactSensor(); @@ -1457,28 +1435,6 @@ describe("ServiceDefinitions", () => { }); }); - describe("Tunnel", () => { - it("should be able to construct", () => { - const service0 = new Service.Tunnel(); - const service1 = new Service.Tunnel("test name"); - const service2 = new Service.Tunnel("test name", "test sub type"); - - expect(service0.displayName).toBe(""); - expect(service0.testCharacteristic(Characteristic.Name)).toBe(false); - expect(service0.subtype).toBeUndefined(); - - expect(service1.displayName).toBe("test name"); - expect(service1.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service1.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service1.subtype).toBeUndefined(); - - expect(service2.displayName).toBe("test name"); - expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service2.subtype).toBe("test sub type"); - }); - }); - describe("Valve", () => { it("should be able to construct", () => { const service0 = new Service.Valve(); diff --git a/src/lib/definitions/ServiceDefinitions.ts b/src/lib/definitions/ServiceDefinitions.ts index 09897ea04..5209c2352 100644 --- a/src/lib/definitions/ServiceDefinitions.ts +++ b/src/lib/definitions/ServiceDefinitions.ts @@ -1,5 +1,5 @@ // THIS FILE IS AUTO-GENERATED - DO NOT MODIFY -// V=880 +// V=886 import { Characteristic } from "../Characteristic"; import { Service } from "../Service"; @@ -66,6 +66,7 @@ export class AccessoryInformation extends Service { this.addOptionalCharacteristic(Characteristic.AccessoryFlags); this.addOptionalCharacteristic(Characteristic.AppMatchingIdentifier); this.addOptionalCharacteristic(Characteristic.ConfiguredName); + this.addOptionalCharacteristic(Characteristic.MatterFirmwareRevisionNumber); this.addOptionalCharacteristic(Characteristic.HardwareFinish); this.addOptionalCharacteristic(Characteristic.HardwareRevision); this.addOptionalCharacteristic(Characteristic.ProductData); @@ -363,24 +364,6 @@ export class CarbonMonoxideSensor extends Service { } Service.CarbonMonoxideSensor = CarbonMonoxideSensor; -/** - * Service "Cloud Relay" - */ -export class CloudRelay extends Service { - - public static readonly UUID: string = "0000005A-0000-1000-8000-0026BB765291"; - - constructor(displayName?: string, subtype?: string) { - super(displayName, CloudRelay.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.RelayControlPoint); - this.addCharacteristic(Characteristic.RelayState); - this.addCharacteristic(Characteristic.RelayEnabled); - } -} -Service.CloudRelay = CloudRelay; - /** * Service "Contact Sensor" */ @@ -590,6 +573,7 @@ export class FirmwareUpdate extends Service { this.addCharacteristic(Characteristic.FirmwareUpdateStatus); // Optional Characteristics + this.addOptionalCharacteristic(Characteristic.MatterFirmwareUpdateStatus); this.addOptionalCharacteristic(Characteristic.StagedFirmwareVersion); this.addOptionalCharacteristic(Characteristic.SupportedFirmwareUpdateConfiguration); } @@ -1469,26 +1453,6 @@ export class TransferTransportManagement extends Service { } Service.TransferTransportManagement = TransferTransportManagement; -/** - * Service "Tunnel" - */ -export class Tunnel extends Service { - - public static readonly UUID: string = "00000056-0000-1000-8000-0026BB765291"; - - constructor(displayName?: string, subtype?: string) { - super(displayName, Tunnel.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.AccessoryIdentifier); - this.addCharacteristic(Characteristic.TunnelConnectionTimeout); - this.addCharacteristic(Characteristic.TunneledAccessoryAdvertising); - this.addCharacteristic(Characteristic.TunneledAccessoryConnected); - this.addCharacteristic(Characteristic.TunneledAccessoryStateNumber); - } -} -Service.Tunnel = Tunnel; - /** * Service "Valve" */ diff --git a/src/lib/definitions/generate-definitions.ts b/src/lib/definitions/generate-definitions.ts index aec8f03c9..45f60ea98 100644 --- a/src/lib/definitions/generate-definitions.ts +++ b/src/lib/definitions/generate-definitions.ts @@ -5,7 +5,7 @@ import assert from "assert"; import { Command } from "commander"; import fs from "fs"; import path from "path"; -import plist from "simple-plist"; +import { readFileSync } from "simple-plist"; import { Access, Characteristic, Formats, Units } from "../Characteristic"; import { toLongForm } from "../util/uuid"; import { @@ -33,7 +33,7 @@ const command = new Command("generate-definitions") .option("-f, --force") .option("-m, --metadata ", "Define a custom location for the plain-metadata.config file", "/System/Library/PrivateFrameworks/HomeKitDaemon.framework/Resources/plain-metadata.config") - .requiredOption("-s, --simulator ", "Define the path to the accessory simulator."); + .option("-s, --simulator ", "Define the path to the accessory simulator.", "/Users/benpotter/Desktop/a.app"); command.parse(process.argv); const options = command.opts(); @@ -148,9 +148,11 @@ export interface GeneratedService { optionalCharacteristics?: string[]; } -const plistData = plist.readFileSync(metadataFile); -const simulatorPlistData = plist.readFileSync(defaultPlist); -const simulatorMfiPlistData = fs.existsSync(defaultMfiPlist)? plist.readFileSync(defaultMfiPlist): undefined; +/* eslint-disable @typescript-eslint/no-explicit-any */ +const plistData = readFileSync(metadataFile) as any; +const simulatorPlistData = readFileSync(defaultPlist)as any; +const simulatorMfiPlistData = fs.existsSync(defaultMfiPlist)? readFileSync(defaultMfiPlist): undefined as any; +/* eslint-enable @typescript-eslint/no-explicit-any */ if (plistData.SchemaVersion !== 1) { console.warn(`Detected unsupported schema version ${plistData.SchemaVersion}!`); @@ -348,7 +350,12 @@ for (const generated of Object.values(generatedCharacteristics) if (!name) { continue; } - characteristicOutput.write(` public static readonly ${name} = ${value};\n`); + // fix a weird edge case, still present in V=886 + let printName = name; + if (name === "PROGRAM_SCHEDULED_MANUAL_MODE_") { + printName = "PROGRAM_SCHEDULED_MANUAL_MODE"; + } + characteristicOutput.write(` public static readonly ${printName} = ${value};\n`); } characteristicOutput.write("\n"); } diff --git a/src/lib/definitions/generator-configuration.ts b/src/lib/definitions/generator-configuration.ts index 728a6712e..05303fbde 100644 --- a/src/lib/definitions/generator-configuration.ts +++ b/src/lib/definitions/generator-configuration.ts @@ -44,7 +44,10 @@ export const CharacteristicDeprecatedNames: Map = new Map([ // k ]); export const CharacteristicValidValuesOverride: Map> = new Map([ + ["camera-operating-mode-indicator", { "0": "Disable", "1": "Enable" }], ["closed-captions", { "0": "Disabled", "1": "Enabled" }], + ["event-snapshots-active", { "0": "Disable", "1": "Enable" }], + ["homekit-camera-active", { "0": "Off", "1": "On" }], ["input-device-type", { "0": "Other", "1": "TV", "2": "Recording", "3": "Tuner", "4": "Playback", "5": "Audio System" }], ["input-source-type", { "0": "Other", "1": "Home Screen", "2": "Tuner", "3": "HDMI", "4": "Composite Video", "5": "S Video", "6": "Component Video", "7": "DVI", "8": "AirPlay", "9": "USB", "10": "Application" }], @@ -52,6 +55,7 @@ export const CharacteristicValidValuesOverride: Map][]); -export const CharacteristicClassAdditions: Map = new Map([ - ["humidifier-dehumidifier.state.target", [ - "/**\n * @deprecated Removed in iOS 11. Use {@link HUMIDIFIER_OR_DEHUMIDIFIER} instead.\n */\n public static readonly AUTO = 0;", - ]], -]); +export const CharacteristicClassAdditions: Map = new Map([]); export const CharacteristicOverriding: Map void> = new Map([ ["rotation.speed", generated => { @@ -219,39 +220,6 @@ export const CharacteristicManualAdditions: Map properties: 2, // paired read maxLength: 64, }], - ["target-air-quality", { // some legacy characteristic, don't know where it comes from or where it was used - id: "target-air-quality", - UUID: "000000AE-0000-1000-8000-0026BB765291", - name: "Target Air Quality", - className: "TargetAirQuality", - deprecatedNotice: "Removed and not used anymore", - - format: "uint8", - properties: 7, // read, write, notify - minValue: 0, - maxValue: 2, - validValues: { - "0": "EXCELLENT", - "1": "GOOD", - "2": "FAIR", - } as Record, - }], - ["target-slat-state", { // some legacy characteristic, don't know where it comes from or where it was used - id: "target-slat-state", - UUID: "000000BE-0000-1000-8000-0026BB765291", - name: "Target Slat State", - className: "TargetSlatState", - deprecatedNotice: "Removed and not used anymore", - - format: "uint8", - properties: 7, // read, write, notify - minValue: 0, - maxValue: 1, - validValues: { - "0": "MANUAL", - "1": "AUTO", - } as Record, - }], ]); export const ServiceNameOverrides: Map = new Map([ @@ -264,13 +232,7 @@ export const ServiceNameOverrides: Map = new Map([ ["nfc-access", "NFC Access"], ]); -export const ServiceDeprecatedNames: Map = new Map([ - ["battery", "Battery Service"], - ["camera-recording-management", "Camera Event Recording Management"], - ["cloud-relay", "Relay"], - ["slats", "Slat"], - ["tunnel", "Tunneled BTLE Accessory Service"], -]); +export const ServiceDeprecatedNames: Map = new Map([]); interface CharacteristicConfigurationOverride { addedRequired?: string[], @@ -295,27 +257,6 @@ export const ServiceManualAdditions: Map = new Map([ requiredCharacteristics: ["mute"], optionalCharacteristics: ["active", "volume"], }], - ["camera-control", { - id: "camera-control", - UUID: "00000111-0000-1000-8000-0026BB765291", - name: "Camera Control", - className: "CameraControl", - deprecatedNotice: "This service has no usage anymore and will be ignored by iOS", - - requiredCharacteristics: ["on"], - optionalCharacteristics: [ - "horizontal-tilt.current", - "vertical-tilt.current", - "horizontal-tilt.target", - "vertical-tilt.target", - "night-vision", - "optical-zoom", - "digital-zoom", - "image-rotation", - "image-mirroring", - "name", - ], - }], ]); export const CharacteristicSinceInformation: Map = new Map([