node-botvac
A node module for Neato Botvac Connected.
Based on tomrosenbacks
PHP Port and
kanggurus work on the undocumented Neato API.
Installation
``
npm install node-botvac`
Usage Example
`
Javascript
var botvac = require('node-botvac');
var client = new botvac.Client();
//authorize
client.authorize('email', 'password', false, function (error) {
if (error) {
console.log(error);
return;
}
//get your robots
client.getRobots(function (error, robots) {
if (error) {
console.log(error);
return;
}
if (robots.length) {
//do something
robots[0].getState(function (error, result) {
console.log(result);
});
}
});
});
`
Client API
* client.authorize()
* client.getRobots()
-------------------------------------------------------
$3
Login at the neato api.
* email
- your neato email
* password
- your neato passwort
* force
- force login if already authorized
* callback
- function(error)
* error
null if no error occurred
-------------------------------------------------------
$3
Returns an array containing your registered robots.
* callback
- function(error, robots)
* error
null if no error occurred
* robots
array - your robots
Robot Properties
* `
robot.name`
- nickname of this robot (cannot be changed)
These properties will be updated every time robot.getState() is called:
* `
robot.isBinFull`
boolean
* `
robot.isCharging`
boolean
* `
robot.isDocked`
boolean
* `
robot.isScheduleEnabled`
boolean
* `
robot.dockHasBeenSeen`
boolean
* `
robot.charge`
number - charge in percent
* `
robot.canStart`
boolean - robot is ready to start cleaning
* `
robot.canStop`
boolean - cleaning can be stopped
* `
robot.canPause`
boolean - cleaning can be paused
* `
robot.canResume`
boolean - cleaning can be resumed
* `
robot.canGoToBase`
boolean - robot can be sent to base
* `
robot.eco`
boolean - set to true to clean in eco mode
* `
robot.noGoLines`
boolean - set to true to enable noGoLines
* `
robot.navigationMode`
number - 1: normal, 2: extra care (new models only)
* `
robot.spotWidth`
number - width for spot cleaning in cm
* `
robot.spotHeight`
number - height for spot cleaning in cm
* `
robot.spotRepeat`
boolean - set to true to clean spot two times
Robot API
* robot.getState()
* robot.getSchedule()
* robot.enableSchedule()
* robot.disableSchedule()
* robot.startCleaning()
* robot.startSpotCleaning()
* robot.stopCleaning()
* robot.pauseCleaning()
* robot.resumeCleaning()
* robot.getPersistentMaps()
* robot.getMapBoundaries()
* robot.setMapBoundaries()
* robot.startCleaningBoundary()
* robot.sendToBase()
* robot.findMe()
-------------------------------------------------------
$3
Returns the state object of the robot. Also updates all robot properties.
* callback
- function(error, state)
* error
`
null`
if no error occurred
* state
`
object`
* example:
`
Javascript
var state = {
version: 1,
reqId: '1',
result: 'ok',
error: 'ui_alert_invalid',
data: {},
state: 1,
action: 0,
cleaning: {category: 2, mode: 1, modifier: 1, spotWidth: 0, spotHeight: 0},
details: {
isCharging: false,
isDocked: true,
isScheduleEnabled: false,
dockHasBeenSeen: false,
charge: 98
},
availableCommands: {
start: true,
stop: false,
pause: false,
resume: false,
goToBase: false
},
availableServices: {
houseCleaning: 'basic-1',
spotCleaning: 'basic-1',
manualCleaning: 'basic-1',
easyConnect: 'basic-1',
schedule: 'basic-1'
},
meta: {modelName: 'BotVacConnected', firmware: '2.0.0'}};
`
-------------------------------------------------------
$3
Returns the scheduling state of the robot.
* detailed
- boolean
boolean, to return the full schedule object, not only it status
* callback
- function(error, schedule)
* error
`
null`
if no error occurred
* schedule
depend on detailed
* `
boolean`
(when detailed
is undefined
or false
) true if scheduling is enabled
* `
object`
(when detailed
is true
) full schedule description object
* example:
`
Javascript
var schedule = {
type:1,
enabled:true,
events:[
{
day:1,
startTime:"08:30"
},
{
day:2,
startTime:"08:30"
},
{
day:3,
startTime:"08:30"
},
{
day:4,
startTime:"08:30"
},
{
day:5,
startTime:"08:30"
},
{
day:6,
startTime:"11:30"
},
{
day:0,
startTime:"11:30"
}
]
}
`
-------------------------------------------------------
$3
Enables scheduling.
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if scheduling got enabled
-------------------------------------------------------
$3
Disables scheduling.
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if scheduling got disabled
-------------------------------------------------------
$3
Start cleaning.
* eco
boolean - clean in eco mode
* navigationMode
number - 1: normal, 2: extra care (new models only)
* eco
boolean - clean with enabled nogo lines
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if cleaning could be started
-------------------------------------------------------
$3
Start spot cleaning.
* eco
boolean - clean in eco mode
* width
number - spot width in cm (min 100cm)
* height
number - spot height in cm (min 100cm)
* repeat
boolean - clean spot two times
* navigationMode
number - 1: normal, 2: extra care (new models only)
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if spot cleaning could be started
-------------------------------------------------------
$3
Stop cleaning.
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if cleaning could be stopped
-------------------------------------------------------
$3
Pause cleaning.
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if cleaning could be paused
-------------------------------------------------------
$3
Resume cleaning.
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if cleaning could be resumed
-------------------------------------------------------
$3
Returns the persistent maps of the robot
* callback
- function(error, schedule)
* error
null if no error occurred
* maps
Maps[] - array of maps
-------------------------------------------------------
$3
Returns the boundaries of a map
* mapId
string - a Map id for which to get the boundaries
* callback
- function(error, schedule)
* error
null if no error occurred
* boundaries
Boundary[] - array of boundaries
-------------------------------------------------------
$3
Sets boundaries for a map
* mapId
string - a Map id for which to get the boundaries
* boundaries
Boundary[] - array of boundaries
* callback
- function(error, schedule)
* error
null if no error occurred
* boundaries
Boundary[] - array of boundaries
-------------------------------------------------------
$3
Start cleaning with boundaries
* eco
boolean - clean in eco mode
* extraCare
boolean - clean in extra care (new models only)
* boundaryId
string - a boundary id (zone) to clean
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if cleaning could be started
-------------------------------------------------------
$3
Send robot to base.
* callback
- function(error, result)
* error
null if no error occurred
* result
string - 'ok' if robot could be sent to base
-------------------------------------------------------
$3
Locate the robot by emitting a sound and light
* callback
- function(error, result)
* error
null if no error occurred
* result` string - 'ok' if robot could be located
Changelog
$3
* (Pmant) update dependencies
$3
* (PeterVoronov) add optional detailed parameter to robot.getSchedule
* (naofireblade) add isBinFull property
* (naofireblade) prevent request from catching exceptions in callback
$3
* (jbtibor) update dependencies
$3
* (naofireblade) add findMe
$3
* (az0uz) add persistent maps and boundaries
$3
* (koush) http transport changes and updates
$3
* (naofireblade) add support for new parameter navigationMode (newer models)
$3
* (naofireblade) add support for new parameter noGoLines (newer models)
* (naofireblade) changed to keep cleaning parameters in sync with neato app