Skip to content

Commit

Permalink
1.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoduj committed May 21, 2020
1 parent 2037f68 commit c9fd414
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
## 1.3.8

- [FIX] numberOfCommands for volume broken - #261
- [FIX] typo in config.schema for HomeBridge UI-X - PR #267
- [NEW] adding AcessControlManagement to TV Accessories / Bumping homebridge Version

## 1.3.7

Expand Down
12 changes: 9 additions & 3 deletions harmonyPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,15 @@ HarmonyPlatform.prototype = {
" is not there anymore in your config (name property). It won't be loaded and will be removed from cache."
);

this.api.unregisterPlatformAccessories('homebridge-harmony', 'HarmonyHubWebSocket', [
accessory,
]);
try {
this.api.unregisterPlatformAccessories('homebridge-harmony', 'HarmonyHubWebSocket', [
accessory,
]);
} catch {
this.log(
'WARNING - configureAccessory - The platform ' + platformName + ' could not be removed'
);
}
} else {
this.log.debug(
accessory.displayName,
Expand Down
75 changes: 74 additions & 1 deletion harmonySubPlatform.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Service, Characteristic, Accessory;
var Service, Characteristic, Accessory, AccessControlManagement, AccessControlEvent;
const HarmonyBase = require('./harmonyBase').HarmonyBase;
const HarmonyConst = require('./harmonyConst');
const HarmonyTools = require('./harmonyTools.js');
Expand All @@ -13,6 +13,8 @@ function HarmonySubPlatform(log, config, api, mainPlatform) {
Service = api.hap.Service;
Characteristic = api.hap.Characteristic;
Accessory = api.hap.Accessory;
AccessControlManagement = api.hap.AccessControlManagement;
AccessControlEvent = api.hap.AccessControlEvent;

this.api = api;
this.mainPlatform = mainPlatform;
Expand Down Expand Up @@ -278,6 +280,77 @@ HarmonySubPlatform.prototype = {
else this.configureMainActivity(myHarmonyAccessory, defaultActivity);
}

////

//acces control
let subType = this.name + ' AccessControlService';
this.accessControlService = myHarmonyAccessory.getServiceByUUIDAndSubType(this.name, subType);
var accessControl;

if (!this.accessControlService) {
accessControl = new AccessControlManagement(true);
this.accessControlService = accessControl.getService();
} else {
accessControl = new AccessControlManagement(true, this.accessControlService);
}

this._confirmedServices.push(this.accessControlService);
myHarmonyAccessory.addService(this.accessControlService);

accessControl.on(AccessControlEvent.ACCESS_LEVEL_UPDATED, (level) => {
this.log.debug(
'(' +
this.name +
')' +
'INFO - New access control level of ' +
level +
'/' +
myHarmonyAccessory.displayName
);
});
accessControl.on(AccessControlEvent.PASSWORD_SETTING_UPDATED, (password, passwordRequired) => {
if (passwordRequired) {
this.log.debug(
'(' +
this.name +
')' +
'INFO - New access control - Required password is: ' +
password +
'/' +
myHarmonyAccessory.displayName
);
} else {
this.log.debug(
'(' +
this.name +
')' +
'INFO - access control - No password set! ' +
'/' +
myHarmonyAccessory.displayName
);
}
});

/*
const myController = new RemoteController();
// ----------------- for siri support -----------------
// import { GStreamerAudioProducer, GStreamerOptions } from "./gstreamer-audioProducer";
// CHANGE this to enable siri support. Read docs in 'gstreamer-audioProducer.ts' for necessary package dependencies
//const siriSupport = false;
//const gstreamerOptions: Partial<GStreamerOptions> = { // any configuration regarding the producer can be made here
// ----------------------------------------------------
//new RemoteController(GStreamerAudioProducer, gstreamerOptions)
myHarmonyAccessory.configureController(myController)
this._confirmedServices.push(myController.targetControlManagementService);
this._confirmedServices.push(myController.targetControlService);
//TO ENABLE SIRI this._confirmedServices.push(myController.audioStreamManagementService);
this.log('readTV - Remote' + JSON.stringify(myController));
////
*/
this.bindCharacteristicEventsForInputs(myHarmonyAccessory);

this.TVFoundAccessory = myHarmonyAccessory;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "git+https://github.com/nicoduj/homebridge-harmony.git"
},
"engines": {
"homebridge": ">=0.4.50",
"homebridge": ">=1.0.4",
"node": ">=10.20.0"
},
"keywords": [
Expand Down

0 comments on commit c9fd414

Please sign in to comment.