Improved go to dock command

This commit is contained in:
naofireblade 2017-05-04 19:24:33 +02:00
parent 5dbdb18c58
commit b2ddecc827
4 changed files with 22 additions and 7 deletions

View File

@ -9,4 +9,8 @@
## 0.2.0 ## 0.2.0
* Added dock info * Added dock info
* Changed logging to debug library * Improved logging to use a debug library
## 0.2.1
* Improved the go to dock command

View File

@ -7,12 +7,16 @@ Feel free to leave any feedback [here](https://github.com/naofireblade/homebridg
# Features # Features
- Start and pause cleaning - Start and pause cleaning
- Return to dock - Return to dock\*
- Enable and disable schedule - Enable and disable schedule
- Enable and disable eco mode - Enable and disable eco mode
- Get battery info - Get battery info
- Get dock info - Get dock info
\* The robot needs to clean for some seconds before he knows where his dock is. After this time the switch to send him home will be automatically available.
**Hint:** To control the robot with your own commands just set up a scene with the name of your choice.
# Installation # Installation
1. Install homebridge using: `npm install -g homebridge` 1. Install homebridge using: `npm install -g homebridge`

View File

@ -92,10 +92,16 @@ NeatoVacuumRobot.prototype = {
dock: function (on, callback) { dock: function (on, callback) {
let that = this; let that = this;
if (on) { if (on) {
debug("Go to dock"); debug("Pause cleaning to go to dock");
that.robot.sendToBase(false, function (error, result) { this.robot.pauseCleaning(false, function (error, result) {
that.log(result); that.log(result);
}); });
setTimeout(function() {
debug("Go to dock");
that.robot.sendToBase(false, function (error, result) {
that.log(result);
});
}, 3000);
} }
callback(); callback();
}, },
@ -134,8 +140,8 @@ NeatoVacuumRobot.prototype = {
getCanGoToDock: function(callback) { getCanGoToDock: function(callback) {
let that = this; let that = this;
this.getState(function (error, result) { this.getState(function (error, result) {
debug("Can go to dock: " + that.robot.canGoToBase); debug("Can go to dock: " + that.robot.dockHasBeenSeen);
callback(false, !that.robot.canGoToBase); callback(false, !that.robot.dockHasBeenSeen);
}); });
}, },
@ -143,6 +149,7 @@ NeatoVacuumRobot.prototype = {
let that = this; let that = this;
this.getState(function (error, result) { this.getState(function (error, result) {
debug("Is docked: " + that.robot.isDocked); debug("Is docked: " + that.robot.isDocked);
debug(that.robot);
callback(false, that.robot.isDocked); callback(false, that.robot.isDocked);
}); });
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "homebridge-neato", "name": "homebridge-neato",
"version": "0.2.0", "version": "0.2.1",
"description": "A Neato vacuum robot plugin for homebridge.", "description": "A Neato vacuum robot plugin for homebridge.",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [