9 Commits

Author SHA1 Message Date
naofireblade
b2ddecc827 Improved go to dock command 2017-05-04 19:24:38 +02:00
naofireblade
5dbdb18c58 Set theme jekyll-theme-cayman 2017-04-30 18:07:17 +02:00
naofireblade
d49cab1e97 Set theme jekyll-theme-cayman 2017-04-30 18:06:45 +02:00
naofireblade
92eabfe5cd Wording 2017-04-30 14:35:23 +02:00
naofireblade
67b930653f Wording 2017-04-30 14:17:21 +02:00
naofireblade
579bd32a93 Readme 2017-04-28 18:12:22 +02:00
naofireblade
a606d4c632 Version 0.2.0
* Added dock info
* Changed logging to debug library
2017-04-22 22:57:09 +02:00
naofireblade
3a4327f7e9 spelling 2017-04-18 02:59:07 +02:00
naofireblade
cbfbb26b14 spelling 2017-04-18 02:51:59 +02:00
7 changed files with 93 additions and 120 deletions

17
.gitattributes vendored
View File

@@ -1,17 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

47
.gitignore vendored
View File

@@ -1,47 +0,0 @@
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

View File

@@ -4,4 +4,13 @@
* Added return to base
* Added enable and disable schedule
* Added enable and disable eco mode
* Added battery info
* Added battery info
## 0.2.0
* Added dock info
* Improved logging to use a debug library
## 0.2.1
* Improved the go to dock command

View File

