Fixed a bug that crashed the plugin on devices with zone cleaning

Fixed a bug in the update cache timing
This commit is contained in:
Arne
2019-09-24 20:06:04 +02:00
parent af54046927
commit bef37d88c8
2 changed files with 16 additions and 11 deletions

View File

@@ -55,7 +55,7 @@ NeatoVacuumRobotPlatform.prototype = {
{
this.robots.forEach((robot, i) =>
{
this.log("Found robot #" + (i + 1) + " named \"" + robot.device.name + "\" with serial \"" + robot.device._serial + "\"");
this.log("Found robot #" + (i + 1) + " named \"" + robot.device.name + "\" with serial \"" + robot.device._serial.substring(0,9) + "XXXXXXXXXXXX\"");
// Start Update Intervall
this.updateRobotTimer(robot.device._serial);
@@ -67,6 +67,11 @@ NeatoVacuumRobotPlatform.prototype = {
robot.mainAccessory = mainAccessory;
robot.roomAccessories = [];
// For testing purposes only
// let roomAccessory = new NeatoVacuumRobotAccessory(this, robot, {name: "Testzimmer", id: "1"});
// accessories.push(roomAccessory);
// robot.roomAccessories.push(roomAccessory);
if (robot.device.maps)
{
robot.device.maps.forEach((map) =>
@@ -206,13 +211,13 @@ NeatoVacuumRobotPlatform.prototype = {
else
{
debug(robot.device.name + ": ++ Updating robot state");
robot.lastUpdate = new Date();
robot.device.getState((error, result) =>
{
if (error)
{
this.log.error("Cannot update robot. Check if robot is online. " + error);
}
robot.lastUpdate = new Date();
callback();
});
}