From 16140dc71e7f123cc5dbfbc3bd2e7b9f446ee859 Mon Sep 17 00:00:00 2001 From: Arne Blumentritt Date: Sun, 25 Apr 2021 19:35:34 +0200 Subject: [PATCH] Fixed #61 Warnings in homebridge 1.3 because of illegal characteristic values --- accessories/koboldVacuumRobot.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/accessories/koboldVacuumRobot.js b/accessories/koboldVacuumRobot.js index 0be1c3d..a571760 100644 --- a/accessories/koboldVacuumRobot.js +++ b/accessories/koboldVacuumRobot.js @@ -516,7 +516,7 @@ KoboldVacuumRobotAccessory.prototype = { getSpotClean: function (callback) { - callback(); + callback(false, this.spotCleanService.getCharacteristic(Characteristic.On).value); }, setSpotClean: function (on, callback) @@ -674,8 +674,13 @@ KoboldVacuumRobotAccessory.prototype = { if (this.spotPlusFeatures) { - this.spotCleanService.setCharacteristic(SpotWidthCharacteristic, this.robot.spotWidth); - this.spotCleanService.setCharacteristic(SpotHeightCharacteristic, this.robot.spotHeight); + let widthProps = this.spotCleanService.getCharacteristic(SpotWidthCharacteristic).props; + let heightProps = this.spotCleanService.getCharacteristic(SpotHeightCharacteristic).props; + + this.spotCleanService.setCharacteristic(SpotWidthCharacteristic, + this.robot.spotWidth >= widthProps.minValue && this.robot.spotWidth <= widthProps.maxValue ? this.robot.spotWidth : widthProps.minValue); + this.spotCleanService.setCharacteristic(SpotHeightCharacteristic, + this.robot.spotHeight >= heightProps.minValue && this.robot.spotHeight <= heightProps.maxValue ? this.robot.spotHeight : heightProps.minValue); } }