Working remote

This commit is contained in:
watsonb8
2019-06-16 22:36:15 -04:00
parent ed8f126a34
commit 5040435760
2 changed files with 83 additions and 13 deletions

View File

@ -123,7 +123,6 @@ export class ControlUnit implements IAccessory {
* Event handler for SET active characteristic
*/
private onSetAccessoryActive = async (value: any) => {
this.log(`set active + ${value}`);
switch (value) {
case 0: this.dataProvider.powerOff(this.name); break;
//Turn on with first activity
@ -135,22 +134,21 @@ export class ControlUnit implements IAccessory {
* Event handler for GET active characteristic
*/
private onGetAccessoryActive = async () => {
this.log(`get active`)
//@ts-ignore
return this.dataProvider.getIsActive ? Characteristic.Active.Active : Characteristic.Active.Inactive
}
//TODO
/**
* Event handler for SET remote key
*/
private onSetRemoteKey = async (key: any) => {
this.log(`set remote key + ${key}`);
this.dataProvider.sendKeyPress(this.name, key);
}
/**
* Event handler for SET active identifier characteristic
*/
private onSetActiveIdentifier = async (identifier: any) => {
this.log(`set active identifier + ${identifier}`);
this.dataProvider.startActivity(this.name, this.activities[identifier]);
}
@ -158,7 +156,6 @@ export class ControlUnit implements IAccessory {
* Event handler for GET active identifier characteristic
*/
private onGetActiveIdentifier = async () => {
this.log(`get active identifier`);
let currentActivity: Activity = this.dataProvider.getIsActive(this.name)!;
let identifier: number = 0;
if (currentActivity) {
@ -202,7 +199,6 @@ export class ControlUnit implements IAccessory {
* Event handler for SET volume characteristic
*/
private onSetVolumeSelector = async (value: any) => {
this.log(`set volume + ${value}`);
switch (value) {
case 0: this.dataProvider.volumeUp(this.name); break;
case 1: this.dataProvider.volumeDown(this.name); break;
@ -237,7 +233,6 @@ export class ControlUnit implements IAccessory {
private configureInputSourceService(): void {
let inputs: Array<HAPNodeJS.Service> = [];
this.activities.forEach((activity: Activity, index: number) => {
this.log(activity.displayName);
let inputService = new Service.InputSource(activity.displayName, 'activity' + activity.displayName);
inputService
.setCharacteristic(Characteristic.Identifier, index)
@ -277,7 +272,6 @@ export class ControlUnit implements IAccessory {
* Called by homebridge to gather services for this accessory.
*/
getServices(): Array<HAPNodeJS.Service> {
this.log(`${this.displayName}`)
let services: Array<HAPNodeJS.Service> = [this.televisionService!, this.televisionSpeakerService!];
this.inputServices.forEach((service: HAPNodeJS.Service | undefined) => {
services.push(service!);