Skip to content

Commit

Permalink
1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoduj committed Aug 22, 2019
1 parent 58257fa commit c3cf88e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 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.

## 1.0.5

- [FIX] trying to better handle some problems with clean cache / name caching

## 1.0.4

- [FIX] sequencesToPublishAsAccessoriesSwitch switches don't do anything #165
Expand Down
36 changes: 19 additions & 17 deletions harmonyPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,31 @@ function HarmonyPlatform(log, config, api) {
let platform = this.platforms[i];
platform.harmonyBase.harmony.removeAllListeners();
platform.harmonyBase.harmony.close();

if (this.cleanCache)
{
this.log(
'WARNING - shutdown - cleaning cache.'
);

this.api.unregisterPlatformAccessories(
'homebridge-harmonyHub',
'HarmonyHubWebSocket',
platform._foundAccessories
);
}

}



}.bind(this)
)
.on(
'didFinishLaunching',
function() {
this.log('DidFinishLaunching');

if (this.cleanCache) {
this.log('WARNING - Removing Accessories');
this.api.unregisterPlatformAccessories(
'homebridge-harmonyHub',
'HarmonyHubWebSocket',
this._foundAccessories
);
this._foundAccessories = [];

for (let i = 0, len = this.platforms.length; i < len; i++) {
let platform = this.platforms[i];
platform._foundAccessories = [];
}
}

for (let i = 0, len = this.platforms.length; i < len; i++) {
let platform = this.platforms[i];
platform.harmonyBase.configureAccessories(platform);
Expand All @@ -98,10 +100,10 @@ HarmonyPlatform.prototype = {
if (this.platforms && this.platforms.length > 0)
platform = this.platforms.find(x => x.name == platformName);

if (platform == undefined)
if (platform == undefined || this.cleanCache || this.config == undefined)
{
this.log(
'WARNING - configureAccessory - The platform ' + platformName + ' is not there anymore in your config (name property). It won\'t be loaded and will be removed from cache.'
'WARNING - configureAccessory - The platform ' + platformName + ' is not there anymore in your config (name property) or cleanCached set to true. It won\'t be loaded and will be removed from cache.'
);

this.api.unregisterPlatformAccessories(
Expand Down
4 changes: 2 additions & 2 deletions harmonySubPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ HarmonySubPlatform.prototype = {
accessory.addService(this.mainService);
}

if (this.savedNames && this.savedNames[0]) {
if (this.savedNames && this.savedNames[0] && this.savedNames[0] !== "" ) {
mainServiceName = this.savedNames[0];
} else {
mainServiceName = this.name;
Expand Down Expand Up @@ -400,7 +400,7 @@ HarmonySubPlatform.prototype = {
inputSourceService
);

if (this.savedNames && this.savedNames[inputId]) {
if (this.savedNames && this.savedNames[inputId] && this.savedNames[inputId]!== "") {
inputServiceName = this.savedNames[inputId];
} else {
inputServiceName = inputName;
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": "1.0.4",
"version": "1.0.5",
"author": "Nicolas Dujardin",
"description": "Publish your harmony activities as homekit accessories",
"main": "index.js",
Expand Down

0 comments on commit c3cf88e

Please sign in to comment.