Skip to content

Commit

Permalink
fixing #89
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoduj committed Mar 10, 2019
1 parent 644578b commit f20f290
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ See [Logitech Harmony Sequence Configuration](https://support.myharmony.com/en-u

## Changelog

- 0.4.9
- [FIX] #89 This callback function has already been called by someone else when publishDevicesAsIndividualAccessories is set to true (default value :( sorry ! )
- 0.4.8
- [NEW] Input hiding handling #85
- [NEW] huge refactoring to enhance code quality (I hope there won't be too much bugs ! )
Expand Down
45 changes: 24 additions & 21 deletions harmonyBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ HarmonyBase.prototype = {
'INFO - Hub config : ' + JSON.stringify(response)
);
harmonyPlatform.readAccessories(response, callback);
}); /*
})
.catch(e => {
harmonyPlatform.log(
'Error - Error retrieving info from hub : ' + e.message
Expand All @@ -176,7 +176,7 @@ HarmonyBase.prototype = {
setTimeout(function() {
that.configureAccessories(harmonyPlatform, callback);
}, HarmonyConst.DELAY_BEFORE_RECONNECT);
});*/
});
},

refreshCurrentActivity: function(harmonyPlatform, callback) {
Expand Down Expand Up @@ -347,12 +347,9 @@ HarmonyBase.prototype = {
return commandFunctions;
},

handleDefaultCommandMode: function(
harmonyPlatform,
controlGroup,
device,
services
) {
handleDefaultCommandMode: function(harmonyPlatform, controlGroup, device) {
let services = [];

let accessoryName = harmonyPlatform.name + '-' + device.label;
let switchName = harmonyPlatform.devMode
? 'DEV' + device.label
Expand Down Expand Up @@ -417,15 +414,17 @@ HarmonyBase.prototype = {
}
}
}
return services;
},

handleSpecificCommandMode: function(
harmonyPlatform,
commands,
controlGroup,
device,
services
device
) {
let services = [];

let accessoryName = harmonyPlatform.name + '-' + device.label;
let switchName = harmonyPlatform.devMode
? 'DEV' + device.label
Expand Down Expand Up @@ -488,6 +487,8 @@ HarmonyBase.prototype = {
services = [];
}
}

return services;
},

getDevicesAccessories: function(harmonyPlatform, data) {
Expand Down Expand Up @@ -520,21 +521,23 @@ HarmonyBase.prototype = {

//default mode
if (commands.length === 1) {
this.handleDefaultCommandMode(
harmonyPlatform,
controlGroup,
devices[i],
services
services.concat(
this.handleDefaultCommandMode(
harmonyPlatform,
controlGroup,
devices[i]
)
);
}
//specifc command or list mode
else {
this.handleSpecificCommandMode(
harmonyPlatform,
commands,
controlGroup,
devices[i],
services
services.concat(
this.handleSpecificCommandMode(
harmonyPlatform,
commands,
controlGroup,
devices[i]
)
);
}
}
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.4.8",
"version": "0.4.9",
"author": "Nicolas Dujardin",
"description": "Publish your harmony activities as homekit accessories",
"main": "index.js",
Expand Down

0 comments on commit f20f290

Please sign in to comment.