From 73cba09edbcd4655ebdbec1c43206a67211f34d9 Mon Sep 17 00:00:00 2001 From: watsonb8 Date: Fri, 26 Jul 2019 16:30:57 -0400 Subject: [PATCH] Disabled features for default remote --- src/Accessories/ControlUnit.ts | 38 +++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/Accessories/ControlUnit.ts b/src/Accessories/ControlUnit.ts index f834729..3e40c47 100644 --- a/src/Accessories/ControlUnit.ts +++ b/src/Accessories/ControlUnit.ts @@ -85,7 +85,10 @@ export class ControlUnit implements IAccessory { //Configure services this.configureTvService(); + this.configureTvSpeakerService(); + + // this.configureAccessoryInformation(); this.configureInputSourceService(); @@ -130,9 +133,12 @@ export class ControlUnit implements IAccessory { //@ts-ignore .on("get", callbackify(this.onGetAccessoryActive)); - this.televisionService.getCharacteristic(Characteristic.RemoteKey) - //@ts-ignore - .on("set", callbackify(this.onSetRemoteKey)); + //Set remote characteristics if is external + if (this.isExternal) { + this.televisionService.getCharacteristic(Characteristic.RemoteKey) + //@ts-ignore + .on("set", callbackify(this.onSetRemoteKey)); + } this.televisionService.getCharacteristic(Characteristic.ActiveIdentifier) //@ts-ignore @@ -166,15 +172,17 @@ export class ControlUnit implements IAccessory { * Event handler for SET remote key */ private onSetRemoteKey = async (key: any) => { - //Set the active identifier with every key press - let currentActivity: Activity = this.dataProvider.getIsActive(this.name)!; - let identifier: number = 0; - if (currentActivity) { - identifier = this.activities.findIndex(e => e.displayName === currentActivity.displayName); - } - this.televisionService!.setCharacteristic(Characteristic.ActiveIdentifier, identifier); + if (this.isExternal) { + //Set the active identifier with every key press + // let currentActivity: Activity = this.dataProvider.getIsActive(this.name)!; + // let identifier: number = 0; + // if (currentActivity) { + // identifier = this.activities.findIndex(e => e.displayName === currentActivity.displayName); + // } + // this.televisionService!.setCharacteristic(Characteristic.ActiveIdentifier, identifier); - this.dataProvider.sendKeyPress(this.name, key); + this.dataProvider.sendKeyPress(this.name, key); + } } /** @@ -233,9 +241,11 @@ export class ControlUnit implements IAccessory { * Event handler for SET volume characteristic */ private onSetVolumeSelector = async (value: any) => { - switch (value) { - case 0: this.dataProvider.volumeUp(this.name); break; - case 1: this.dataProvider.volumeDown(this.name); break; + if (this.isExternal) { + switch (value) { + case 0: this.dataProvider.volumeUp(this.name); break; + case 1: this.dataProvider.volumeDown(this.name); break; + } } }