Fixed device buttons

This commit is contained in:
watsonb8
2020-01-24 21:47:13 -05:00
parent 97c0f625db
commit 6f7fc4c2af
4 changed files with 61 additions and 52 deletions

View File

@@ -3,6 +3,7 @@ import HarmonyDataProvider from "./DataProviders/HarmonyDataProvider";
import * as Config from "./Models/Config";
import { IDevice } from "./Models";
import { HarmonyDevice } from "./Models/HarmonyDevice";
import { HarmonyHub } from "./Models/HarmonyHub";
let Accessory: any;
let Homebridge: any;
@@ -51,18 +52,18 @@ class HarmonyMatrixPlatform {
if (this.config.EmitDevicesOnStartup) {
this.dataProvider.on("Ready", () => {
// TODO const hubs: { [hubName: string]: { [deviceName: string]: HarmonyDevice } } = this.dataProvider!.devicesByHub;
// Object.keys(hubs).forEach((hubName: string) => {
// const deviceDictionary = hubs[hubName];
// this.log(`${hubName}`)
const hubs = this.dataProvider!.hubs;
Object.values(hubs).forEach((hub: HarmonyHub) => {
const deviceDictionary = hub.devices;
this.log(`${hub.hubName}`)
// Object.values(deviceDictionary).forEach((device: HarmonyDevice) => {
// this.log(` ${device.name} : ${device.id}`);
// Object.keys(device.commands).forEach((command: string) => {
// this.log(` ${command}`);
// });
// });
// });
Object.values(deviceDictionary).forEach((device: HarmonyDevice) => {
this.log(` ${device.name} : ${device.id}`);
Object.keys(device.commands).forEach((command: string) => {
this.log(` ${command}`);
});
});
});
});
}