Using TS types. Not building
This commit is contained in:
		
							
								
								
									
										4816
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4816
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -36,7 +36,7 @@ | |||||||
|         "@babel/preset-typescript": "^7.3.3", |         "@babel/preset-typescript": "^7.3.3", | ||||||
|         "@types/node": "^12.0.7", |         "@types/node": "^12.0.7", | ||||||
|         "harmony-websocket": "^1.1.0", |         "harmony-websocket": "^1.1.0", | ||||||
|         "homebridge": "^1.0.2", |         "homebridge": "^1.0.4", | ||||||
|         "request": "^2.88.0" |         "request": "^2.88.0" | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,12 +1,8 @@ | |||||||
| import * as Config from "../Models/Config" | import * as Config from "../Models/Config" | ||||||
| import { IAccessory } from './IAccessory'; |  | ||||||
| import callbackify from '../Util/Callbackify'; | import callbackify from '../Util/Callbackify'; | ||||||
| import HarmonyDataProvider from '../DataProviders/HarmonyDataProvider'; | import HarmonyDataProvider from '../DataProviders/HarmonyDataProvider'; | ||||||
|  | import { API, Logging, AccessoryPlugin, PlatformAccessory } from "homebridge"; | ||||||
| let Service: HAPNodeJS.Service; | import { Characteristic, Service, Accessory, RemoteController } from "hap-nodejs"; | ||||||
| let Characteristic: HAPNodeJS.Characteristic; |  | ||||||
| let Api: any; |  | ||||||
| let homebridge: any; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Enum describing remote key presses from homebridge. |  * Enum describing remote key presses from homebridge. | ||||||
| @@ -31,26 +27,32 @@ export interface IControlUnitProps { | |||||||
|     dataProvider: HarmonyDataProvider, |     dataProvider: HarmonyDataProvider, | ||||||
|     displayName: string, |     displayName: string, | ||||||
|     activities: Array<Config.IActivity>, |     activities: Array<Config.IActivity>, | ||||||
|     api: any, |     api: API, | ||||||
|     log: any, |     log: Logging, | ||||||
|     homebridge: any, |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ControlUnit accessory |  * ControlUnit accessory | ||||||
|  */ |  */ | ||||||
| export class ControlUnit implements IAccessory { | export class ControlUnit implements AccessoryPlugin { | ||||||
|  |  | ||||||
|  |  | ||||||
|     //fields |     //fields | ||||||
|     private log: any = {}; |     private log: Logging; | ||||||
|     private displayName: string = ""; |     private displayName: string = ""; | ||||||
|  |     private _api: API; | ||||||
|  |     private _name: string; | ||||||
|  |  | ||||||
|     //Service fields |     //Service fields | ||||||
|     private _televisionService: HAPNodeJS.Service | undefined; |     private _platformAccessory: PlatformAccessory; | ||||||
|     private _televisionSpeakerService: HAPNodeJS.Service | undefined; |     private _televisionService: Service = new Service.Television( | ||||||
|     private _infoService: HAPNodeJS.Service; |         this.displayName, | ||||||
|     private _inputServices: Array<HAPNodeJS.Service | undefined> = []; |         'tvService' | ||||||
|  |     ); | ||||||
|  |     private _televisionSpeakerService: Service = new Service.TelevisionSpeaker( | ||||||
|  |         this.displayName, | ||||||
|  |         'tvSpeakerService' | ||||||
|  |     ); | ||||||
|  |     private _infoService: Service; | ||||||
|  |     private _inputServices: Array<Service> = []; | ||||||
|  |  | ||||||
|     //Harmony fields |     //Harmony fields | ||||||
|     private _activities: Array<Config.IActivity> = []; |     private _activities: Array<Config.IActivity> = []; | ||||||
| @@ -63,21 +65,19 @@ export class ControlUnit implements IAccessory { | |||||||
|     constructor(props: IControlUnitProps) { |     constructor(props: IControlUnitProps) { | ||||||
|         //Assign class variables |         //Assign class variables | ||||||
|         this.log = props.log; |         this.log = props.log; | ||||||
|         Api = props.api; |         this._api = props.api; | ||||||
|         Service = props.api.hap.Service; |         this._name = props.displayName; | ||||||
|         Characteristic = props.api.hap.Characteristic; |  | ||||||
|         this.name = props.displayName; |  | ||||||
|         this.displayName = props.displayName; |         this.displayName = props.displayName; | ||||||
|  |  | ||||||
|         this._activities = props.activities; |         this._activities = props.activities; | ||||||
|  |  | ||||||
|         this._dataProvider = props.dataProvider; |         this._dataProvider = props.dataProvider; | ||||||
|         homebridge = props.homebridge; |  | ||||||
|  |  | ||||||
|         this.platformAccessory = new homebridge.platformAccessory(this.displayName, this.generateUUID(), homebridge.hap.Accessory.Categories.TELEVISION); |         this._platformAccessory = new PlatformAccessory(this.displayName, this.generateUUID(), Accessory.Categories.TELEVISION); | ||||||
|  |         this._platformAccessory.configureController(new RemoteController()); | ||||||
|  |  | ||||||
|         //@ts-ignore |         //@ts-ignore | ||||||
|         this._infoService = new Service.AccessoryInformation(); |         this._infoService = new this._api.hap.Service.AccessoryInformation(); | ||||||
|         this._infoService.setCharacteristic(Characteristic.Manufacturer, "Brandon Watson") |         this._infoService.setCharacteristic(Characteristic.Manufacturer, "Brandon Watson") | ||||||
|         this._infoService.setCharacteristic(Characteristic.Model, "Matrix Output Television") |         this._infoService.setCharacteristic(Characteristic.Model, "Matrix Output Television") | ||||||
|         this._infoService.setCharacteristic(Characteristic.SerialNumber, "123-456-789"); |         this._infoService.setCharacteristic(Characteristic.SerialNumber, "123-456-789"); | ||||||
| @@ -94,7 +94,7 @@ export class ControlUnit implements IAccessory { | |||||||
|         //Configure external services |         //Configure external services | ||||||
|         this.getServices().forEach(service => { |         this.getServices().forEach(service => { | ||||||
|             try { |             try { | ||||||
|                 this.platformAccessory.addService(service); |                 this._platformAccessory.addService(service); | ||||||
|             } catch (error) { } |             } catch (error) { } | ||||||
|  |  | ||||||
|             //@ts-ignore |             //@ts-ignore | ||||||
| @@ -105,9 +105,9 @@ export class ControlUnit implements IAccessory { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     //Required by homebridge |     public get platformAccessory(): PlatformAccessory { | ||||||
|     name: string = ""; |         return this._platformAccessory; | ||||||
|     public platformAccessory: any; |     } | ||||||
|  |  | ||||||
|     /************* |     /************* | ||||||
|      *  |      *  | ||||||
| @@ -119,10 +119,6 @@ export class ControlUnit implements IAccessory { | |||||||
|      * Configure television service |      * Configure television service | ||||||
|      */ |      */ | ||||||
|     private configureTvService(): void { |     private configureTvService(): void { | ||||||
|         this._televisionService = new Service.Television( |  | ||||||
|             this.displayName, |  | ||||||
|             'tvService' |  | ||||||
|         ) |  | ||||||
|  |  | ||||||
|         this._televisionService.setCharacteristic(Characteristic.ConfiguredName, this.displayName); |         this._televisionService.setCharacteristic(Characteristic.ConfiguredName, this.displayName); | ||||||
|         //@ts-ignore |         //@ts-ignore | ||||||
| @@ -155,9 +151,9 @@ export class ControlUnit implements IAccessory { | |||||||
|      */ |      */ | ||||||
|     private onSetAccessoryActive = async (value: any) => { |     private onSetAccessoryActive = async (value: any) => { | ||||||
|         switch (value) { |         switch (value) { | ||||||
|             case 0: this._dataProvider.powerOff(this.name); break; |             case 0: this._dataProvider.powerOff(this._name); break; | ||||||
|             //Turn on with first activity |             //Turn on with first activity | ||||||
|             case 1: this._dataProvider.powerOn(this.name, this._activities[0]); break; |             case 1: this._dataProvider.powerOn(this._name, this._activities[0]); break; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -166,28 +162,28 @@ export class ControlUnit implements IAccessory { | |||||||
|      */ |      */ | ||||||
|     private onGetAccessoryActive = async () => { |     private onGetAccessoryActive = async () => { | ||||||
|         //@ts-ignore |         //@ts-ignore | ||||||
|         return this._dataProvider.getIsActive(this.name) ? Characteristic.Active.Active : Characteristic.Active.Inactive |         return this._dataProvider.getIsActive(this._name) ? Characteristic.Active.Active : Characteristic.Active.Inactive | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Event handler for SET remote key |      * Event handler for SET remote key | ||||||
|      */ |      */ | ||||||
|     private onSetRemoteKey = async (key: any) => { |     private onSetRemoteKey = async (key: any) => { | ||||||
|         this._dataProvider.sendKeyPress(this.name, key); |         this._dataProvider.sendKeyPress(this._name, key); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Event handler for SET active identifier characteristic |      * Event handler for SET active identifier characteristic | ||||||
|      */ |      */ | ||||||
|     private onSetActiveIdentifier = async (identifier: any) => { |     private onSetActiveIdentifier = async (identifier: any) => { | ||||||
|         this._dataProvider.startActivity(this.name, this._activities[identifier]); |         this._dataProvider.startActivity(this._name, this._activities[identifier]); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Event handler for GET active identifier characteristic |      * Event handler for GET active identifier characteristic | ||||||
|      */ |      */ | ||||||
|     private onGetActiveIdentifier = async () => { |     private onGetActiveIdentifier = async () => { | ||||||
|         let currentActivity: Config.IActivity = this._dataProvider.getIsActive(this.name)!; |         let currentActivity: Config.IActivity = this._dataProvider.getIsActive(this._name)!; | ||||||
|         let identifier: number = 0; |         let identifier: number = 0; | ||||||
|         if (currentActivity) { |         if (currentActivity) { | ||||||
|             identifier = this._activities.findIndex(e => e.DisplayName === currentActivity.DisplayName); |             identifier = this._activities.findIndex(e => e.DisplayName === currentActivity.DisplayName); | ||||||
| @@ -205,10 +201,6 @@ export class ControlUnit implements IAccessory { | |||||||
|      * Configure Speaker Service |      * Configure Speaker Service | ||||||
|      */ |      */ | ||||||
|     private configureTvSpeakerService(): void { |     private configureTvSpeakerService(): void { | ||||||
|         this._televisionSpeakerService = new Service.TelevisionSpeaker( |  | ||||||
|             this.displayName, |  | ||||||
|             'tvSpeakerService' |  | ||||||
|         ); |  | ||||||
|         this._televisionSpeakerService.setCharacteristic(Characteristic.Name, this.displayName); |         this._televisionSpeakerService.setCharacteristic(Characteristic.Name, this.displayName); | ||||||
|         //@ts-ignore |         //@ts-ignore | ||||||
|         this._televisionSpeakerService.setCharacteristic(Characteristic.Active, Characteristic.Active.ACTIVE); |         this._televisionSpeakerService.setCharacteristic(Characteristic.Active, Characteristic.Active.ACTIVE); | ||||||
| @@ -231,8 +223,8 @@ export class ControlUnit implements IAccessory { | |||||||
|      */ |      */ | ||||||
|     private onSetVolumeSelector = async (value: any) => { |     private onSetVolumeSelector = async (value: any) => { | ||||||
|         switch (value) { |         switch (value) { | ||||||
|             case 0: this._dataProvider.volumeUp(this.name); break; |             case 0: this._dataProvider.volumeUp(this._name); break; | ||||||
|             case 1: this._dataProvider.volumeDown(this.name); break; |             case 1: this._dataProvider.volumeDown(this._name); break; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -246,7 +238,7 @@ export class ControlUnit implements IAccessory { | |||||||
|      * Configure input service |      * Configure input service | ||||||
|      */ |      */ | ||||||
|     private configureInputSourceService(): void { |     private configureInputSourceService(): void { | ||||||
|         let inputs: Array<HAPNodeJS.Service> = []; |         let inputs: Array<Service> = []; | ||||||
|         this._activities.forEach((activity: Config.IActivity, index: number) => { |         this._activities.forEach((activity: Config.IActivity, index: number) => { | ||||||
|             let inputService = new Service.InputSource(activity.DisplayName, 'activity' + activity.DisplayName); |             let inputService = new Service.InputSource(activity.DisplayName, 'activity' + activity.DisplayName); | ||||||
|             inputService |             inputService | ||||||
| @@ -284,9 +276,9 @@ export class ControlUnit implements IAccessory { | |||||||
|     /** |     /** | ||||||
|      * Called by homebridge to gather services for this accessory. |      * Called by homebridge to gather services for this accessory. | ||||||
|      */ |      */ | ||||||
|     getServices(): Array<HAPNodeJS.Service> { |     getServices(): Array<Service> { | ||||||
|         let services: Array<HAPNodeJS.Service> = [this._infoService, this._televisionService!, this._televisionSpeakerService!]; |         let services: Array<Service> = [this._infoService, this._televisionService!, this._televisionSpeakerService!]; | ||||||
|         this._inputServices.forEach((service: HAPNodeJS.Service | undefined) => { |         this._inputServices.forEach((service: Service) => { | ||||||
|             services.push(service!); |             services.push(service!); | ||||||
|         }); |         }); | ||||||
|         return (services); |         return (services); | ||||||
|   | |||||||
| @@ -1,30 +1,26 @@ | |||||||
| import HarmonyDataProvider from "../DataProviders/HarmonyDataProvider"; | import HarmonyDataProvider from "../DataProviders/HarmonyDataProvider"; | ||||||
| import { IDeviceButton } from "../Models/Config"; | import { IDeviceButton } from "../Models/Config"; | ||||||
| import { IAccessory } from "./IAccessory"; |  | ||||||
| import { ICommand } from "../Models"; | import { ICommand } from "../Models"; | ||||||
| import { HarmonyDevice } from "../Models/HarmonyDevice"; | import { HarmonyDevice } from "../Models/HarmonyDevice"; | ||||||
|  | import { Service, PlatformAccessory, AccessoryPlugin, API, Characteristic } from "homebridge"; | ||||||
| let Service: HAPNodeJS.Service; |  | ||||||
| let Characteristic: HAPNodeJS.Characteristic; |  | ||||||
|  |  | ||||||
| export interface IDeviceButtonProps { | export interface IDeviceButtonProps { | ||||||
|     dataProvider: HarmonyDataProvider, |     dataProvider: HarmonyDataProvider, | ||||||
|     buttonName: string, |     buttonName: string, | ||||||
|     displayName: string, |     displayName: string, | ||||||
|     deviceInfo: IDeviceButton, |     deviceInfo: IDeviceButton, | ||||||
|     api: any, |     api: API, | ||||||
|     log: any, |     log: any, | ||||||
|     homebridge: any, |  | ||||||
| } | } | ||||||
|  |  | ||||||
| export class DeviceButton implements IAccessory { | export class DeviceButton implements AccessoryPlugin { | ||||||
|     private _api: any; |     private _api: API; | ||||||
|     private _homebridge: any; |     private _homebridge: any; | ||||||
|     private _log: any = {}; |     private _log: any = {}; | ||||||
|  |  | ||||||
|     //Service fields |     //Service fields | ||||||
|     private _switchService: HAPNodeJS.Service; |     private _switchService: Service; | ||||||
|     private _infoService: HAPNodeJS.Service; |     private _infoService: Service; | ||||||
|  |  | ||||||
|     private _buttonInfo: IDeviceButton; |     private _buttonInfo: IDeviceButton; | ||||||
|  |  | ||||||
| @@ -38,10 +34,7 @@ export class DeviceButton implements IAccessory { | |||||||
|         //Assign class variables |         //Assign class variables | ||||||
|         this._log = props.log; |         this._log = props.log; | ||||||
|         this._api = props.api; |         this._api = props.api; | ||||||
|         Service = props.api.hap.Service; |  | ||||||
|         Characteristic = props.api.hap.Characteristic; |  | ||||||
|         this.name = props.displayName; |         this.name = props.displayName; | ||||||
|         this._homebridge = props.homebridge; |  | ||||||
|  |  | ||||||
|         this._buttonInfo = props.deviceInfo; |         this._buttonInfo = props.deviceInfo; | ||||||
|  |  | ||||||
| @@ -88,7 +81,7 @@ export class DeviceButton implements IAccessory { | |||||||
|     /** |     /** | ||||||
|      * Called by homebridge to gather services. |      * Called by homebridge to gather services. | ||||||
|      */ |      */ | ||||||
|     public getServices = (): Array<HAPNodeJS.Service> => { |     public getServices = (): Array<Service> => { | ||||||
|         return [this._infoService, this._switchService!]; |         return [this._infoService, this._switchService!]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,14 +0,0 @@ | |||||||
|  |  | ||||||
| /** |  | ||||||
|  * Interface to describe homebridge required elements. |  | ||||||
|  */ |  | ||||||
| export interface IAccessory { |  | ||||||
|     /** |  | ||||||
|      * Required by homebridge. |  | ||||||
|      */ |  | ||||||
|     name: string, |  | ||||||
|     /** |  | ||||||
|      * Called by homebridge to gather services. |  | ||||||
|      */ |  | ||||||
|     getServices(): Array<HAPNodeJS.Service>, |  | ||||||
| } |  | ||||||
| @@ -1,3 +1,2 @@ | |||||||
| export { ControlUnit } from './ControlUnit'; | export { ControlUnit } from './ControlUnit'; | ||||||
| export { DeviceButton } from './DeviceButton'; | export { DeviceButton } from './DeviceButton'; | ||||||
| export { IAccessory } from './IAccessory'; |  | ||||||
| @@ -8,8 +8,7 @@ import { IHub } from "../Models/Config/IHub"; | |||||||
| import { IDeviceConfig } from "../Models/Config/IDeviceConfig"; | import { IDeviceConfig } from "../Models/Config/IDeviceConfig"; | ||||||
| import { HarmonyDevice } from "../Models/HarmonyDevice"; | import { HarmonyDevice } from "../Models/HarmonyDevice"; | ||||||
| import { HarmonyHub } from "../Models/HarmonyHub"; | import { HarmonyHub } from "../Models/HarmonyHub"; | ||||||
|  | import { Characteristic } from "homebridge"; | ||||||
| let Characteristic: HAPNodeJS.Characteristic; |  | ||||||
|  |  | ||||||
| const Harmony = require("harmony-websocket"); | const Harmony = require("harmony-websocket"); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -34,6 +34,13 @@ export class HarmonyHub extends EventEmitter { | |||||||
|     public initialize = async () => { |     public initialize = async () => { | ||||||
|         this._harmony = new Harmony(); |         this._harmony = new Harmony(); | ||||||
|         await this._harmony.connect(this._ip); |         await this._harmony.connect(this._ip); | ||||||
|  |         this._harmony.on('stateDigest', (data: any) => { | ||||||
|  |             console.log(data); | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         this._harmony.on('automationState', (data: any) => { | ||||||
|  |             console.log(data); | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         //Gather devices |         //Gather devices | ||||||
|         let devices: any = await this._harmony.getDevices(); |         let devices: any = await this._harmony.getDevices(); | ||||||
|   | |||||||
							
								
								
									
										456
									
								
								src/Types/HAPNodeJS.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										456
									
								
								src/Types/HAPNodeJS.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -1,456 +0,0 @@ | |||||||
| declare namespace HAPNodeJS { |  | ||||||
|  |  | ||||||
|     export interface uuid { |  | ||||||
|         generate(data: string): string; |  | ||||||
|         isValid(UUID: string): boolean; |  | ||||||
|         unparse(bug: string, offset: number): string; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     type EventService = "characteristic-change" | "service-configurationChange" |  | ||||||
|  |  | ||||||
|     export interface IEventEmitterAccessory { |  | ||||||
|         addListener(event: EventService, listener: Function): this; |  | ||||||
|         on(event: EventService, listener: Function): this; |  | ||||||
|         once(event: EventService, listener: Function): this; |  | ||||||
|         removeListener(event: EventService, listener: Function): this; |  | ||||||
|         removeAllListeners(event?: EventService): this; |  | ||||||
|         setMaxListeners(n: number): this; |  | ||||||
|         getMaxListeners(): number; |  | ||||||
|         listeners(event: EventService): Function[]; |  | ||||||
|         emit(event: EventService, ...args: any[]): boolean; |  | ||||||
|         listenerCount(type: string): number; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface Service extends IEventEmitterAccessory { |  | ||||||
|         new(displayName: string, UUID: string, subtype: string): Service; |  | ||||||
|  |  | ||||||
|         displayName: string; |  | ||||||
|         UUID: string; |  | ||||||
|         subtype: string; |  | ||||||
|         iid: string; |  | ||||||
|         characteristics: Characteristic[]; |  | ||||||
|         optionalCharacteristics: Characteristic[]; |  | ||||||
|  |  | ||||||
|         addCharacteristic(characteristic: Characteristic | Function): Characteristic; |  | ||||||
|         removeCharacteristic(characteristic: Characteristic): void; |  | ||||||
|         getCharacteristic(name: string | Function): Characteristic; |  | ||||||
|         testCharacteristic(name: string | Function): boolean; |  | ||||||
|         setCharacteristic(name: string | Function, value: CharacteristicValue): Service; |  | ||||||
|         updateCharacteristic(name: string | Function, value: CharacteristicValue): Service; |  | ||||||
|         addOptionalCharacteristic(characteristic: Characteristic | Function): void; |  | ||||||
|         getCharacteristicByIID(iid: string): Characteristic; |  | ||||||
|  |  | ||||||
|         toHAP(opt: any): JSON; |  | ||||||
|  |  | ||||||
|         AccessoryInformation: PredefinedService; |  | ||||||
|         AirPurifier: PredefinedService; |  | ||||||
|         AirQualitySensor: PredefinedService; |  | ||||||
|         BatteryService: PredefinedService; |  | ||||||
|         BridgeConfiguration: PredefinedService; |  | ||||||
|         BridgingState: PredefinedService; |  | ||||||
|         CameraControl: PredefinedService; |  | ||||||
|         CameraRTPStreamManagement: PredefinedService; |  | ||||||
|         CarbonDioxideSensor: PredefinedService; |  | ||||||
|         CarbonMonoxideSensor: PredefinedService; |  | ||||||
|         ContactSensor: PredefinedService; |  | ||||||
|         Door: PredefinedService; |  | ||||||
|         Doorbell: PredefinedService; |  | ||||||
|         Fan: PredefinedService; |  | ||||||
|         Fanv2: PredefinedService; |  | ||||||
|         Faucet: PredefinedService; |  | ||||||
|         FilterMaintenance: PredefinedService; |  | ||||||
|         GarageDoorOpener: PredefinedService; |  | ||||||
|         HeaterCooler: PredefinedService; |  | ||||||
|         HumidifierDehumidifier: PredefinedService; |  | ||||||
|         HumiditySensor: PredefinedService; |  | ||||||
|         InputSource: PredefinedService; |  | ||||||
|         IrrigationSystem: PredefinedService; |  | ||||||
|         LeakSensor: PredefinedService; |  | ||||||
|         LightSensor: PredefinedService; |  | ||||||
|         Lightbulb: PredefinedService; |  | ||||||
|         LockManagement: PredefinedService; |  | ||||||
|         LockMechanism: PredefinedService; |  | ||||||
|         Microphone: PredefinedService; |  | ||||||
|         MotionSensor: PredefinedService; |  | ||||||
|         OccupancySensor: PredefinedService; |  | ||||||
|         Outlet: PredefinedService; |  | ||||||
|         Pairing: PredefinedService; |  | ||||||
|         ProtocolInformation: PredefinedService; |  | ||||||
|         Relay: PredefinedService; |  | ||||||
|         SecuritySystem: PredefinedService; |  | ||||||
|         ServiceLabel: PredefinedService; |  | ||||||
|         Slat: PredefinedService; |  | ||||||
|         SmokeSensor: PredefinedService; |  | ||||||
|         Speaker: PredefinedService; |  | ||||||
|         StatefulProgrammableSwitch: PredefinedService; |  | ||||||
|         StatelessProgrammableSwitch: PredefinedService; |  | ||||||
|         Switch: PredefinedService; |  | ||||||
|         Television: PredefinedService; |  | ||||||
|         TelevisionSpeaker: PredefinedService; |  | ||||||
|         TemperatureSensor: PredefinedService; |  | ||||||
|         Thermostat: PredefinedService; |  | ||||||
|         TimeInformation: PredefinedService; |  | ||||||
|         TunneledBTLEAccessoryService: PredefinedService; |  | ||||||
|         Valve: PredefinedService; |  | ||||||
|         Window: PredefinedService; |  | ||||||
|         WindowCovering: PredefinedService; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface PredefinedService { |  | ||||||
|         new(displayName: string, subtype: string): Service; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface CameraSource { |  | ||||||
|  |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     type EventAccessory = "service-configurationChange" | "service-characteristic-change" | "identify" |  | ||||||
|  |  | ||||||
|     export interface IEventEmitterAccessory { |  | ||||||
|         addListener(event: EventAccessory, listener: Function): this; |  | ||||||
|         on(event: EventAccessory, listener: Function): this; |  | ||||||
|         once(event: EventAccessory, listener: Function): this; |  | ||||||
|         removeListener(event: EventAccessory, listener: Function): this; |  | ||||||
|         removeAllListeners(event?: EventAccessory): this; |  | ||||||
|         setMaxListeners(n: number): this; |  | ||||||
|         getMaxListeners(): number; |  | ||||||
|         listeners(event: EventAccessory): Function[]; |  | ||||||
|         emit(event: EventAccessory, ...args: any[]): boolean; |  | ||||||
|         listenerCount(type: string): number; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface CharacteristicProps { |  | ||||||
|         format: Characteristic.Formats; |  | ||||||
|         unit: Characteristic.Units, |  | ||||||
|         minValue: number, |  | ||||||
|         maxValue: number, |  | ||||||
|         minStep: number, |  | ||||||
|         perms: Characteristic.Perms[] |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     type EventCharacteristic = "get" | "set" |  | ||||||
|     type CharacteristicValue = boolean | string | number |  | ||||||
|  |  | ||||||
|     export type CharacteristicGetCallback<T = CharacteristicValue> = (error: Error | null, value: T) => void |  | ||||||
|     export type CharacteristicSetCallback = (error?: Error | null) => void |  | ||||||
|     export type CharacteristicCallback = CharacteristicGetCallback | CharacteristicSetCallback |  | ||||||
|  |  | ||||||
|     export interface IEventEmitterCharacteristic { |  | ||||||
|         addListener(event: EventCharacteristic, listener: CharacteristicCallback): this; |  | ||||||
|         on(event: EventCharacteristic, listener: CharacteristicCallback): this; |  | ||||||
|         once(event: EventCharacteristic, listener: CharacteristicCallback): this; |  | ||||||
|         removeListener(event: EventCharacteristic, listener: CharacteristicCallback): this; |  | ||||||
|         removeAllListeners(event?: EventCharacteristic): this; |  | ||||||
|         setMaxListeners(n: number): this; |  | ||||||
|         getMaxListeners(): number; |  | ||||||
|         listeners(event: EventCharacteristic): CharacteristicCallback[]; |  | ||||||
|         emit(event: EventCharacteristic, ...args: any[]): boolean; |  | ||||||
|         listenerCount(type: string): number; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface Characteristic extends IEventEmitterCharacteristic { |  | ||||||
|         new(displayName: string, UUID: string, props?: CharacteristicProps): Characteristic; |  | ||||||
|  |  | ||||||
|         Formats: typeof Characteristic.Formats; |  | ||||||
|         Units: typeof Characteristic.Units; |  | ||||||
|         Perms: typeof Characteristic.Perms; |  | ||||||
|  |  | ||||||
|         setProps(props: CharacteristicProps): Characteristic |  | ||||||
|         getValue(callback?: CharacteristicGetCallback, context?: any, connectionID?: string): void; |  | ||||||
|         setValue(newValue: CharacteristicValue, callback?: CharacteristicSetCallback, context?: any, connectionID?: string): Characteristic; |  | ||||||
|         updateValue(newValue: CharacteristicValue, callback?: () => void, context?: any): Characteristic; |  | ||||||
|         getDefaultValue(): CharacteristicValue; |  | ||||||
|         toHAP(opt: any): JSON; |  | ||||||
|  |  | ||||||
|         AccessoryFlags: Characteristic; |  | ||||||
|         AccessoryIdentifier: Characteristic; |  | ||||||
|         Active: Characteristic; |  | ||||||
|         ActiveIdentifier: Characteristic; |  | ||||||
|         AdministratorOnlyAccess: Characteristic; |  | ||||||
|         AirParticulateDensity: Characteristic; |  | ||||||
|         AirParticulateSize: Characteristic; |  | ||||||
|         AirQuality: Characteristic; |  | ||||||
|         AppMatchingIdentifier: Characteristic; |  | ||||||
|         AudioFeedback: Characteristic; |  | ||||||
|         BatteryLevel: Characteristic; |  | ||||||
|         Brightness: Characteristic; |  | ||||||
|         CarbonDioxideDetected: Characteristic; |  | ||||||
|         CarbonDioxideLevel: Characteristic; |  | ||||||
|         CarbonDioxidePeakLevel: Characteristic; |  | ||||||
|         CarbonMonoxideDetected: Characteristic; |  | ||||||
|         CarbonMonoxideLevel: Characteristic; |  | ||||||
|         CarbonMonoxidePeakLevel: Characteristic; |  | ||||||
|         Category: Characteristic; |  | ||||||
|         ChargingState: Characteristic; |  | ||||||
|         ClosedCaptions: Characteristic; |  | ||||||
|         ColorTemperature: Characteristic; |  | ||||||
|         ConfigureBridgedAccessory: Characteristic; |  | ||||||
|         ConfigureBridgedAccessoryStatus: Characteristic; |  | ||||||
|         ConfiguredName: Characteristic; |  | ||||||
|         ContactSensorState: Characteristic; |  | ||||||
|         CoolingThresholdTemperature: Characteristic; |  | ||||||
|         CurrentAirPurifierState: Characteristic; |  | ||||||
|         CurrentAmbientLightLevel: Characteristic; |  | ||||||
|         CurrentDoorState: Characteristic; |  | ||||||
|         CurrentFanState: Characteristic; |  | ||||||
|         CurrentHeaterCoolerState: Characteristic; |  | ||||||
|         CurrentHeatingCoolingState: Characteristic; |  | ||||||
|         CurrentHorizontalTiltAngle: Characteristic; |  | ||||||
|         CurrentHumidifierDehumidifierState: Characteristic; |  | ||||||
|         CurrentMediaState: Characteristic; |  | ||||||
|         CurrentPosition: Characteristic; |  | ||||||
|         CurrentRelativeHumidity: Characteristic; |  | ||||||
|         CurrentSlatState: Characteristic; |  | ||||||
|         CurrentTemperature: Characteristic; |  | ||||||
|         CurrentTiltAngle: Characteristic; |  | ||||||
|         CurrentTime: Characteristic; |  | ||||||
|         CurrentVerticalTiltAngle: Characteristic; |  | ||||||
|         CurrentVisibilityState: Characteristic; |  | ||||||
|         DayoftheWeek: Characteristic; |  | ||||||
|         DigitalZoom: Characteristic; |  | ||||||
|         DiscoverBridgedAccessories: Characteristic; |  | ||||||
|         DiscoveredBridgedAccessories: Characteristic; |  | ||||||
|         DisplayOrder: Characteristic; |  | ||||||
|         FilterChangeIndication: Characteristic; |  | ||||||
|         FilterLifeLevel: Characteristic; |  | ||||||
|         FirmwareRevision: Characteristic; |  | ||||||
|         HardwareRevision: Characteristic; |  | ||||||
|         HeatingThresholdTemperature: Characteristic; |  | ||||||
|         HoldPosition: Characteristic; |  | ||||||
|         Hue: Characteristic; |  | ||||||
|         Identifier: Characteristic; |  | ||||||
|         Identify: Characteristic; |  | ||||||
|         ImageMirroring: Characteristic; |  | ||||||
|         ImageRotation: Characteristic; |  | ||||||
|         InUse: Characteristic; |  | ||||||
|         InputDeviceType: Characteristic; |  | ||||||
|         InputSourceType: Characteristic; |  | ||||||
|         IsConfigured: Characteristic; |  | ||||||
|         LeakDetected: Characteristic; |  | ||||||
|         LinkQuality: Characteristic; |  | ||||||
|         LockControlPoint: Characteristic; |  | ||||||
|         LockCurrentState: Characteristic; |  | ||||||
|         LockLastKnownAction: Characteristic; |  | ||||||
|         LockManagementAutoSecurityTimeout: Characteristic; |  | ||||||
|         LockPhysicalControls: Characteristic; |  | ||||||
|         LockTargetState: Characteristic; |  | ||||||
|         Logs: Characteristic; |  | ||||||
|         Manufacturer: Characteristic; |  | ||||||
|         Model: Characteristic; |  | ||||||
|         MotionDetected: Characteristic; |  | ||||||
|         Mute: Characteristic; |  | ||||||
|         Name: Characteristic; |  | ||||||
|         NightVision: Characteristic; |  | ||||||
|         NitrogenDioxideDensity: Characteristic; |  | ||||||
|         ObstructionDetected: Characteristic; |  | ||||||
|         OccupancyDetected: Characteristic; |  | ||||||
|         On: Characteristic; |  | ||||||
|         OpticalZoom: Characteristic; |  | ||||||
|         OutletInUse: Characteristic; |  | ||||||
|         OzoneDensity: Characteristic; |  | ||||||
|         PM10Density: Characteristic; |  | ||||||
|         PM2_5Density: Characteristic; |  | ||||||
|         PairSetup: Characteristic; |  | ||||||
|         PairVerify: Characteristic; |  | ||||||
|         PairingFeatures: Characteristic; |  | ||||||
|         PairingPairings: Characteristic; |  | ||||||
|         PictureMode: Characteristic; |  | ||||||
|         PositionState: Characteristic; |  | ||||||
|         PowerModeSelection: Characteristic; |  | ||||||
|         ProgramMode: Characteristic; |  | ||||||
|         ProgrammableSwitchEvent: Characteristic; |  | ||||||
|         ProgrammableSwitchOutputState: Characteristic; |  | ||||||
|         Reachable: Characteristic; |  | ||||||
|         RelativeHumidityDehumidifierThreshold: Characteristic; |  | ||||||
|         RelativeHumidityHumidifierThreshold: Characteristic; |  | ||||||
|         RelayControlPoint: Characteristic; |  | ||||||
|         RelayEnabled: Characteristic; |  | ||||||
|         RelayState: Characteristic; |  | ||||||
|         RemainingDuration: Characteristic; |  | ||||||
|         RemoteKey: Characteristic; |  | ||||||
|         ResetFilterIndication: Characteristic; |  | ||||||
|         RotationDirection: Characteristic; |  | ||||||
|         RotationSpeed: Characteristic; |  | ||||||
|         Saturation: Characteristic; |  | ||||||
|         SecuritySystemAlarmType: Characteristic; |  | ||||||
|         SecuritySystemCurrentState: Characteristic; |  | ||||||
|         SecuritySystemTargetState: Characteristic; |  | ||||||
|         SelectedRTPStreamConfiguration: Characteristic; |  | ||||||
|         SerialNumber: Characteristic; |  | ||||||
|         ServiceLabelIndex: Characteristic; |  | ||||||
|         ServiceLabelNamespace: Characteristic; |  | ||||||
|         SetDuration: Characteristic; |  | ||||||
|         SetupEndpoints: Characteristic; |  | ||||||
|         SlatType: Characteristic; |  | ||||||
|         SleepDiscoveryMode: Characteristic; |  | ||||||
|         SmokeDetected: Characteristic; |  | ||||||
|         SoftwareRevision: Characteristic; |  | ||||||
|         StatusActive: Characteristic; |  | ||||||
|         StatusFault: Characteristic; |  | ||||||
|         StatusJammed: Characteristic; |  | ||||||
|         StatusLowBattery: Characteristic; |  | ||||||
|         StatusTampered: Characteristic; |  | ||||||
|         StreamingStatus: Characteristic; |  | ||||||
|         SulphurDioxideDensity: Characteristic; |  | ||||||
|         SupportedAudioStreamConfiguration: Characteristic; |  | ||||||
|         SupportedRTPConfiguration: Characteristic; |  | ||||||
|         SupportedVideoStreamConfiguration: Characteristic; |  | ||||||
|         SwingMode: Characteristic; |  | ||||||
|         TargetAirPurifierState: Characteristic; |  | ||||||
|         TargetAirQuality: Characteristic; |  | ||||||
|         TargetDoorState: Characteristic; |  | ||||||
|         TargetFanState: Characteristic; |  | ||||||
|         TargetHeaterCoolerState: Characteristic; |  | ||||||
|         TargetHeatingCoolingState: Characteristic; |  | ||||||
|         TargetHorizontalTiltAngle: Characteristic; |  | ||||||
|         TargetHumidifierDehumidifierState: Characteristic; |  | ||||||
|         TargetMediaState: Characteristic; |  | ||||||
|         TargetPosition: Characteristic; |  | ||||||
|         TargetRelativeHumidity: Characteristic; |  | ||||||
|         TargetSlatState: Characteristic; |  | ||||||
|         TargetTemperature: Characteristic; |  | ||||||
|         TargetTiltAngle: Characteristic; |  | ||||||
|         TargetVerticalTiltAngle: Characteristic; |  | ||||||
|         TargetVisibilityState: Characteristic; |  | ||||||
|         TemperatureDisplayUnits: Characteristic; |  | ||||||
|         TimeUpdate: Characteristic; |  | ||||||
|         TunnelConnectionTimeout: Characteristic; |  | ||||||
|         TunneledAccessoryAdvertising: Characteristic; |  | ||||||
|         TunneledAccessoryConnected: Characteristic; |  | ||||||
|         TunneledAccessoryStateNumber: Characteristic; |  | ||||||
|         VOCDensity: Characteristic; |  | ||||||
|         ValveType: Characteristic; |  | ||||||
|         Version: Characteristic; |  | ||||||
|         Volume: Characteristic; |  | ||||||
|         VolumeControlType: Characteristic; |  | ||||||
|         VolumeSelector: Characteristic; |  | ||||||
|         WaterLevel: Characteristic; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     module Characteristic { |  | ||||||
|         export enum Formats { |  | ||||||
|             BOOL, |  | ||||||
|             INT, |  | ||||||
|             FLOAT, |  | ||||||
|             STRING, |  | ||||||
|             ARRAY, // unconfirmed |  | ||||||
|             DICTIONARY, // unconfirmed |  | ||||||
|             UINT8, |  | ||||||
|             UINT16, |  | ||||||
|             UINT32, |  | ||||||
|             UINT64, |  | ||||||
|             DATA, // unconfirmed |  | ||||||
|             TLV8 |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         export enum Units { |  | ||||||
|             // HomeKit only defines Celsius, for Fahrenheit, it requires iOS app to do the conversion. |  | ||||||
|             CELSIUS, |  | ||||||
|             PERCENTAGE, |  | ||||||
|             ARC_DEGREE, |  | ||||||
|             LUX, |  | ||||||
|             SECONDS |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         export enum Perms { |  | ||||||
|             READ, |  | ||||||
|             WRITE, |  | ||||||
|             NOTIFY, |  | ||||||
|             HIDDEN |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface PublishInfo { |  | ||||||
|         port: number; |  | ||||||
|         username: string; |  | ||||||
|         pincode: string; |  | ||||||
|         category: number; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface Accessory extends IEventEmitterAccessory { |  | ||||||
|         new(displayName: string, UUID: string): Accessory; |  | ||||||
|         displayName: string; |  | ||||||
|         username: string; |  | ||||||
|         pincode: string; |  | ||||||
|         UUID: string; |  | ||||||
|         aid: string; |  | ||||||
|         bridged: boolean; |  | ||||||
|         bridgedAccessories: Accessory[]; |  | ||||||
|         reachable: boolean; |  | ||||||
|         category: Accessory.Categories; |  | ||||||
|         services: Service[]; |  | ||||||
|         cameraSource: CameraSource; |  | ||||||
|         Categories: typeof Accessory.Categories |  | ||||||
|         addService(service: Service | Function): Service; |  | ||||||
|         removeService(service: Service): void; |  | ||||||
|         getService(name: string | Function): Service; |  | ||||||
|         updateReachability(reachable: boolean): void; |  | ||||||
|         addBridgedAccessory(accessory: Accessory, deferUpdate: boolean): Accessory; |  | ||||||
|         addBridgedAccessories(accessories: Accessory[]): void |  | ||||||
|         removeBridgedAccessory(accessory: Accessory, deferUpdate: boolean): void; |  | ||||||
|         removeBridgedAccessories(accessories: Accessory[]): void; |  | ||||||
|         getCharacteristicByIID(iid: string): Characteristic; |  | ||||||
|         getBridgedAccessoryByAID(aid: string): Accessory; |  | ||||||
|         findCharacteristic(aid: string, iid: string): Accessory; |  | ||||||
|         configureCameraSource(cameraSource: CameraSource): void; |  | ||||||
|         toHAP(opt: any): JSON; |  | ||||||
|         publish(info: PublishInfo, allowInsecureRequest: boolean): void; |  | ||||||
|         destroy(): void; |  | ||||||
|         setupURI(): string; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     module Accessory { |  | ||||||
|         export enum Categories { |  | ||||||
|             OTHER = 1, |  | ||||||
|             BRIDGE = 2, |  | ||||||
|             FAN = 3, |  | ||||||
|             GARAGE_DOOR_OPENER = 4, |  | ||||||
|             LIGHTBULB = 5, |  | ||||||
|             DOOR_LOCK = 6, |  | ||||||
|             OUTLET = 7, |  | ||||||
|             SWITCH = 8, |  | ||||||
|             THERMOSTAT = 9, |  | ||||||
|             SENSOR = 10, |  | ||||||
|             ALARM_SYSTEM = 11, |  | ||||||
|             SECURITY_SYSTEM = 11, |  | ||||||
|             DOOR = 12, |  | ||||||
|             WINDOW = 13, |  | ||||||
|             WINDOW_COVERING = 14, |  | ||||||
|             PROGRAMMABLE_SWITCH = 15, |  | ||||||
|             RANGE_EXTENDER = 16, |  | ||||||
|             CAMERA = 17, |  | ||||||
|             IP_CAMERA = 17, |  | ||||||
|             VIDEO_DOORBELL = 18, |  | ||||||
|             AIR_PURIFIER = 19, |  | ||||||
|             AIR_HEATER = 20, |  | ||||||
|             AIR_CONDITIONER = 21, |  | ||||||
|             AIR_HUMIDIFIER = 22, |  | ||||||
|             AIR_DEHUMIDIFIER = 23, |  | ||||||
|             APPLE_TV = 24, |  | ||||||
|             SPEAKER = 26, |  | ||||||
|             AIRPORT = 27, |  | ||||||
|             SPRINKLER = 28, |  | ||||||
|             FAUCET = 29, |  | ||||||
|             SHOWER_HEAD = 30, |  | ||||||
|             TELEVISION = 31, |  | ||||||
|             TARGET_CONTROLLER = 32 |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     export interface HAPNodeJS { |  | ||||||
|         init(storagePath?: string): void, |  | ||||||
|         uuid: uuid, |  | ||||||
|         Accessory: Accessory, |  | ||||||
|         Service: Service, |  | ||||||
|         Characteristic: Characteristic |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| declare var hapNodeJS: HAPNodeJS.HAPNodeJS; |  | ||||||
|  |  | ||||||
| declare module "hap-nodejs" { |  | ||||||
|     export = hapNodeJS; |  | ||||||
| } |  | ||||||
							
								
								
									
										30
									
								
								src/index.ts
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								src/index.ts
									
									
									
									
									
								
							| @@ -1,40 +1,39 @@ | |||||||
| import * as Accessories from "./Accessories"; | import * as Accessories from "./Accessories"; | ||||||
| import HarmonyDataProvider from "./DataProviders/HarmonyDataProvider"; | import HarmonyDataProvider from "./DataProviders/HarmonyDataProvider"; | ||||||
| import * as Config from "./Models/Config"; | import * as Config from "./Models/Config"; | ||||||
| import { IDevice } from "./Models"; |  | ||||||
| import { HarmonyDevice } from "./Models/HarmonyDevice"; | import { HarmonyDevice } from "./Models/HarmonyDevice"; | ||||||
| import { HarmonyHub } from "./Models/HarmonyHub"; | import { HarmonyHub } from "./Models/HarmonyHub"; | ||||||
|  | import { API, Logging, StaticPlatformPlugin, AccessoryPlugin } from "homebridge"; | ||||||
|  |  | ||||||
| let Accessory: any; | let Accessory: any; | ||||||
| let Homebridge: any; | let Homebridge: API; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Main entry. |  * Main entry. | ||||||
|  * @param homebridge  |  * @param homebridge  | ||||||
|  */ |  */ | ||||||
| export default function (homebridge: any) { | export default function (homebridge: API) { | ||||||
|     Homebridge = homebridge; |     Homebridge = homebridge; | ||||||
|     Accessory = homebridge.platformAccessory; |     Accessory = homebridge.platformAccessory; | ||||||
|     homebridge.registerPlatform( |     homebridge.registerPlatform( | ||||||
|         'homebridge-harmony-watson', |         'homebridge-harmony-watson', | ||||||
|         'HarmonyHubMatrix', |         'HarmonyHubMatrix', | ||||||
|         HarmonyMatrixPlatform, |         HarmonyMatrixPlatform, | ||||||
|         true |  | ||||||
|     ); |     ); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class HarmonyMatrixPlatform { | class HarmonyMatrixPlatform implements StaticPlatformPlugin { | ||||||
|     log: any = {}; |     log: Logging; | ||||||
|     config: Config.IConfig; |     config: Config.IConfig; | ||||||
|     api: any; |     api: API; | ||||||
|     dataProvider: HarmonyDataProvider | null; |     dataProvider: HarmonyDataProvider | null; | ||||||
|     accessoryList: Array<Accessories.IAccessory> = []; |     accessoryList: Array<AccessoryPlugin> = []; | ||||||
|  |  | ||||||
|     constructor(log: any, config: any, api: any) { |     constructor(logger: Logging, config: any, api: API) { | ||||||
|         this.log = log; |         this.log = logger; | ||||||
|         this.config = config; |         this.config = config; | ||||||
|         this.api = api; |         this.api = api; | ||||||
|         this.log('INFO - Registering Harmony Matrix Platform'); |         this.log.info('INFO - Registering Harmony Matrix Platform'); | ||||||
|         this.api.on('didFinishLaunching', this.didFinishLaunching.bind(this)); |         this.api.on('didFinishLaunching', this.didFinishLaunching.bind(this)); | ||||||
|  |  | ||||||
|         this.dataProvider = null; |         this.dataProvider = null; | ||||||
| @@ -79,7 +78,7 @@ class HarmonyMatrixPlatform { | |||||||
|         this.log(`Publishing external accessories`); |         this.log(`Publishing external accessories`); | ||||||
|  |  | ||||||
|         //This is required in order to have multiple tv remotes on one platform |         //This is required in order to have multiple tv remotes on one platform | ||||||
|         this.accessoryList.forEach((accessory: Accessories.IAccessory) => { |         this.accessoryList.forEach((accessory: AccessoryPlugin) => { | ||||||
|             if (accessory instanceof Accessories.ControlUnit) { |             if (accessory instanceof Accessories.ControlUnit) { | ||||||
|                 this.api.publishExternalAccessories("HarmonyMatrixPlatform", [accessory.platformAccessory]); |                 this.api.publishExternalAccessories("HarmonyMatrixPlatform", [accessory.platformAccessory]); | ||||||
|             } |             } | ||||||
| @@ -90,7 +89,7 @@ class HarmonyMatrixPlatform { | |||||||
|      * Called by homebridge to gather accessories. |      * Called by homebridge to gather accessories. | ||||||
|      * @param callback  |      * @param callback  | ||||||
|      */ |      */ | ||||||
|     accessories(callback: (accessories: Array<Accessories.IAccessory>) => void) { |     accessories(callback: (accessories: Array<AccessoryPlugin>) => void) { | ||||||
|  |  | ||||||
|         //Add control units |         //Add control units | ||||||
|         this.config.ControlUnits.forEach((unit: Config.IControlUnit) => { |         this.config.ControlUnits.forEach((unit: Config.IControlUnit) => { | ||||||
| @@ -100,7 +99,6 @@ class HarmonyMatrixPlatform { | |||||||
|                 api: this.api, |                 api: this.api, | ||||||
|                 log: this.log, |                 log: this.log, | ||||||
|                 activities: unit.Activities, |                 activities: unit.Activities, | ||||||
|                 homebridge: Homebridge, |  | ||||||
|             })); |             })); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
| @@ -112,9 +110,7 @@ class HarmonyMatrixPlatform { | |||||||
|                 displayName: button.DisplayName, |                 displayName: button.DisplayName, | ||||||
|                 deviceInfo: button, |                 deviceInfo: button, | ||||||
|                 api: this.api, |                 api: this.api, | ||||||
|                 log: this.log, |                 log: this.log | ||||||
|                 homebridge: Homebridge, |  | ||||||
|  |  | ||||||
|             })) |             })) | ||||||
|         }); |         }); | ||||||
|         callback(this.accessoryList); |         callback(this.accessoryList); | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ | |||||||
|         "src" |         "src" | ||||||
|     ], |     ], | ||||||
|     "exclude": [ |     "exclude": [ | ||||||
|         "node_modules", |         "**/node_modules", | ||||||
|         "**/__tests__/*" |         "**/__tests__/*" | ||||||
|     ] |     ] | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user