diff --git a/accessories/neatoVacuumRobot.js b/accessories/neatoVacuumRobot.js index c3b95fd..7171d5f 100644 --- a/accessories/neatoVacuumRobot.js +++ b/accessories/neatoVacuumRobot.js @@ -231,7 +231,10 @@ NeatoVacuumRobotAccessory.prototype = { if (this.robot.canResume) { debug(this.name + ": ## Resume cleaning"); - this.robot.resumeCleaning(callback); + this.robot.resumeCleaning((error) => + { + callback(error); + }); } // Start cleaning else if (this.robot.canStart) @@ -273,7 +276,10 @@ NeatoVacuumRobotAccessory.prototype = { if (this.robot.canPause) { debug(this.name + ": ## Pause cleaning"); - this.robot.pauseCleaning(callback); + this.robot.pauseCleaning((error) => + { + callback(error); + }); } else { @@ -309,12 +315,8 @@ NeatoVacuumRobotAccessory.prototype = { if (error) { this.log.error("Cannot start cleaning. " + error + ": " + JSON.stringify(result)); - callback(true); - } - else - { - callback(); } + callback(error); }); } // Room cleaning @@ -325,12 +327,8 @@ NeatoVacuumRobotAccessory.prototype = { if (error) { this.log.error("Cannot start room cleaning. " + error + ": " + JSON.stringify(result)); - callback(true); - } - else - { - callback(); } + callback(error); }); } // Spot cleaning @@ -341,12 +339,8 @@ NeatoVacuumRobotAccessory.prototype = { if (error) { this.log.error("Cannot start spot cleaning. " + error + ": " + JSON.stringify(result)); - callback(true); - } - else - { - callback(); } + callback(error); }); } }, @@ -370,14 +364,20 @@ NeatoVacuumRobotAccessory.prototype = { setTimeout(() => { debug(this.name + ": ## Go to dock"); - this.robot.sendToBase(callback); + this.robot.sendToBase(() => + { + callback(); + }); }, 1000); }); } else if (this.robot.canGoToBase) { debug(this.name + ": ## Go to dock"); - this.robot.sendToBase(callback); + this.robot.sendToBase(() => + { + callback(); + }); } else { @@ -456,12 +456,18 @@ NeatoVacuumRobotAccessory.prototype = { if (on) { debug(this.name + ": " + "Enabled".brightGreen + " Schedule"); - this.robot.enableSchedule(callback); + this.robot.enableSchedule((error) => + { + callback(error); + }); } else { debug(this.name + ": " + "Disabled".red + " Schedule"); - this.robot.disableSchedule(callback); + this.robot.disableSchedule((error) => + { + callback(error); + }); } }); }, @@ -481,7 +487,10 @@ NeatoVacuumRobotAccessory.prototype = { this.findMeService.setCharacteristic(Characteristic.On, false); }, 1000); - this.robot.findMe(callback); + this.robot.findMe((error) => + { + callback(error); + }); } }, @@ -527,7 +536,10 @@ NeatoVacuumRobotAccessory.prototype = { if (this.robot.canPause) { debug(this.name + ": ## Pause cleaning"); - this.robot.pauseCleaning(callback); + this.robot.pauseCleaning((error) => + { + callback(error); + }); } else {