How to use the dorita980.getRobotIP function in dorita980

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

dorita980

Unofficial iRobot Roomba 980 and wifi other enabled series library sdk

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis