node-kobold-oauth
v0.2.0
Published
Vorwerk Kobold API for VR200 and VR300
Downloads
27
Maintainers
Readme
node-kobold
A node module for Vorwerk Kobold VR200 and VR300.
Based on Pmant's node-botvac, thanks to tomrosenback's PHP Port, kangguru's and naofireblade's work on the undocumented Neato / Vorwerk API.
Installation
npm install node-kobold
Usage Example (old auth using password)
var kobold = require('node-kobold');
var client = new kobold.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);
});
}
});
});
Usage OAuth2 (for i.e. MyKobold app)
var kobold = require('node-kobold');
var client = new kobold.Client();
//authorize
client.setToken(token);
//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.setToken()
- client.getRobots()
client.authorize(email, password, force, callback)
Login at the Vorwerk api.
email
- your Vorwerk emailpassword
- your Vorwerk passwortforce
- force login if already authorizedcallback
-function(error)
error
null if no error occurred
client.setToken(token)
Set a token that you already gathered via the oauth workflow
token
- the OAuth token you acquired
client.getRobots(callback)
Returns an array containing your registered robots.
callback
-function(error, robots)
error
null if no error occurredrobots
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.isCharging
booleanrobot.isDocked
booleanrobot.isScheduleEnabled
booleanrobot.dockHasBeenSeen
booleanrobot.charge
number - charge in percentrobot.canStart
boolean - robot is ready to start cleaningrobot.canStop
boolean - cleaning can be stoppedrobot.canPause
boolean - cleaning can be pausedrobot.canResume
boolean - cleaning can be resumedrobot.canGoToBase
boolean - robot can be sent to baserobot.eco
boolean - set to true to clean in eco moderobot.noGoLines
boolean - set to true to enable noGoLinesrobot.navigationMode
number - 1: normal, 2: extra care (new models only)robot.spotWidth
number - width for spot cleaning in cmrobot.spotHeight
number - height for spot cleaning in cmrobot.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.sendToBase()
robot.getState([callback])
Returns the state object of the robot. Also updates all robot properties.
callback
-function(error, state)
error
null
if no error occurredstate
object
- example:
VR200
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: 'VR200',
firmware: '2.1.3'
}
};
VR300
var state = {
version: 1,
reqId: '1',
result: 'ok',
data: {},
error: null,
alert: null,
state: 1,
action: 0,
cleaning: {
category: 4,
mode: 1,
modifier: 1,
navigationMode: 1,
mapId: '',
spotWidth: 0,
spotHeight: 0
},
details: {
isCharging: false,
isDocked: true,
isScheduleEnabled: false,
dockHasBeenSeen: false,
charge: 99
},
availableCommands: {
start: true,
stop: false,
pause: false,
resume: false,
goToBase: false
},
availableServices: {
findMe: 'basic-1',
generalInfo: 'basic-1',
houseCleaning: 'basic-3',
IECTest: 'advanced-1',
logCopy: 'basic-1',
manualCleaning: 'basic-1',
maps: 'advanced-1',
preferences: 'basic-1',
schedule: 'basic-1',
softwareUpdate: 'basic-1',
spotCleaning: 'basic-1',
wifi: 'basic-1'
},
meta: {
modelName: 'VR220',
firmware: '4.2.4-162'
}
};
robot.getSchedule([callback])
Returns the scheduling state of the robot.
callback
-function(error, schedule)
error
null if no error occurredschedule
boolean - true if scheduling is enabled
robot.enableSchedule([callback])
Enables scheduling.
callback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if scheduling got enabled
robot.disableSchedule([callback])
Disables scheduling.
callback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if scheduling got disabled
robot.startCleaning([eco], [navigationMode], [noGoLines], [callback])
Start cleaning.
eco
boolean - clean in eco modenavigationMode
number - 1: normal, 2: extra care (new neato models only)noGoLines
boolean - clean with enabled nogo linescallback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if cleaning could be started
robot.startSpotCleaning([eco], [width], [height], [repeat], [navigationMode], [callback])
Start spot cleaning.
eco
boolean - clean in eco modewidth
number - spot width in cm (min 100cm)height
number - spot height in cm (min 100cm)repeat
boolean - clean spot two timesnavigationMode
number - 1: normal, 2: extra care (new neato models only)callback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if spot cleaning could be started
robot.stopCleaning([callback])
Stop cleaning.
callback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if cleaning could be stopped
robot.pauseCleaning([callback])
Pause cleaning.
callback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if cleaning could be paused
robot.resumeCleaning([callback])
Resume cleaning.
callback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if cleaning could be resumed
robot.sendToBase([callback])
Send robot to base.
callback
-function(error, result)
error
null if no error occurredresult
string - 'ok' if robot could be sent to base
Changelog
0.1.0
- (nicoh88) initial release
0.1.2
- (nicoh88) update for npmjs
0.1.3
- (nicoh88) NoGo Lines and options sync
- (nicoh88) Syncing cleaning options from last runupdate for npmjs
0.2.0
- (carlambroselli) Add oauth2 option