Fixed some issues and added more device info
This commit is contained in:
parent
114ff70d60
commit
c6def8c0fc
@ -107,3 +107,5 @@
|
||||
* Fixed room switches not taking eco and extraCare mode into account
|
||||
* Fixed room switches to support pause/resume of cleaning
|
||||
* Added feature that enabling another room switch, returns to robot to dock and starts cleaning the new room automatically
|
||||
* Improved requests for multiple rooms (TODO)
|
||||
* Added model and firmware information to homekit
|
@ -20,6 +20,7 @@ function NeatoVacuumRobotAccessory(robotObject, platform, boundary = undefined)
|
||||
this.hiddenServices = platform.hiddenServices;
|
||||
this.robot = robotObject.device;
|
||||
this.nextRoom = null;
|
||||
this.meta = robotObject.meta;
|
||||
|
||||
if (typeof boundary === 'undefined')
|
||||
{
|
||||
@ -51,7 +52,7 @@ function NeatoVacuumRobotAccessory(robotObject, platform, boundary = undefined)
|
||||
|
||||
if (typeof boundary === 'undefined')
|
||||
{
|
||||
this.vacuumRobotCleanService = new Service.Switch("Clean", "clean");
|
||||
this.vacuumRobotCleanService = new Service.Switch(this.name + " Clean", "clean");
|
||||
this.vacuumRobotGoToDockService = new Service.Switch(this.name + " Go to Dock", "goToDock");
|
||||
this.vacuumRobotDockStateService = new Service.OccupancySensor(this.name + " Dock", "dockState");
|
||||
this.vacuumRobotEcoService = new Service.Switch(this.name + " Eco Mode", "eco");
|
||||
@ -95,8 +96,9 @@ NeatoVacuumRobotAccessory.prototype = {
|
||||
this.informationService = new Service.AccessoryInformation();
|
||||
this.informationService
|
||||
.setCharacteristic(Characteristic.Manufacturer, "Neato Robotics")
|
||||
.setCharacteristic(Characteristic.Model, "Coming soon")
|
||||
.setCharacteristic(Characteristic.SerialNumber, this.robot._serial);
|
||||
.setCharacteristic(Characteristic.Model, this.meta.modelName)
|
||||
.setCharacteristic(Characteristic.SerialNumber, this.robot._serial)
|
||||
.setCharacteristic(Characteristic.FirmwareRevision, this.meta.firmware);
|
||||
if (typeof this.boundary === "undefined")
|
||||
{
|
||||
this.informationService
|
||||
@ -200,15 +202,13 @@ NeatoVacuumRobotAccessory.prototype = {
|
||||
// Start
|
||||
if (on)
|
||||
{
|
||||
debug(typeof boundary);
|
||||
debug(boundary);
|
||||
// No room given or same room
|
||||
if (typeof boundary === 'undefined' || this.robot.cleaningBoundaryId === boundary.id)
|
||||
{
|
||||
// Resume cleaning
|
||||
if (this.robot.canResume)
|
||||
{
|
||||
debug(this.name + ": Resume cleaning");
|
||||
debug(this.name + ": ## Resume cleaning");
|
||||
this.robot.resumeCleaning(callback);
|
||||
}
|
||||
// Start cleaning
|
||||
@ -229,7 +229,7 @@ NeatoVacuumRobotAccessory.prototype = {
|
||||
// Return to dock
|
||||
if (this.robot.canPause || this.robot.canResume)
|
||||
{
|
||||
debug(this.name + ": Returning to dock to start cleaning of new room");
|
||||
debug(this.name + ": ## Returning to dock to start cleaning of new room");
|
||||
this.setGoToDock(true, (error, result) =>
|
||||
{
|
||||
this.nextRoom = boundary;
|
||||
@ -247,7 +247,7 @@ NeatoVacuumRobotAccessory.prototype = {
|
||||
{
|
||||
if (this.robot.canPause)
|
||||
{
|
||||
debug(this.name + ": Pause cleaning");
|
||||
debug(this.name + ": ## Pause cleaning");
|
||||
this.robot.pauseCleaning(callback);
|
||||
}
|
||||
else
|
||||
@ -275,7 +275,7 @@ NeatoVacuumRobotAccessory.prototype = {
|
||||
let extraCare = this.vacuumRobotExtraCareService.getCharacteristic(Characteristic.On).value;
|
||||
let nogoLines = this.vacuumRobotNoGoLinesService.getCharacteristic(Characteristic.On).value;
|
||||
let room = (typeof boundary === 'undefined') ? '' : boundary.name;
|
||||
debug(this.name + ": Start cleaning (" + room + " eco: " + eco + ", extraCare: " + extraCare + ", nogoLines: " + nogoLines + ")");
|
||||
debug(this.name + ": ## Start cleaning (" + room + " eco: " + eco + ", extraCare: " + extraCare + ", nogoLines: " + nogoLines + ")");
|
||||
|
||||
// Normal cleaning
|
||||
if (typeof boundary === 'undefined')
|
||||
@ -328,19 +328,19 @@ NeatoVacuumRobotAccessory.prototype = {
|
||||
{
|
||||
if (this.robot.canPause)
|
||||
{
|
||||
debug(this.name + ": Pause cleaning to go to dock");
|
||||
debug(this.name + ": ## Pause cleaning to go to dock");
|
||||
this.robot.pauseCleaning((error, result) =>
|
||||
{
|
||||
setTimeout(() =>
|
||||
{
|
||||
debug(this.name + ": Go to dock");
|
||||
debug(this.name + ": ## Go to dock");
|
||||
this.robot.sendToBase(callback);
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
else if (this.robot.canGoToBase)
|
||||
{
|
||||
debug(this.name + ": Go to dock");
|
||||
debug(this.name + ": ## Go to dock");
|
||||
this.robot.sendToBase(callback);
|
||||
}
|
||||
else
|
||||
@ -502,7 +502,7 @@ NeatoVacuumRobotAccessory.prototype = {
|
||||
this.clean((error, result) =>
|
||||
{
|
||||
this.nextRoom = null;
|
||||
debug("Starting cleaning of next room");
|
||||
debug("## Starting cleaning of next room");
|
||||
}, this.nextRoom);
|
||||
}
|
||||
}
|
||||
|
18
index.js
18
index.js
@ -58,6 +58,8 @@ NeatoVacuumRobotPlatform.prototype = {
|
||||
this.robots.forEach((robot, i) =>
|
||||
{
|
||||
this.log("Found robot #" + (i + 1) + " named \"" + robot.device.name + "\" with serial \"" + robot.device._serial + "\"");
|
||||
|
||||
// Start Update Intervall
|
||||
this.updateRobotTimer(robot.device._serial);
|
||||
|
||||
let NeatoVacuumRobotAccessory = require('./accessories/neatoVacuumRobot')(Service, Characteristic);
|
||||
@ -162,7 +164,17 @@ NeatoVacuumRobotPlatform.prototype = {
|
||||
// Robot is completely requested if all maps are requested
|
||||
if (requestedMap === robot.maps.length)
|
||||
{
|
||||
this.robots.push({device: robot});
|
||||
// Get additional information
|
||||
robot.getState((error, result) =>
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
this.log.error("Error getting robot meta information: " + error + ": " + result);
|
||||
callback();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.robots.push({device: robot, meta: result.meta});
|
||||
requestedRobot++;
|
||||
|
||||
// Initial request is complete if all robots are requested.
|
||||
@ -171,6 +183,8 @@ NeatoVacuumRobotPlatform.prototype = {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
@ -194,7 +208,7 @@ NeatoVacuumRobotPlatform.prototype = {
|
||||
else
|
||||
{
|
||||
debug(robot.device.name + ": ++ Updating robot state");
|
||||
robot.device.getState(function (error, result)
|
||||
robot.device.getState((error, result) =>
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user