Enabled debugging support
This commit is contained in:
@ -96,7 +96,9 @@ class HubDataProvider {
|
||||
await Promise.all(
|
||||
//Turn off devices
|
||||
devicesToTurnOff.map(async (device: IDevice) => {
|
||||
await device.powerOff();
|
||||
if (device) {
|
||||
await device.powerOff();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@ -124,7 +126,7 @@ class HubDataProvider {
|
||||
|
||||
//Turn on devices
|
||||
await Promise.all(devicesToTurnOn.map(async (device: IDevice) => {
|
||||
if (device && device.name && this.devices[device.name]) {
|
||||
if (device && device.name) {
|
||||
if (!device.on) {
|
||||
this.log(`Turning on device ${device.name}`)
|
||||
await device.powerOn();
|
||||
@ -479,10 +481,10 @@ class HubDataProvider {
|
||||
let powerOnCommand: string = "Power On";
|
||||
let powerToggleCommand: string = "Power Toggle";
|
||||
if (this.supportsCommand(powerOnCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerOnCommand));
|
||||
await this.sendCommand(powerOnCommand);
|
||||
this.on = true;
|
||||
} else if (this.supportsCommand(powerToggleCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerToggleCommand));
|
||||
await this.sendCommand(powerToggleCommand);
|
||||
this.on = true;
|
||||
}
|
||||
},
|
||||
@ -490,18 +492,16 @@ class HubDataProvider {
|
||||
let powerOffCommand: string = "Power Off";
|
||||
let powerToggleCommand: string = "Power Toggle";
|
||||
if (this.supportsCommand(powerOffCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerOffCommand));
|
||||
await this.sendCommand(powerOffCommand);
|
||||
this.on = false;
|
||||
} else if (this.supportsCommand(powerToggleCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerToggleCommand));
|
||||
await this.sendCommand(powerToggleCommand);
|
||||
this.on = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.log(`Device list: ${JSON.stringify(this.devices)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user