From e565509343d9874c488a31b658f44c22cb2179d6 Mon Sep 17 00:00:00 2001 From: jghaanstra Date: Sat, 17 Feb 2018 19:36:06 +0100 Subject: [PATCH] Release 2.5.3 --- drivers/mi-robot/device.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/mi-robot/device.js b/drivers/mi-robot/device.js index 497e465..d4c7cd1 100644 --- a/drivers/mi-robot/device.js +++ b/drivers/mi-robot/device.js @@ -40,23 +40,35 @@ class MiRobotDevice extends Homey.Device { switch (value) { case "cleaning": this.miio.clean() - .then(result => { callback(null, value) }) + .then(result => { + this.setCapabilityValue('onoff', true); + callback(null, value); + }) .catch(error => { callback(error, false) }); break; case "spot_cleaning": this.miio.cleanSpot() - .then(result => { callback(null, value) }) + .then(result => { + this.setCapabilityValue('onoff', true); + callback(null, value); + }) .catch(error => { callback(error, false) }); break; case "stopped": this.miio.stop() - .then(result => { callback(null, value) }) + .then(result => { + this.setCapabilityValue('onoff', false); + callback(null, value); + }) .catch(error => { callback(error, false) }); break; case "docked": case "charging": this.miio.charge() - .then(result => { callback(null, value) }) + .then(result => { + this.setCapabilityValue('onoff', false); + callback(null, value); + }) .catch(error => { callback(error, false) }); break; default: @@ -86,10 +98,10 @@ class MiRobotDevice extends Homey.Device { if (this.miio.property('state') == 'charging') { var onoff = false; var state = 'charging'; - } else if (this.miio.property('state') == 'docked' || this.miio.property('state') == 'full') { + } else if (this.miio.property('state') == 'docked' || this.miio.property('state') == 'full' || this.miio.property('state') == 'returning') { var onoff = false; var state = 'docked'; - } else if (this.miio.property('state') == 'cleaning' || this.miio.property('state') == 'returning') { + } else if (this.miio.property('state') == 'cleaning' || this.miio.property('state') == 'zone-cleaning') { var onoff = true; var state = 'cleaning'; } else if (this.miio.property('state') == 'waiting' || this.miio.property('state') == 'paused') {