Skip to content

Commit

Permalink
Vacuum now refreshes properties after actions
Browse files Browse the repository at this point in the history
  • Loading branch information
aholstenson committed Feb 17, 2018
1 parent 1fe03f5 commit f38181d
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions lib/devices/vacuum.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,31 @@ module.exports = class extends Vacuum.with(
* Start a cleaning session.
*/
activateCleaning() {
return this.call('app_start', [])
return this.call('app_start', [], {
refresh: [ 'state' ],
refreshDelay: 1000
})
.then(checkResult);
}

/**
* Pause the current cleaning session.
*/
pause() {
return this.call('app_pause', [])
return this.call('app_pause', [], {
refresh: [ 'state ']
})
.then(checkResult);
}

/**
* Stop the current cleaning session.
*/
deactivateCleaning() {
return this.call('app_stop', [])
return this.call('app_stop', [], {
refresh: [ 'state' ],
refreshDelay: 1000
})
.then(checkResult);
}

Expand All @@ -188,15 +196,20 @@ module.exports = class extends Vacuum.with(
activateCharging() {
return this.call('app_stop', [])
.then(checkResult)
.then(() => this.call('app_charge', []))
.then(() => this.call('app_charge', [], {
refresh: [ 'state' ],
refreshDelay: 1000
}))
.then(checkResult);
}

/**
* Start cleaning the current spot.
*/
activateSpotClean() {
return this.call('app_spot', [])
return this.call('app_spot', [], {
refresh: [ 'state' ]
})
.then(checkResult);
}

Expand All @@ -205,8 +218,9 @@ module.exports = class extends Vacuum.with(
*/
changeFanSpeed(speed) {
return this.call('set_custom_mode', [ speed ], {
refresh: true
});
refresh: [ 'fanSpeed' ]
})
.then(checkResult);
}

/**
Expand Down

0 comments on commit f38181d

Please sign in to comment.