From b2ddecc8272cd97dd9dc018d477fe4e314407afc Mon Sep 17 00:00:00 2001 From: naofireblade Date: Thu, 4 May 2017 19:24:33 +0200 Subject: [PATCH] Improved go to dock command --- CHANGELOG.md | 6 +++++- README.md | 6 +++++- index.js | 15 +++++++++++---- package.json | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ee226f..0c2fb34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,4 +9,8 @@ ## 0.2.0 * Added dock info -* Changed logging to debug library \ No newline at end of file +* Improved logging to use a debug library + +## 0.2.1 + +* Improved the go to dock command \ No newline at end of file diff --git a/README.md b/README.md index 3df1d64..b8211f2 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,16 @@ Feel free to leave any feedback [here](https://github.com/naofireblade/homebridg # Features - Start and pause cleaning -- Return to dock +- Return to dock\* - Enable and disable schedule - Enable and disable eco mode - Get battery 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 1. Install homebridge using: `npm install -g homebridge` diff --git a/index.js b/index.js index 0862dee..f262597 100644 --- a/index.js +++ b/index.js @@ -92,10 +92,16 @@ NeatoVacuumRobot.prototype = { dock: function (on, callback) { let that = this; if (on) { - debug("Go to dock"); - that.robot.sendToBase(false, function (error, result) { + debug("Pause cleaning to go to dock"); + this.robot.pauseCleaning(false, function (error, result) { that.log(result); }); + setTimeout(function() { + debug("Go to dock"); + that.robot.sendToBase(false, function (error, result) { + that.log(result); + }); + }, 3000); } callback(); }, @@ -134,8 +140,8 @@ NeatoVacuumRobot.prototype = { getCanGoToDock: function(callback) { let that = this; this.getState(function (error, result) { - debug("Can go to dock: " + that.robot.canGoToBase); - callback(false, !that.robot.canGoToBase); + debug("Can go to dock: " + that.robot.dockHasBeenSeen); + callback(false, !that.robot.dockHasBeenSeen); }); }, @@ -143,6 +149,7 @@ NeatoVacuumRobot.prototype = { let that = this; this.getState(function (error, result) { debug("Is docked: " + that.robot.isDocked); + debug(that.robot); callback(false, that.robot.isDocked); }); }, diff --git a/package.json b/package.json index f9b51da..ddf7b3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-neato", - "version": "0.2.0", + "version": "0.2.1", "description": "A Neato vacuum robot plugin for homebridge.", "license": "MIT", "keywords": [