From 1436e4b342af97deaf0c29d9a3c8f95102481b79 Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 31 Jul 2019 10:05:59 +0200 Subject: [PATCH] Fixed homebridge startup failed when robot does not support mapping --- CHANGELOG.md | 6 +++++- index.js | 15 +++++++++------ package.json | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8675c43..a40fbe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,4 +90,8 @@ ## 0.6.1 -* Fixed homebridge startup failed when robot does not support zone cleaning \ No newline at end of file +* Fixed homebridge startup failed when robot does not support zone cleaning + +## 0.6.2 + +* Fixed homebridge startup failed when robot does not support mapping \ No newline at end of file diff --git a/index.js b/index.js index 81f241c..aa5cf41 100644 --- a/index.js +++ b/index.js @@ -44,13 +44,16 @@ NeatoVacuumRobotPlatform.prototype = { that.log("Found robot #" + (i + 1) + " named \"" + that.robots[i].name + "\" with serial \"" + that.robots[i]._serial + "\""); let robotAccessory = new NeatoVacuumRobotAccessory(that.robots[i], that); accessories.push(robotAccessory); - that.robots[i].maps.forEach((map) => { - map.boundaries.forEach((boundary) => { - if (boundary.type === "polygon") { - accessories.push(new NeatoVacuumRobotAccessory(that.robots[i], that, boundary)) - } + if (that.robots[i].maps && that.robots[i].maps.length > 0) + { + that.robots[i].maps.forEach((map) => { + map.boundaries.forEach((boundary) => { + if (boundary.type === "polygon") { + accessories.push(new NeatoVacuumRobotAccessory(that.robots[i], that, boundary)) + } + }) }) - }) + } } callback(accessories); }); diff --git a/package.json b/package.json index 340dc7c..53608a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-neato", - "version": "0.6.1", + "version": "0.6.2", "description": "A Neato vacuum robot plugin for homebridge.", "license": "MIT", "keywords": [