Home

Awesome

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

<a name="example"></a>

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);
        });
    }
});

Getting a token

You can get a token using the following two curl commands:

# This will trigger the email sending
curl -X "POST" "https://mykobold.eu.auth0.com/passwordless/start" \
     -H 'Content-Type: application/json' \
     -d $'{
  "send": "code",
  "email": "ENTER_YOUR_EMAIL_HERE",
  "client_id": "KY4YbVAvtgB7lp8vIbWQ7zLk3hssZlhR",
  "connection": "email"
}'

==== wait for the email to be received ====

# this will generate a token using the numbers you received via email
# replace the value of otp 123456 with the value you received from the email
curl -X "POST" "https://mykobold.eu.auth0.com/oauth/token" \
     -H 'Content-Type: application/json' \
     -d $'{
  "prompt": "login",
  "grant_type": "http://auth0.com/oauth/grant-type/passwordless/otp",
  "scope": "openid email profile read:current_user",
  "locale": "en",
  "otp": "123456",
  "source": "vorwerk_auth0",
  "platform": "ios",
  "audience": "https://mykobold.eu.auth0.com/userinfo",
  "username": "ENTER_YOUR_EMAIL_HERE",
  "client_id": "KY4YbVAvtgB7lp8vIbWQ7zLk3hssZlhR",
  "realm": "email",
  "country_code": "DE"
}'

From the output, you want to copy the id_token value.

<a name="client"></a>

Client API


<a name="authorize"></a>

client.authorize(email, password, force, callback)

Login at the Vorwerk api.


<a name="setToken"></a>

client.setToken(token)

Set a token that you already gathered via the oauth workflow


<a name="getRobots"></a>

client.getRobots(callback)

Returns an array containing your registered <a href="#robot">robots</a>.

<a name="robot"></a>

Robot Properties

These properties will be updated every time <a href="#getState"><code>robot.<b>getState()</b></code></a> is called:

<a name="api"></a>

Robot API


<a name="getState"></a>

robot.getState([callback])

Returns the state object of the robot. Also updates all robot properties.

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'
  }
};

<a name="getSchedule"></a>

robot.getSchedule([callback])

Returns the scheduling state of the robot.


<a name="enableSchedule"></a>

robot.enableSchedule([callback])

Enables scheduling.


<a name="disableSchedule"></a>

robot.disableSchedule([callback])

Disables scheduling.


<a name="startCleaning"></a>

robot.startCleaning([eco], [navigationMode], [noGoLines], [callback])

Start cleaning.


<a name="startSpotCleaning"></a>

robot.startSpotCleaning([eco], [width], [height], [repeat], [navigationMode], [callback])

Start spot cleaning.


<a name="stopCleaning"></a>

robot.stopCleaning([callback])

Stop cleaning.


<a name="pauseCleaning"></a>

robot.pauseCleaning([callback])

Pause cleaning.


<a name="resumeCleaning"></a>

robot.resumeCleaning([callback])

Resume cleaning.


<a name="sendToBase"></a>

robot.sendToBase([callback])

Send robot to base.

Changelog

0.1.0

0.1.2

0.1.3

0.2.0