This commit is contained in:
parent
e6e3d45b5b
commit
51441a706d
@ -1,4 +1,4 @@
|
||||
import { PlatformAccessory, RemoteController, Service } from "homebridge";
|
||||
import { PlatformAccessory, Service } from "homebridge";
|
||||
import { IActivity } from "../models/config";
|
||||
import { Platform } from "../platform";
|
||||
import { ActivityService } from "../services/activityService";
|
||||
|
@ -6,7 +6,6 @@ import { IDeviceConfig } from "../models/config/deviceConfig";
|
||||
import { IHub } from "../models/config/hub";
|
||||
import { HarmonyDevice } from "../models/harmonyDevice";
|
||||
import { HarmonyHub } from "../models/harmonyHub";
|
||||
import { sleep } from "../util";
|
||||
|
||||
@injectable()
|
||||
export class HarmonyDataProvider {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
import { injectable } from "tsyringe";
|
||||
import { IActivityState } from "../models/activityState";
|
||||
import { IActivity } from "../models/config";
|
||||
|
||||
|
@ -100,19 +100,21 @@ export class ActivityService {
|
||||
let currentOtherState: IActivityState =
|
||||
this._stateDataProvider.states[controlUnitKey]!;
|
||||
|
||||
if (currentOtherState) {
|
||||
currentOtherState.currentActivity.DeviceSetupList.forEach(
|
||||
(value: IDeviceSetupItem) => {
|
||||
//there are devices to remove
|
||||
if (devicesToTurnOn.some((e) => e && e.name === value.DeviceName)) {
|
||||
let deviceToRemove: HarmonyDevice = devicesToTurnOn.filter(
|
||||
(i) => i.name === value.DeviceName
|
||||
)[0];
|
||||
delete devicesToTurnOn[devicesToTurnOn.indexOf(deviceToRemove)];
|
||||
}
|
||||
}
|
||||
);
|
||||
if (!currentOtherState) {
|
||||
return devicesToTurnOn;
|
||||
}
|
||||
|
||||
currentOtherState.currentActivity.DeviceSetupList.forEach(
|
||||
(value: IDeviceSetupItem) => {
|
||||
//there are devices to remove
|
||||
if (devicesToTurnOn.some((e) => e && e.name === value.DeviceName)) {
|
||||
let deviceToRemove: HarmonyDevice = devicesToTurnOn.filter(
|
||||
(i) => i.name === value.DeviceName
|
||||
)[0];
|
||||
delete devicesToTurnOn[devicesToTurnOn.indexOf(deviceToRemove)];
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return devicesToTurnOn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user