How to use dorita980 - 9 common examples

To help you get started, we’ve selected a few dorita980 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thkl / Homematic-Virtual-Interface / plugins / CleanOMat980 / CleanOMat980Platform.js View on Github external
CleanOMat980Platform.prototype.command = function (command) {
  // send command to the robot
  var that = this
  let cred = this.credentials()
  if (cred != undefined) {
	this.myRobotViaLocal = new dorita980.Local(cred.blid, cred.pwd, cred.ip); // robot IP address
	
	this.myRobotViaLocal.on('connect', function () {
		that.log.debug('connected to robot')
		switch (command) {
			case 'start':
				
				setTimeout(function(){
				that.log.debug('start command')
			 	that.myRobotViaLocal.start().then(() => {
					that.log.debug('end connection')
			 		that.myRobotViaLocal.end(); 
  				}).catch((err) => {
  					that.log.error(err);
  				});
					
				}, 500);
github Zefau / ioBroker.roomba / roomba.js View on Github external
function connect(user, password, ip)
{
	adapter.log.info('Connecting to Roomba (' + ip + ')..');
	try
	{
		return new _dorita980.Local(user, password, ip);
	}
	catch(err)
	{
		adapter.log.error('Could not connect to Roomba! See debug for more details.');
		adapter.log.debug(err.message); // this will not be trigged due to an issue in dorita980 library (see https://github.com/koalazak/dorita980/issues/75 )
		return false;
	}
}
github Zefau / ioBroker.roomba / main.js View on Github external
function connect(user, password, ip)
{
	adapter.log.info('Connecting to Roomba..');
	try
	{
		return new _dorita980.Local(user, password, ip);
	}
	catch(err)
	{
		adapter.log.warn(err.message); // this will not be trigged due to an issue in dorita980 library (see https://github.com/koalazak/dorita980/issues/75)
	}
}
github koalazak / rest980 / routes / api.js View on Github external
var knownIP = robotIP;
var firmwareVersion = parseInt((process.env.FIRMWARE_VERSION || config.firmwareVersion || 1), 10);
var enableLocal = process.env.ENABLE_LOCAL || config.enableLocal || 'yes';
var enableCloud = process.env.ENABLE_CLOUD || config.enableCloud || 'yes';
var keepAlive = process.env.KEEP_ALIVE || config.keepAlive || 'yes';

// Temporal:
if (firmwareVersion === 2) enableCloud = 'no';

if (!blid || !password) {
  throw new Error('Config not found. Please edit config/default.json file with your robot credentials. Or set BLID, PASSWORD and ROBOT_IP enviroment variables.');
}

var myRobot = {};

var handleIP = (robotIP || enableLocal === 'no') ? function (cb) { cb(null, robotIP); } : dorita980.getRobotIP;
handleIP(function (e, ip) {
  if (e) throw e;
  knownIP = ip;
  if (enableLocal === 'yes') {
    if (firmwareVersion === 1 || (keepAlive === 'yes')) myRobot.local = new dorita980.Local(blid, password, ip, firmwareVersion);
  }
  if (enableCloud === 'yes') myRobot.cloud = new dorita980.Cloud(blid, password, firmwareVersion);
});

router.get('/', function (req, res) {
  res.send({
    version: '1.0.' + firmwareVersion}
  );
});

/*
github koalazak / rest980 / routes / api.js View on Github external
function sendAndDisconnect (method, args, res, next) {
  let client = new dorita980.Local(blid, password, knownIP, 2);
  client.on('connect', function () {
    client[method](args).then(function (resp) {
      res.send(resp);
      client.end();
    }).catch(next);
  });
}
github koalazak / rest980 / routes / api.js View on Github external
handleIP(function (e, ip) {
  if (e) throw e;
  knownIP = ip;
  if (enableLocal === 'yes') {
    if (firmwareVersion === 1 || (keepAlive === 'yes')) myRobot.local = new dorita980.Local(blid, password, ip, firmwareVersion);
  }
  if (enableCloud === 'yes') myRobot.cloud = new dorita980.Cloud(blid, password, firmwareVersion);
});
github Zefau / ioBroker.roomba / roomba.js View on Github external
break;
			
			/*
			case 'encrypt':
				adapter.log.debug('Encrypted message.');
				library.msg(msg.from, msg.command, {result: true, data: {password: encryptor.encrypt(adapter.config.encryptionKey, msg.message.cleartext)}}, msg.callback);
				break;
				
			case 'decrypt':
				adapter.log.debug('Decrypted message.');
				library.msg(msg.from, msg.command, {result: true, data: {cleartext: encryptor.decrypt(adapter.config.encryptionKey, msg.message.password)}}, msg.callback);
				break;
			*/
			
			case 'getIp':
				_dorita980.getRobotIP(function(err, ip)
				{
					adapter.log.debug('Retrieved IP address: ' + ip);
					library.msg(msg.from, msg.command, err ? {result: false, error: err.message} : {result: true, data: {ip: ip}}, msg.callback);
				});
				break;
				
			case 'getRobotData':
				getRobotData(function(res)
				{
					adapter.log.debug('Retrieved robot data: ' + JSON.stringify(res));
					library.msg(msg.from, msg.command, res, msg.callback);
				}, msg.message !== null ? msg.message.ip : undefined);
				break;
				
			case 'getPassword':
				msg.message.encryption = msg.message.encryption === undefined ? true : msg.message.encryption;
github Zefau / ioBroker.roomba / main.js View on Github external
break;
			
			/*
			case 'encrypt':
				adapter.log.debug('Encrypted message.');
				library.msg(msg.from, msg.command, {result: true, data: {password: encryptor.encrypt(adapter.config.encryptionKey, msg.message.cleartext)}}, msg.callback);
				break;
				
			case 'decrypt':
				adapter.log.debug('Decrypted message.');
				library.msg(msg.from, msg.command, {result: true, data: {cleartext: encryptor.decrypt(adapter.config.encryptionKey, msg.message.password)}}, msg.callback);
				break;
			*/
			
			case 'getIp':
				_dorita980.getRobotIP(function(err, ip)
				{
					adapter.log.debug('Retrieved IP address: ' + ip);
					library.msg(msg.from, msg.command, err ? {result: false, error: err.message} : {result: true, data: {ip: ip}}, msg.callback);
				});
				break;
				
			case 'getRobotData':
				getRobotData(function(res)
				{
					adapter.log.debug('Retrieved robot data: ' + JSON.stringify(res));
					library.msg(msg.from, msg.command, res, msg.callback);
				}, msg.message !== null ? msg.message.ip : undefined);
				break;
				
			case 'getPassword':
				msg.message.encryption = msg.message.encryption === undefined ? true : msg.message.encryption;
github koalazak / rest980 / routes / api.js View on Github external
handleIP(function (e, ip) {
  if (e) throw e;
  knownIP = ip;
  if (enableLocal === 'yes') {
    if (firmwareVersion === 1 || (keepAlive === 'yes')) myRobot.local = new dorita980.Local(blid, password, ip, firmwareVersion);
  }
  if (enableCloud === 'yes') myRobot.cloud = new dorita980.Cloud(blid, password, firmwareVersion);
});

dorita980

Unofficial iRobot Roomba 980 and wifi other enabled series library sdk

MIT
Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis