Added power toggling for devices that don’t support on/off
This commit is contained in:
parent
8c3a02fa85
commit
ed8f126a34
@ -244,17 +244,25 @@ class HarmonyDataProvider {
|
||||
|
||||
private powerOffDevice = async (device: IDevice) => {
|
||||
let powerOffCommand: string = "Power Off";
|
||||
let powerToggleCommand: string = "Power Toggle";
|
||||
if (device && device.supportsCommand(powerOffCommand)) {
|
||||
await this.sendCommand(device.getCommand(powerOffCommand));
|
||||
device.on = false;
|
||||
} else if (device && device.supportsCommand(powerToggleCommand)) {
|
||||
await this.sendCommand(device.getCommand(powerToggleCommand));
|
||||
device.on = false;
|
||||
}
|
||||
}
|
||||
|
||||
private powerOnDevice = async (device: IDevice) => {
|
||||
let powerOnCommand: string = "Power On";
|
||||
let powerToggleCommand: string = "Power Toggle";
|
||||
if (device && device.supportsCommand(powerOnCommand)) {
|
||||
await this.sendCommand(device.getCommand(powerOnCommand));
|
||||
device.on = true;
|
||||
} else if (device && device.supportsCommand(powerToggleCommand)) {
|
||||
await this.sendCommand(device.getCommand(powerToggleCommand));
|
||||
device.on = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user