Skip to content

Commit

Permalink
0.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoduj committed Mar 17, 2019
1 parent 92d8f70 commit 5048a4e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 61 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 0.5.4

- [BUG] - Devices are not published if publishDevicesAsIndividualAccessories is set to false #106

## 0.5.3

- [NEW] handle skipedIfSameStateActivities for POWER OFF in TV mode #104 - Just add "PowerOff" to the skipedIfSameStateActivities.
Expand Down
21 changes: 3 additions & 18 deletions harmonyAsSwitches.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function HarmonyPlatformAsSwitches(log, config, api) {
this.harmonyBase.configCommonProperties(log, config, api, this);

this.showTurnOffActivity = config['showTurnOffActivity'];
this.publishActivitiesAsIndividualAccessories = HarmonyTools.checkParemeter(
this.publishActivitiesAsIndividualAccessories = HarmonyTools.checkParameter(
config['publishActivitiesAsIndividualAccessories'],
true
);
Expand Down Expand Up @@ -44,22 +44,6 @@ HarmonyPlatformAsSwitches.prototype = {
this._foundAccessories.push(myHarmonyAccessory);
},

readOptionnalAccessories: function(data) {
if (
this.devicesToPublishAsAccessoriesSwitch &&
this.devicesToPublishAsAccessoriesSwitch.length > 0
) {
this.harmonyBase.getDevicesAccessories(this, data);
}

if (
this.sequencesToPublishAsAccessoriesSwitch &&
this.sequencesToPublishAsAccessoriesSwitch.length > 0
) {
this.harmonyBase.getSequencesAccessories(this, data);
}
},

showActivity: function(activity) {
return activity.id != -1 || this.showTurnOffActivity;
},
Expand Down Expand Up @@ -98,7 +82,8 @@ HarmonyPlatformAsSwitches.prototype = {
this.addAccessory(services, this.name);
}

this.readOptionnalAccessories(data);
this.harmonyBase.getDevicesAccessories(this, data);
this.harmonyBase.getSequencesAccessories(this, data);

//first refresh

Expand Down
57 changes: 22 additions & 35 deletions harmonyAsTVPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function HarmonyPlatformAsTVPlatform(log, config, api) {
this.harmonyBase = new HarmonyBase(api);
this.harmonyBase.configCommonProperties(log, config, api, this);
this.mainActivity = config['mainActivity'];
this.playPauseBehavior = HarmonyTools.checkParemeter(
this.playPauseBehavior = HarmonyTools.checkParameter(
config['playPauseBehavior'],
false
);
Expand Down Expand Up @@ -61,22 +61,7 @@ function HarmonyPlatformAsTVPlatform(log, config, api) {

HarmonyPlatformAsTVPlatform.prototype = {
onMessage(newActivity) {
this.updateCurrentInputService(newActivity);

this.harmonyBase.handleCharacteristicUpdate(
this,
this.mainService.controlService.getCharacteristic(Characteristic.Active),
this._currentActivity > 0,
null
);
this.harmonyBase.handleCharacteristicUpdate(
this,
this.mainService.controlService.getCharacteristic(
Characteristic.ActiveIdentifier
),
this._currentActivity,
null
);
this.handleRefreshOfCharacteristic(newActivity);
},

///CREATION / STARTUP
Expand Down Expand Up @@ -290,26 +275,28 @@ HarmonyPlatformAsTVPlatform.prototype = {

///REFRESHING TOOLS

handleRefreshOfCharacteristic(activity) {
this.updateCurrentInputService(activity);

this.harmonyBase.handleCharacteristicUpdate(
this,
this.mainService.controlService.getCharacteristic(Characteristic.Active),
this._currentActivity > 0,
null
);
this.harmonyBase.handleCharacteristicUpdate(
this,
this.mainService.controlService.getCharacteristic(
Characteristic.ActiveIdentifier
),
this._currentActivity,
null
);
},

refreshAccessory: function() {
this.harmonyBase.refreshCurrentActivity(this, () => {
this.updateCurrentInputService(this._currentActivity);

this.harmonyBase.handleCharacteristicUpdate(
this,
this.mainService.controlService.getCharacteristic(
Characteristic.Active
),
this._currentActivity > 0,
null
);
this.harmonyBase.handleCharacteristicUpdate(
this,
this.mainService.controlService.getCharacteristic(
Characteristic.ActiveIdentifier
),
this._currentActivity,
null
);
this.handleRefreshOfCharacteristic(this._currentActivity);
});
},

Expand Down
14 changes: 8 additions & 6 deletions harmonyBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ HarmonyBase.prototype = {

harmonyPlatform.devicesToPublishAsAccessoriesSwitch =
config['devicesToPublishAsAccessoriesSwitch'];
harmonyPlatform.publishDevicesAsIndividualAccessories = HarmonyTools.checkParemeter(
harmonyPlatform.publishDevicesAsIndividualAccessories = HarmonyTools.checkParameter(
config['publishDevicesAsIndividualAccessories'],
true
);

harmonyPlatform.sequencesToPublishAsAccessoriesSwitch =
config['sequencesToPublishAsAccessoriesSwitch'];

harmonyPlatform.publishSequencesAsIndividualAccessories = HarmonyTools.checkParemeter(
harmonyPlatform.publishSequencesAsIndividualAccessories = HarmonyTools.checkParameter(
config['publishSequencesAsIndividualAccessories'],
true
);
Expand Down Expand Up @@ -561,7 +561,7 @@ HarmonyBase.prototype = {
harmonyPlatform.devicesToPublishAsAccessoriesSwitch.length > 0
) {
harmonyPlatform.log('INFO - Loading devices...');
let services = [];
var services = [];

for (
let c = 0,
Expand All @@ -581,7 +581,8 @@ HarmonyBase.prototype = {

//default mode
if (commands.length === 1) {
services.concat(
services.push.apply(
services,
this.handleDefaultCommandMode(
harmonyPlatform,
controlGroup,
Expand All @@ -591,7 +592,8 @@ HarmonyBase.prototype = {
}
//specifc command or list mode
else {
services.concat(
services.push.apply(
services,
this.handleSpecificCommandMode(
harmonyPlatform,
commands,
Expand All @@ -609,7 +611,7 @@ HarmonyBase.prototype = {
services.length > 0
) {
harmonyPlatform.log(
'INFO - Adding Accessory : ' + harmonyPlatform.name
'INFO - Adding Accessory : ' + harmonyPlatform.name + '-Devices'
);
let myHarmonyAccessory = new HarmonyTools.HarmonyAccessory(services);
myHarmonyAccessory.getServices = function() {
Expand Down
2 changes: 1 addition & 1 deletion harmonyTools.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const HarmonyConst = require('./harmonyConst');

module.exports = {
checkParemeter: function(parameter, def) {
checkParameter: function(parameter, def) {
if (parameter == undefined) return def;
else return parameter;
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-harmony",
"version": "0.5.3",
"version": "0.5.4",
"author": "Nicolas Dujardin",
"description": "Publish your harmony activities as homekit accessories",
"main": "index.js",
Expand Down

0 comments on commit 5048a4e

Please sign in to comment.