Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d8ca308338 | ||
|
75180b27cb | ||
|
b8971b64a9 | ||
|
32e47d0a8f |
@@ -113,4 +113,7 @@
|
|||||||
* Fixed room switches not supporting pause/resume
|
* Fixed room switches not supporting pause/resume
|
||||||
|
|
||||||
## 0.7.1
|
## 0.7.1
|
||||||
* Fixed robot not shown before setting up a floor plan
|
* Fixed robot not shown before setting up a floor plan
|
||||||
|
|
||||||
|
## 0.7.2
|
||||||
|
* Fixed homebridge crash with multiple robots per account
|
19
README.md
19
README.md
@@ -17,9 +17,9 @@ Feel free to leave any feedback [here](https://github.com/naofireblade/homebridg
|
|||||||
- Eco mode
|
- Eco mode
|
||||||
- Extra care navigation
|
- Extra care navigation
|
||||||
- Nogo lines
|
- Nogo lines
|
||||||
- Zone cleaning* (only D7)
|
- Zone cleaning <sup>[1](#d7)</sup><sup>, </sup><sup>[2](#change-room)</sup>
|
||||||
- Spot cleaning
|
- Spot cleaning
|
||||||
- Individual spot size (only D7)
|
- Individual spot size <sup>[1](#d7)</sup>
|
||||||
- Clean twice
|
- Clean twice
|
||||||
- Return to dock
|
- Return to dock
|
||||||
- Find the robot
|
- Find the robot
|
||||||
@@ -32,7 +32,9 @@ Feel free to leave any feedback [here](https://github.com/naofireblade/homebridg
|
|||||||
- Automatic or periodic refresh of robot state
|
- Automatic or periodic refresh of robot state
|
||||||
- Multiple robots
|
- Multiple robots
|
||||||
|
|
||||||
>*You can also send the robot from one room to another. He will return to the base, wait there some seconds and then starts cleaning the other room.
|
> <b name="d7">1</b> Only available on the Neato D7.
|
||||||
|
|
||||||
|
> <b name="change-room">2</b> You can send the robot from one room to another as well. He will return to the base, wait there some seconds and then starts cleaning the next room.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -59,11 +61,16 @@ Add the following information to your config file. Change the values for email a
|
|||||||
|
|
||||||
### Advanced
|
### Advanced
|
||||||
|
|
||||||
The following config contains advanced optional settings.
|
Below are explanations for advanced parameters to adjust the plugin to your needs. All parameters are *optional*.
|
||||||
|
|
||||||
The parameter **refresh** is default set to `auto` and updates the robot state when a cleaning was started via homekit so that you can activate automations based on a successful cleaning. If you want to get robot state updates after starting the cleaning from outside of homekit as well (neato app or schedule), you have to set refresh to a static value in seconds e.g. `120`. You can disable background updates completely by setting this to `0`.
|
**refresh**
|
||||||
|
Timer for periodic refresh of robot state. The default is `auto`. The options are:
|
||||||
|
`auto` Updates the robot state when a cleaning was started via homekit so that you can activate automations based on a successful cleaning.
|
||||||
|
`120` Or any other time in seconds (minimum `60`) is required if you want to receive robot state updates after starting the cleaning from outside of homekit (e.g. neato app or schedule).
|
||||||
|
`0` Disables background updates completely.
|
||||||
|
|
||||||
The parameter **hidden** accepts a list of switches/sensors that can be hidden from homekit (e.g. `dock`, `dockstate`, `eco`, `nogolines`, `extracare`, `schedule`, `find`, `spot`).
|
**hidden**
|
||||||
|
List of plugin features that you don't want to use in homekit (e.g. `dock`, `dockstate`, `eco`, `nogolines`, `extracare`, `schedule`, `find`, `spot`).
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"platforms": [
|
"platforms": [
|
||||||
|
@@ -17,6 +17,9 @@ module.exports = function (_Service, _Characteristic)
|
|||||||
{
|
{
|
||||||
Service = _Service;
|
Service = _Service;
|
||||||
Characteristic = _Characteristic;
|
Characteristic = _Characteristic;
|
||||||
|
SpotWidthCharacteristic = require('../characteristics/spotWidth')(Characteristic, CustomUUID);
|
||||||
|
SpotHeightCharacteristic = require('../characteristics/spotHeight')(Characteristic, CustomUUID);
|
||||||
|
SpotRepeatCharacteristic = require('../characteristics/spotRepeat')(Characteristic, CustomUUID);
|
||||||
|
|
||||||
return NeatoVacuumRobotAccessory;
|
return NeatoVacuumRobotAccessory;
|
||||||
};
|
};
|
||||||
@@ -32,7 +35,7 @@ function NeatoVacuumRobotAccessory(platform, robotObject)
|
|||||||
this.robotObject = robotObject;
|
this.robotObject = robotObject;
|
||||||
this.robot = robotObject.device;
|
this.robot = robotObject.device;
|
||||||
this.meta = robotObject.meta;
|
this.meta = robotObject.meta;
|
||||||
this.availableServices = robotObject.availableServices;
|
this.spotPlusFeatures = ((typeof robotObject.availableServices.spotCleaning !== 'undefined') && robotObject.availableServices.spotCleaning.includes("basic"));
|
||||||
this.boundary = (typeof robotObject.boundary === 'undefined') ? null : robotObject.boundary;
|
this.boundary = (typeof robotObject.boundary === 'undefined') ? null : robotObject.boundary;
|
||||||
|
|
||||||
if (this.boundary == null)
|
if (this.boundary == null)
|
||||||
@@ -74,23 +77,12 @@ function NeatoVacuumRobotAccessory(platform, robotObject)
|
|||||||
this.scheduleService = new Service.Switch(this.name + " Schedule", "schedule");
|
this.scheduleService = new Service.Switch(this.name + " Schedule", "schedule");
|
||||||
this.findMeService = new Service.Switch(this.name + " Find Me", "findMe");
|
this.findMeService = new Service.Switch(this.name + " Find Me", "findMe");
|
||||||
|
|
||||||
SpotWidthCharacteristic = require('../characteristics/spotWidth')(Characteristic, CustomUUID);
|
this.spotCleanService = new Service.Switch(this.name + " Clean Spot", "cleanSpot");
|
||||||
SpotHeightCharacteristic = require('../characteristics/spotHeight')(Characteristic, CustomUUID);
|
this.spotCleanService.addCharacteristic(SpotRepeatCharacteristic);
|
||||||
SpotRepeatCharacteristic = require('../characteristics/spotRepeat')(Characteristic, CustomUUID);
|
if (this.spotPlusFeatures)
|
||||||
|
|
||||||
// Spot cleaning with advanced options
|
|
||||||
if ((typeof this.availableServices.spotCleaning !== 'undefined') && this.availableServices.spotCleaning.includes("basic"))
|
|
||||||
{
|
{
|
||||||
this.spotCleanAdvancedService = new Service.Switch(this.name + " Clean Spot", "cleanSpot");
|
this.spotCleanService.addCharacteristic(SpotWidthCharacteristic);
|
||||||
this.spotCleanAdvancedService.addCharacteristic(SpotRepeatCharacteristic);
|
this.spotCleanService.addCharacteristic(SpotHeightCharacteristic);
|
||||||
this.spotCleanAdvancedService.addCharacteristic(SpotWidthCharacteristic);
|
|
||||||
this.spotCleanAdvancedService.addCharacteristic(SpotHeightCharacteristic);
|
|
||||||
}
|
|
||||||
// Spot cleaning without advanced options
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.spotCleanSimpleService = new Service.Switch(this.name + " Clean Spot", "cleanSpot");
|
|
||||||
this.spotCleanSimpleService.addCharacteristic(SpotRepeatCharacteristic);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -166,29 +158,22 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
this.findMeService.getCharacteristic(Characteristic.On).on('set', this.setFindMe.bind(this));
|
this.findMeService.getCharacteristic(Characteristic.On).on('set', this.setFindMe.bind(this));
|
||||||
this.findMeService.getCharacteristic(Characteristic.On).on('get', this.getFindMe.bind(this));
|
this.findMeService.getCharacteristic(Characteristic.On).on('get', this.getFindMe.bind(this));
|
||||||
|
|
||||||
if (typeof this.spotCleanAdvancedService !== 'undefined')
|
this.spotCleanService.getCharacteristic(Characteristic.On).on('set', this.setSpotClean.bind(this));
|
||||||
{
|
this.spotCleanService.getCharacteristic(Characteristic.On).on('get', this.getSpotClean.bind(this));
|
||||||
this.spotCleanAdvancedService.getCharacteristic(Characteristic.On).on('set', this.setSpotClean.bind(this));
|
this.spotCleanService.getCharacteristic(SpotRepeatCharacteristic).on('set', this.setSpotRepeat.bind(this));
|
||||||
this.spotCleanAdvancedService.getCharacteristic(Characteristic.On).on('get', this.getSpotClean.bind(this));
|
this.spotCleanService.getCharacteristic(SpotRepeatCharacteristic).on('get', this.getSpotRepeat.bind(this));
|
||||||
this.spotCleanAdvancedService.getCharacteristic(SpotRepeatCharacteristic).on('set', this.setSpotRepeat.bind(this));
|
|
||||||
this.spotCleanAdvancedService.getCharacteristic(SpotRepeatCharacteristic).on('get', this.getSpotRepeat.bind(this));
|
|
||||||
this.spotCleanAdvancedService.getCharacteristic(SpotWidthCharacteristic).on('set', this.setSpotWidth.bind(this));
|
|
||||||
this.spotCleanAdvancedService.getCharacteristic(SpotWidthCharacteristic).on('get', this.getSpotWidth.bind(this));
|
|
||||||
this.spotCleanAdvancedService.getCharacteristic(SpotHeightCharacteristic).on('set', this.setSpotHeight.bind(this));
|
|
||||||
this.spotCleanAdvancedService.getCharacteristic(SpotHeightCharacteristic).on('get', this.getSpotHeight.bind(this));
|
|
||||||
|
|
||||||
if (this.hiddenServices.indexOf('spot') === -1)
|
if (this.spotPlusFeatures)
|
||||||
this.services.push(this.spotCleanAdvancedService);
|
{
|
||||||
|
this.spotCleanService.getCharacteristic(SpotWidthCharacteristic).on('set', this.setSpotWidth.bind(this));
|
||||||
|
this.spotCleanService.getCharacteristic(SpotWidthCharacteristic).on('get', this.getSpotWidth.bind(this));
|
||||||
|
this.spotCleanService.getCharacteristic(SpotHeightCharacteristic).on('set', this.setSpotHeight.bind(this));
|
||||||
|
this.spotCleanService.getCharacteristic(SpotHeightCharacteristic).on('get', this.getSpotHeight.bind(this));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
this.spotCleanSimpleService.getCharacteristic(Characteristic.On).on('set', this.setSpotClean.bind(this));
|
|
||||||
this.spotCleanSimpleService.getCharacteristic(Characteristic.On).on('get', this.getSpotClean.bind(this));
|
|
||||||
this.spotCleanSimpleService.getCharacteristic(SpotRepeatCharacteristic).on('set', this.setSpotRepeat.bind(this));
|
|
||||||
this.spotCleanSimpleService.getCharacteristic(SpotRepeatCharacteristic).on('get', this.getSpotRepeat.bind(this));
|
|
||||||
|
|
||||||
if (this.hiddenServices.indexOf('spot') === -1)
|
if (this.hiddenServices.indexOf('spot') === -1)
|
||||||
this.services.push(this.spotCleanSimpleService);
|
{
|
||||||
|
this.services.push(this.spotCleanService);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add optional services
|
// Add optional services
|
||||||
@@ -507,12 +492,10 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
|
|
||||||
setSpotClean: function (on, callback)
|
setSpotClean: function (on, callback)
|
||||||
{
|
{
|
||||||
let spotCleanService = (typeof this.spotCleanAdvancedService !== 'undefined') ? this.spotCleanAdvancedService : this.spotCleanSimpleService;
|
|
||||||
|
|
||||||
let spot = {
|
let spot = {
|
||||||
width: spotCleanService.getCharacteristic(SpotWidthCharacteristic).value,
|
width: this.spotPlusFeatures ? this.spotCleanService.getCharacteristic(SpotWidthCharacteristic).value : null,
|
||||||
height: spotCleanService.getCharacteristic(SpotHeightCharacteristic).value,
|
height: this.spotPlusFeatures ? this.spotCleanService.getCharacteristic(SpotHeightCharacteristic).value : null,
|
||||||
repeat: spotCleanService.getCharacteristic(SpotRepeatCharacteristic).value
|
repeat: this.spotCleanService.getCharacteristic(SpotRepeatCharacteristic).value
|
||||||
};
|
};
|
||||||
|
|
||||||
this.platform.updateRobot(this.robot._serial, (error, result) =>
|
this.platform.updateRobot(this.robot._serial, (error, result) =>
|
||||||
@@ -658,15 +641,12 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
this.noGoLinesService.setCharacteristic(Characteristic.On, this.robot.noGoLines);
|
this.noGoLinesService.setCharacteristic(Characteristic.On, this.robot.noGoLines);
|
||||||
this.extraCareService.setCharacteristic(Characteristic.On, this.robot.navigationMode == 2 ? true : false);
|
this.extraCareService.setCharacteristic(Characteristic.On, this.robot.navigationMode == 2 ? true : false);
|
||||||
|
|
||||||
if (typeof this.spotCleanAdvancedService !== 'undefined')
|
this.spotCleanService.setCharacteristic(SpotRepeatCharacteristic, this.robot.spotRepeat);
|
||||||
|
|
||||||
|
if (this.spotPlusFeatures)
|
||||||
{
|
{
|
||||||
this.spotCleanAdvancedService.setCharacteristic(SpotWidthCharacteristic, this.robot.spotWidth);
|
this.spotCleanService.setCharacteristic(SpotWidthCharacteristic, this.robot.spotWidth);
|
||||||
this.spotCleanAdvancedService.setCharacteristic(SpotHeightCharacteristic, this.robot.spotHeight);
|
this.spotCleanService.setCharacteristic(SpotHeightCharacteristic, this.robot.spotHeight);
|
||||||
this.spotCleanAdvancedService.setCharacteristic(SpotRepeatCharacteristic, this.robot.spotRepeat);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.spotCleanSimpleService.setCharacteristic(SpotRepeatCharacteristic, this.robot.spotRepeat);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
203
index.js
203
index.js
@@ -4,12 +4,14 @@ let inherits = require('util').inherits,
|
|||||||
botvac = require('node-botvac'),
|
botvac = require('node-botvac'),
|
||||||
|
|
||||||
Service,
|
Service,
|
||||||
Characteristic;
|
Characteristic,
|
||||||
|
NeatoVacuumRobotAccessory;
|
||||||
|
|
||||||
module.exports = function (homebridge)
|
module.exports = function (homebridge)
|
||||||
{
|
{
|
||||||
Service = homebridge.hap.Service;
|
Service = homebridge.hap.Service;
|
||||||
Characteristic = homebridge.hap.Characteristic;
|
Characteristic = homebridge.hap.Characteristic;
|
||||||
|
NeatoVacuumRobotAccessory = require('./accessories/neatoVacuumRobot')(Service, Characteristic);
|
||||||
homebridge.registerPlatform("homebridge-neato", "NeatoVacuumRobot", NeatoVacuumRobotPlatform);
|
homebridge.registerPlatform("homebridge-neato", "NeatoVacuumRobot", NeatoVacuumRobotPlatform);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,50 +56,70 @@ NeatoVacuumRobotPlatform.prototype = {
|
|||||||
debug("Get robots");
|
debug("Get robots");
|
||||||
let accessories = [];
|
let accessories = [];
|
||||||
this.boundaryNames = [];
|
this.boundaryNames = [];
|
||||||
|
|
||||||
this.getRobots(() =>
|
this.getRobots(() =>
|
||||||
{
|
{
|
||||||
this.robots.forEach((robot, i) =>
|
// // MOCK MULTIPLE ROBOTS START
|
||||||
{
|
// let client = new botvac.Client();
|
||||||
this.log("Found robot #" + (i + 1) + " named \"" + robot.device.name + "\" with serial \"" + robot.device._serial.substring(0,9) + "XXXXXXXXXXXX\"");
|
// client.authorize(this.email, this.password, false, (error) =>
|
||||||
|
// {
|
||||||
|
// client.getRobots((error, robs) =>
|
||||||
|
// {
|
||||||
|
// let testRobot = robs[0];
|
||||||
|
// testRobot.getState((error, result) =>
|
||||||
|
// {
|
||||||
|
// testRobot.name = "Testrobot";
|
||||||
|
// this.robots.push({device: testRobot, meta: result.meta, availableServices: result.availableServices});
|
||||||
|
// // MOCK MULTIPLE ROBOTS END
|
||||||
|
|
||||||
// Start Update Intervall
|
this.robots.forEach((robot, i) =>
|
||||||
this.updateRobotTimer(robot.device._serial);
|
|
||||||
|
|
||||||
let NeatoVacuumRobotAccessory = require('./accessories/neatoVacuumRobot')(Service, Characteristic);
|
|
||||||
let mainAccessory = new NeatoVacuumRobotAccessory(this, robot);
|
|
||||||
accessories.push(mainAccessory);
|
|
||||||
|
|
||||||
robot.mainAccessory = mainAccessory;
|
|
||||||
robot.roomAccessories = [];
|
|
||||||
|
|
||||||
// For testing purposes only
|
|
||||||
// robot.boundary = {name: "Testroom", id: "1"};
|
|
||||||
// let roomAccessory = new NeatoVacuumRobotAccessory(this, robot);
|
|
||||||
// accessories.push(roomAccessory);
|
|
||||||
// robot.roomAccessories.push(roomAccessory);
|
|
||||||
|
|
||||||
if (robot.device.maps)
|
|
||||||
{
|
|
||||||
robot.device.maps.forEach((map) =>
|
|
||||||
{
|
|
||||||
if (map.boundaries)
|
|
||||||
{
|
{
|
||||||
map.boundaries.forEach((boundary) =>
|
this.log("Found robot #" + (i + 1) + " named \"" + robot.device.name + "\" with serial \"" + robot.device._serial.substring(0, 9) + "XXXXXXXXXXXX\"");
|
||||||
{
|
|
||||||
if (boundary.type === "polygon")
|
|
||||||
{
|
|
||||||
robot.boundary = boundary;
|
|
||||||
let roomAccessory = new NeatoVacuumRobotAccessory(this, robot);
|
|
||||||
accessories.push(roomAccessory);
|
|
||||||
|
|
||||||
robot.roomAccessories.push(roomAccessory);
|
let mainAccessory = new NeatoVacuumRobotAccessory(this, robot);
|
||||||
}
|
accessories.push(mainAccessory);
|
||||||
})
|
|
||||||
}
|
robot.mainAccessory = mainAccessory;
|
||||||
})
|
robot.roomAccessories = [];
|
||||||
}
|
|
||||||
});
|
// Start Update Intervall
|
||||||
callback(accessories);
|
this.updateRobotTimer(robot.device._serial);
|
||||||
|
|
||||||
|
// // MOCK ZONE CLEANING START
|
||||||
|
// robot.boundary = {name: "Testroom", id: "1"};
|
||||||
|
// let roomAccessory = new NeatoVacuumRobotAccessory(this, robot);
|
||||||
|
// accessories.push(roomAccessory);
|
||||||
|
// robot.roomAccessories.push(roomAccessory);
|
||||||
|
// // MOCK ZONE CLEANING END
|
||||||
|
|
||||||
|
if (robot.device.maps)
|
||||||
|
{
|
||||||
|
robot.device.maps.forEach((map) =>
|
||||||
|
{
|
||||||
|
if (map.boundaries)
|
||||||
|
{
|
||||||
|
map.boundaries.forEach((boundary) =>
|
||||||
|
{
|
||||||
|
if (boundary.type === "polygon")
|
||||||
|
{
|
||||||
|
robot.boundary = boundary;
|
||||||
|
let roomAccessory = new NeatoVacuumRobotAccessory(this, robot);
|
||||||
|
accessories.push(roomAccessory);
|
||||||
|
|
||||||
|
robot.roomAccessories.push(roomAccessory);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
callback(accessories);
|
||||||
|
|
||||||
|
// // MOCK MULTIPLE ROBOTS START
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// // MOCK MULTIPLE ROBOTS END
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -137,46 +159,68 @@ NeatoVacuumRobotPlatform.prototype = {
|
|||||||
|
|
||||||
robots.forEach((robot) =>
|
robots.forEach((robot) =>
|
||||||
{
|
{
|
||||||
// Get all maps for each robot
|
// Get additional information for the robot
|
||||||
robot.getPersistentMaps((error, result) =>
|
robot.getState((error, state) =>
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
this.log.error("Error updating persistent maps: " + error + ": " + result);
|
this.log.error("Error getting robot meta information: " + error + ": " + state);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
// Robot has no maps
|
|
||||||
else if (result.length === 0)
|
|
||||||
{
|
|
||||||
robot.maps = [];
|
|
||||||
this.saveRobot(robot, loadedRobots, robots.length, callback);
|
|
||||||
}
|
|
||||||
// Robot has maps
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
robot.maps = result;
|
// Get all maps for each robot
|
||||||
let loadedMaps = 0;
|
robot.getPersistentMaps((error, maps) =>
|
||||||
robot.maps.forEach((map) =>
|
|
||||||
{
|
{
|
||||||
// Save zones in each map
|
if (error)
|
||||||
robot.getMapBoundaries(map.id, (error, result) =>
|
|
||||||
{
|
{
|
||||||
if (error)
|
this.log.error("Error updating persistent maps: " + error + ": " + maps);
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
// Robot has no maps
|
||||||
|
else if (maps.length === 0)
|
||||||
|
{
|
||||||
|
robot.maps = [];
|
||||||
|
this.robots.push({device: robot, meta: state.meta, availableServices: state.availableServices});
|
||||||
|
loadedRobots++;
|
||||||
|
if (loadedRobots === robots.length)
|
||||||
{
|
{
|
||||||
this.log.error("Error getting boundaries: " + error + ": " + result)
|
callback();
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
// Robot has maps
|
||||||
|
else
|
||||||
|
{
|
||||||
|
robot.maps = maps;
|
||||||
|
let loadedMaps = 0;
|
||||||
|
robot.maps.forEach((map) =>
|
||||||
{
|
{
|
||||||
map.boundaries = result.boundaries;
|
// Save zones in each map
|
||||||
}
|
robot.getMapBoundaries(map.id, (error, result) =>
|
||||||
loadedMaps++;
|
{
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
this.log.error("Error getting boundaries: " + error + ": " + result)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map.boundaries = result.boundaries;
|
||||||
|
}
|
||||||
|
loadedMaps++;
|
||||||
|
|
||||||
// Robot is completely requested if zones for all maps are loaded
|
// Robot is completely requested if zones for all maps are loaded
|
||||||
if (loadedMaps === robot.maps.length)
|
if (loadedMaps === robot.maps.length)
|
||||||
{
|
{
|
||||||
this.saveRobot(robot, loadedRobots, robots.length, callback);
|
this.robots.push({device: robot, meta: state.meta, availableServices: state.availableServices});
|
||||||
}
|
loadedRobots++;
|
||||||
})
|
if (loadedRobots === robots.length)
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -187,31 +231,6 @@ NeatoVacuumRobotPlatform.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
saveRobot: function (robot, loadedRobots, size, callback)
|
|
||||||
{
|
|
||||||
// Get additional information for the robot
|
|
||||||
robot.getState((error, result) =>
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
this.log.error("Error getting robot meta information: " + error + ": " + result);
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Store the robot with his information, maps and zones
|
|
||||||
this.robots.push({device: robot, meta: result.meta, availableServices: result.availableServices});
|
|
||||||
loadedRobots++;
|
|
||||||
|
|
||||||
// Initial request is complete if all robots are loaded.
|
|
||||||
if (loadedRobots === size)
|
|
||||||
{
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
updateRobot: function (serial, callback)
|
updateRobot: function (serial, callback)
|
||||||
{
|
{
|
||||||
let robot = this.getRobot(serial);
|
let robot = this.getRobot(serial);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "homebridge-neato",
|
"name": "homebridge-neato",
|
||||||
"version": "0.7.1",
|
"version": "0.7.2",
|
||||||
"description": "A Neato vacuum robot plugin for homebridge.",
|
"description": "A Neato vacuum robot plugin for homebridge.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
Reference in New Issue
Block a user