@@ -1,40 +1,46 @@
# homebridge-neato
This is a plugin to control your [Neato](https://www.neatorobotics.com/) vacuum robot.
This is a plugin for [homebridge](https://github.com/nfarina/homebridge) to control your [Neato](https://www.neatorobotics.com/) vacuum robot. You can download it via [npm](https://www.npmjs.com/package/homebridge-neato).
Feel free to leave any feedback [here](https://github.com/naofireblade/homebridge-neato/issues).
# Features
- Start and pause cleaning
- 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
2. Install this plugin using: npm install -g homebridge-neato
3. Update your configuration file. See the sample below.
1. Install homebridge using: `npm install -g homebridge`
2. Install this plugin using: `npm install -g homebridge-neato`
3. If you don't have a Neato account yet create one [here](https://www.neatorobotics.com/create-account/).
4. Update your configuration file. See the sample below.
# Configuration
Configuration sample:
### Configuration
Add the following information to your config file. Change the values for name, email and password.
```json
"accessories": [
{
"accessory": "NeatoVacuumRobot",
"name": "YourRobot",
"email": "YourEmail",
"password": "YourPassword"
}
]
{
"accessory": "NeatoVacuumRobot",
"name": "YourRobot",
"email": "YourEmail",
"password": "YourPassword"
}
]
```
# Features
- Atart and pause cleaning
- Return to base
- Enable and disable schedule
- Enable and disable eco mode
- Get battery info
# Tested robots
- BotVac Connected Firmware 2.2.0
- BotVac Connected (Firmware 2.2.0)
if you have another connected neato robot, please [tell me](https://github.com/naofireblade/homebridge-neato/issues/new) your experience with this plugin.
If you have another connected neato robot, please [tell me](https://github.com/naofireblade/homebridge-neato/issues) your experience with this plugin.

1
_config.yml Normal file
View File

@@ -0,0 +1 @@
theme: jekyll-theme-cayman

View File

@@ -1,5 +1,6 @@
"use strict";
var inherits = require('util').inherits;
var debug = require('debug')('homebridge-neato');
var botvac = require('node-botvac');
var Service, Characteristic;
@@ -38,9 +39,12 @@ NeatoVacuumRobot.prototype = {
this.vacuumRobotCleanService.getCharacteristic(Characteristic.On).on('set', this.clean.bind(this));
this.vacuumRobotCleanService.getCharacteristic(Characteristic.On).on('get', this.getClean.bind(this));
this.vacuumRobotDockService = new Service.Switch(this.name + " Dock", "dock");
this.vacuumRobotDockService.getCharacteristic(Characteristic.On).on('set', this.dock.bind(this));
this.vacuumRobotDockService.getCharacteristic(Characteristic.On).on('get', this.getDock.bind(this));
this.vacuumRobotGoToDockService = new Service.Switch(this.name + " Go to Dock", "goToDock");
this.vacuumRobotGoToDockService.getCharacteristic(Characteristic.On).on('set', this.dock.bind(this));
this.vacuumRobotGoToDockService.getCharacteristic(Characteristic.On).on('get', this.getCanGoToDock.bind(this));
this.vacuumRobotDockStateService = new Service.OccupancySensor(this.name + " Dock", "dockState");
this.vacuumRobotDockStateService.getCharacteristic(Characteristic.OccupancyDetected).on('get', this.getDockState.bind(this));
this.vacuumRobotEcoService = new Service.Switch(this.name + " Eco Mode", "eco");
this.vacuumRobotEcoService.getCharacteristic(Characteristic.On).on('set', this.eco.bind(this));
@@ -54,7 +58,7 @@ NeatoVacuumRobot.prototype = {
this.vacuumRobotBatteryService.getCharacteristic(Characteristic.BatteryLevel).on('get', this.getBatteryLevel.bind(this));
this.vacuumRobotBatteryService.getCharacteristic(Characteristic.ChargingState).on('get', this.getBatteryChargingState.bind(this));
return [this.informationService, this.vacuumRobotCleanService, this.vacuumRobotDockService, this.vacuumRobotEcoService,
return [this.informationService, this.vacuumRobotCleanService, this.vacuumRobotGoToDockService, this.vacuumRobotDockStateService, this.vacuumRobotEcoService,
this.vacuumRobotScheduleService, this.vacuumRobotBatteryService];
},
@@ -62,15 +66,14 @@ NeatoVacuumRobot.prototype = {
let that = this;
if (on) {
this.getState(function (error, result) {
that.log(that.robot);
if (that.robot.canResume === true) {
that.log("Resume cleaning");
debug("Resume cleaning");
that.robot.resumeCleaning(function (error, result) {
that.log(result);
});
}
else {
that.log("Start cleaning");
debug("Start cleaning");
that.robot.startCleaning(that.robot.eco, function (error, result) {
that.log(result);
});
@@ -78,7 +81,7 @@ NeatoVacuumRobot.prototype = {
});
}
else {
this.log("Pause cleaning");
debug("Pause cleaning");
this.robot.pauseCleaning(false, function (error, result) {
that.log(result);
});
@@ -88,33 +91,39 @@ NeatoVacuumRobot.prototype = {
dock: function (on, callback) {
let that = this;
that.log(that.robot);
if (on) {
that.log("Send 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();
},
eco: function (on, callback) {
this.log(on ? "Enable eco mode" : "Disable eco mode");
debug(on ? "Enable eco mode" : "Disable eco mode");
this.robot.eco = on;
callback();
},
schedule: function (on, callback) {
let that = this;
if (on) {
this.log("Enable schedule");
debug("Enable schedule");
this.robot.enableSchedule(false, function (error, result) {
onsole.log(result);
that.log(result);
});
}
else {
this.log("Disable schedule");
debug("Disable schedule");
this.robot.disableSchedule(false, function (error, result) {
onsole.log(result);
that.log(result);
});
}
callback();
@@ -123,16 +132,24 @@ NeatoVacuumRobot.prototype = {
getClean: function(callback) {
let that = this;
this.getState(function (error, result) {
that.log("Is cleaning: " + that.robot.canPause);
debug("Is cleaning: " + that.robot.canPause);
callback(false, that.robot.canPause);
});
},
getDock: function(callback) {
getCanGoToDock: function(callback) {
let that = this;
this.getState(function (error, result) {
that.log("Can go to dock: " + that.robot.canGoToBase);
that.log("Is docked: " + that.robot.isDocked);
debug("Can go to dock: " + that.robot.dockHasBeenSeen);
callback(false, !that.robot.dockHasBeenSeen);
});
},
getDockState: function(callback) {
let that = this;
this.getState(function (error, result) {
debug("Is docked: " + that.robot.isDocked);
debug(that.robot);
callback(false, that.robot.isDocked);
});
},
@@ -140,7 +157,7 @@ NeatoVacuumRobot.prototype = {
getEco: function(callback) {
let that = this;
this.getState(function (error, result) {
that.log("Eco mode: " + that.robot.eco);
debug("Eco mode: " + that.robot.eco);
callback(false, that.robot.eco);
});
},
@@ -148,7 +165,7 @@ NeatoVacuumRobot.prototype = {
getSchedule: function(callback) {
let that = this;
this.getState(function (error, result) {
that.log("Schedule: " + that.robot.isScheduleEnabled);
debug("Schedule: " + that.robot.isScheduleEnabled);
callback(false, that.robot.isScheduleEnabled);
});
},
@@ -157,7 +174,7 @@ NeatoVacuumRobot.prototype = {
getBatteryLevel: function(callback) {
let that = this;
this.getState(function (error, result) {
that.log("Battery: " + that.robot.charge);
debug("Battery: " + that.robot.charge);
callback(false, that.robot.charge);
});
},
@@ -165,7 +182,7 @@ NeatoVacuumRobot.prototype = {
getBatteryChargingState: function(callback) {
let that = this;
this.getState(function (error, result) {
that.log("Is charging: " + that.robot.isCharging);
debug("Is charging: " + that.robot.isCharging);
callback(false, that.robot.isCharging);
});
},
@@ -185,11 +202,11 @@ NeatoVacuumRobot.prototype = {
_getState: function(callback) {
if (this.lastUpdate !== null && new Date() - this.lastUpdate < 2000) {
//this.log("Get state (cached)");
debug("Get info (cached)");
callback();
}
else {
//this.log("Get state (new)");
debug("Get info (new)");
let that = this;
this.robot.getState(function (error, result) {
that.lastUpdate = new Date();
@@ -199,7 +216,7 @@ NeatoVacuumRobot.prototype = {
},
getRobot: function(callback) {
//this.log("Get robot");
debug("Get robot");
let client = new botvac.Client();
let that = this;
client.authorize(this.email, this.password, false, function (error) {
@@ -214,6 +231,7 @@ NeatoVacuumRobot.prototype = {
else {
that.robot = robots[0];
that.log("Found robot: " + that.robot.name);
debug(that.robot);
callback();
}
});

View File

@@ -1,10 +1,12 @@
{
"name": "homebridge-neato",
"version": "0.1.0",
"description": "control your neato vacuum robot",
"version": "0.2.1",
"description": "A Neato vacuum robot plugin for homebridge.",
"license": "MIT",
"keywords": [
"homebridge-plugin"
"homebridge-plugin",
"neato",
"botvac"
],
"engines": {
"node": ">=0.12.0",
@@ -18,6 +20,7 @@
"url": "git://github.com/naofireblade/homebridge-neato.git"
},
"dependencies": {
"node-botvac": ">=0.1.4"
"node-botvac": "^0.1.4",
"debug": "^2.2.0"
}
}