Skip to content

Commit

Permalink
0.0.2-alpha9: fixed crash when devices are assigned to different floo…
Browse files Browse the repository at this point in the history
…rs/areas
  • Loading branch information
Black-Thunder committed May 25, 2020
1 parent b61c211 commit 4f5a9c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Documentation:

## Changelog

### 0.0.2-alpha9 25.05.2020
* (Black-Thunder) fixed crash when devices are assigned to different floors/areas

### 0.0.2-alpha8 25.05.2020
* (Black-Thunder) fixed "Swing" of vanes

Expand Down
2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"common": {
"name": "melcloud",
"version": "0.0.2-alpha8",
"version": "0.0.2-alpha9",
"news": {
"0.0.2": {
"en": "first implementation of device control, added more device options, extended and optimized logging (e.g. when logging into MelCloud), implemented polling of cloud data",
Expand Down
3 changes: 1 addition & 2 deletions lib/melcloudPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class MelcloudPlatform {
if (jsonObject == null) return;

const foundDevices = [];
gthat.deviceObjects.length = 0; // clear main array first before adding new devices

for (let b = 0; b < jsonObject.length; b++) {
const building = jsonObject[b];
Expand Down Expand Up @@ -131,8 +132,6 @@ class MelcloudPlatform {
}

CreateDevices(building, devices, foundDevices) {
gthat.deviceObjects.length = 0; // clear array first

for (let d = 0; d < devices.length; d++) {
const device = devices[d];
const newDevice = new MelCloudDevice.MelCloudDevice(gthat);
Expand Down
6 changes: 4 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,10 @@ class Melcloud extends utils.Adapter {
});

if(device == null) {
this.log.debug("Failed to get device object. Known object ids:");
this.deviceObjects.forEach(obj => this.log.debug(obj.id));
let knownIds = "";
this.deviceObjects.forEach(obj => knownIds += obj.id + ", ");
this.log.error("Failed to get device object. Known object IDs: " + knownIds);
this.log.error("This should not happen - report this to the developer!");
return;
}
this.log.debug("Processing change for device object with id " + device.id + " (" + device.name + ")...");
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": "iobroker.melcloud",
"version": "0.0.2-alpha8",
"version": "0.0.2-alpha9",
"description": "melcloud",
"author": {
"name": "BlackThunder",
Expand Down

0 comments on commit 4f5a9c3

Please sign in to comment.