From ae7138e24543d6aeaf35d76afb4639eb38f46397 Mon Sep 17 00:00:00 2001 From: Arne Blumentritt Date: Sun, 25 Apr 2021 20:05:46 +0200 Subject: [PATCH] Fixed homebridge 1.3 warning because of additional parameter in setter callback --- accessories/koboldVacuumRobot.js | 58 +++++++++++++++++++------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/accessories/koboldVacuumRobot.js b/accessories/koboldVacuumRobot.js index a571760..a1d9817 100644 --- a/accessories/koboldVacuumRobot.js +++ b/accessories/koboldVacuumRobot.js @@ -260,7 +260,10 @@ KoboldVacuumRobotAccessory.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) @@ -302,7 +305,10 @@ KoboldVacuumRobotAccessory.prototype = { if (this.robot.canPause) { debug(this.name + ": ## Pause cleaning"); - this.robot.pauseCleaning(callback); + this.robot.pauseCleaning((error) => + { + callback(error); + }); } else { @@ -338,12 +344,8 @@ KoboldVacuumRobotAccessory.prototype = { if (error) { this.log.error("Cannot start cleaning. " + error + ": " + JSON.stringify(result)); - callback(true); - } - else - { - callback(); } + callback(error); }); } // Room cleaning @@ -354,12 +356,8 @@ KoboldVacuumRobotAccessory.prototype = { if (error) { this.log.error("Cannot start room cleaning. " + error + ": " + JSON.stringify(result)); - callback(true); - } - else - { - callback(); } + callback(error); }); } // Spot cleaning @@ -370,12 +368,8 @@ KoboldVacuumRobotAccessory.prototype = { if (error) { this.log.error("Cannot start spot cleaning. " + error + ": " + JSON.stringify(result)); - callback(true); - } - else - { - callback(); } + callback(error); }); } }, @@ -399,14 +393,20 @@ KoboldVacuumRobotAccessory.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 { @@ -485,12 +485,18 @@ KoboldVacuumRobotAccessory.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); + }); } }); }, @@ -510,7 +516,10 @@ KoboldVacuumRobotAccessory.prototype = { this.findMeService.setCharacteristic(Characteristic.On, false); }, 1000); - this.robot.findMe(callback); + this.robot.findMe((error) => + { + callback(error); + }); } }, @@ -556,7 +565,10 @@ KoboldVacuumRobotAccessory.prototype = { if (this.robot.canPause) { debug(this.name + ": ## Pause cleaning"); - this.robot.pauseCleaning(callback); + this.robot.pauseCleaning((error) => + { + callback(error); + }); } else {