First pass done but untested
This commit is contained in:
18
src/index.ts
18
src/index.ts
@@ -2,6 +2,7 @@ import * as Accessories from "./Accessories";
|
||||
import HarmonyDataProvider from "./DataProviders/HarmonyDataProvider";
|
||||
import * as Config from "./Models/Config";
|
||||
import { IDevice } from "./Models";
|
||||
import { HarmonyDevice } from "./Models/HarmonyDevice";
|
||||
|
||||
let Accessory: any;
|
||||
let Homebridge: any;
|
||||
@@ -49,13 +50,20 @@ class HarmonyMatrixPlatform {
|
||||
//Emit devices if requested
|
||||
if (this.config.EmitDevicesOnStartup) {
|
||||
this.dataProvider.on("Ready", () => {
|
||||
const devices: { [name: string]: IDevice } = this.dataProvider!.devices;
|
||||
Object.values(devices).forEach((device: IDevice) => {
|
||||
this.log(`${device.name} : ${device.id}`);
|
||||
Object.keys(device.commands).forEach((command: string) => {
|
||||
this.log(` ${command}`);
|
||||
|
||||
const hubs: { [hubName: string]: { [deviceName: string]: HarmonyDevice } } = this.dataProvider!.devicesByHub;
|
||||
Object.keys(hubs).forEach((hubName: string) => {
|
||||
const deviceDictionary = hubs[hubName];
|
||||
this.log(`${hubName}`)
|
||||
|
||||
Object.values(deviceDictionary).forEach((device: HarmonyDevice) => {
|
||||
this.log(` ${device.name} : ${device.id}`);
|
||||
Object.keys(device.commands).forEach((command: string) => {
|
||||
this.log(` ${command}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user