Fixed homebridge crash when robot has a map without zones
This commit is contained in:
parent
1436e4b342
commit
20c54a02e8
21
index.js
21
index.js
@ -44,14 +44,15 @@ NeatoVacuumRobotPlatform.prototype = {
|
|||||||
that.log("Found robot #" + (i + 1) + " named \"" + that.robots[i].name + "\" with serial \"" + that.robots[i]._serial + "\"");
|
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);
|
let robotAccessory = new NeatoVacuumRobotAccessory(that.robots[i], that);
|
||||||
accessories.push(robotAccessory);
|
accessories.push(robotAccessory);
|
||||||
if (that.robots[i].maps && that.robots[i].maps.length > 0)
|
if (that.robots[i].maps) {
|
||||||
{
|
|
||||||
that.robots[i].maps.forEach((map) => {
|
that.robots[i].maps.forEach((map) => {
|
||||||
map.boundaries.forEach((boundary) => {
|
if (map.boundaries) {
|
||||||
if (boundary.type === "polygon") {
|
map.boundaries.forEach((boundary) => {
|
||||||
accessories.push(new NeatoVacuumRobotAccessory(that.robots[i], that, boundary))
|
if (boundary.type === "polygon") {
|
||||||
}
|
accessories.push(new NeatoVacuumRobotAccessory(that.robots[i], that, boundary))
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,7 +308,7 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
nogoLines,
|
nogoLines,
|
||||||
function (error, result) {
|
function (error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
that.log.error(error + ": " + result);
|
that.log.error("Cannot start cleaning. " + error + ": " + result);
|
||||||
callback(true);
|
callback(true);
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
@ -315,7 +316,7 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug(that.name + ": Cant start, maybe already cleaning");
|
debug(that.name + ": Cannot start, maybe already cleaning");
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -463,7 +464,7 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
debug(this.name + ": Updating robot state");
|
debug(this.name + ": Updating robot state");
|
||||||
this.robot.getState(function (error, result) {
|
this.robot.getState(function (error, result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
that.log.error(error + ": " + result);
|
that.log.error("Cannot update robot. Check if robot is online. " + error);
|
||||||
}
|
}
|
||||||
that.lastUpdate = new Date();
|
that.lastUpdate = new Date();
|
||||||
callback();
|
callback();
|
||||||
|
Loading…
Reference in New Issue
Block a user