Skip to content

Commit

Permalink
Release 2.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jghaanstra committed Feb 17, 2018
1 parent d80f40d commit e565509
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions drivers/mi-robot/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit e565509

Please sign in to comment.