Prepared find me function and fixed room cleaning exception
This commit is contained in:
parent
c789598019
commit
139f415a42
@ -19,6 +19,7 @@ function NeatoVacuumRobotAccessory(robotObject, platform, boundary = undefined)
|
|||||||
this.refresh = platform.refresh;
|
this.refresh = platform.refresh;
|
||||||
this.hiddenServices = platform.hiddenServices;
|
this.hiddenServices = platform.hiddenServices;
|
||||||
this.robot = robotObject.device;
|
this.robot = robotObject.device;
|
||||||
|
this.mainAccessory = robotObject.mainAccessory;
|
||||||
this.nextRoom = null;
|
this.nextRoom = null;
|
||||||
this.meta = robotObject.meta;
|
this.meta = robotObject.meta;
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ function NeatoVacuumRobotAccessory(robotObject, platform, boundary = undefined)
|
|||||||
this.vacuumRobotNoGoLinesService = new Service.Switch(this.name + " NoGo Lines", "noGoLines");
|
this.vacuumRobotNoGoLinesService = new Service.Switch(this.name + " NoGo Lines", "noGoLines");
|
||||||
this.vacuumRobotExtraCareService = new Service.Switch(this.name + " Extra Care", "extraCare");
|
this.vacuumRobotExtraCareService = new Service.Switch(this.name + " Extra Care", "extraCare");
|
||||||
this.vacuumRobotScheduleService = new Service.Switch(this.name + " Schedule", "schedule");
|
this.vacuumRobotScheduleService = new Service.Switch(this.name + " Schedule", "schedule");
|
||||||
|
this.vacuumRobotFindMeService = new Service.Switch(this.name + " Find Me", "findMe");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -140,6 +142,9 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
this.vacuumRobotScheduleService.getCharacteristic(Characteristic.On).on('set', this.setSchedule.bind(this));
|
this.vacuumRobotScheduleService.getCharacteristic(Characteristic.On).on('set', this.setSchedule.bind(this));
|
||||||
this.vacuumRobotScheduleService.getCharacteristic(Characteristic.On).on('get', this.getSchedule.bind(this));
|
this.vacuumRobotScheduleService.getCharacteristic(Characteristic.On).on('get', this.getSchedule.bind(this));
|
||||||
|
|
||||||
|
this.vacuumRobotFindMeService.getCharacteristic(Characteristic.On).on('set', this.setFindMe.bind(this));
|
||||||
|
this.vacuumRobotFindMeService.getCharacteristic(Characteristic.On).on('get', this.getFindMe.bind(this));
|
||||||
|
|
||||||
this.vacuumRobotBatteryService.getCharacteristic(Characteristic.BatteryLevel).on('get', this.getBatteryLevel.bind(this));
|
this.vacuumRobotBatteryService.getCharacteristic(Characteristic.BatteryLevel).on('get', this.getBatteryLevel.bind(this));
|
||||||
this.vacuumRobotBatteryService.getCharacteristic(Characteristic.ChargingState).on('get', this.getBatteryChargingState.bind(this));
|
this.vacuumRobotBatteryService.getCharacteristic(Characteristic.ChargingState).on('get', this.getBatteryChargingState.bind(this));
|
||||||
|
|
||||||
@ -158,6 +163,8 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
this.services.push(this.vacuumRobotExtraCareService);
|
this.services.push(this.vacuumRobotExtraCareService);
|
||||||
if (this.hiddenServices.indexOf('schedule') === -1)
|
if (this.hiddenServices.indexOf('schedule') === -1)
|
||||||
this.services.push(this.vacuumRobotScheduleService);
|
this.services.push(this.vacuumRobotScheduleService);
|
||||||
|
// if (this.hiddenServices.indexOf('find') === -1)
|
||||||
|
// this.services.push(this.vacuumRobotFindMeService);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -270,10 +277,9 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
}, 60 * 1000);
|
}, 60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let eco = this.mainAccessory.vacuumRobotEcoService.getCharacteristic(Characteristic.On).value;
|
||||||
let eco = this.vacuumRobotEcoService.getCharacteristic(Characteristic.On).value;
|
let extraCare = this.mainAccessory.vacuumRobotExtraCareService.getCharacteristic(Characteristic.On).value;
|
||||||
let extraCare = this.vacuumRobotExtraCareService.getCharacteristic(Characteristic.On).value;
|
let nogoLines = this.mainAccessory.vacuumRobotNoGoLinesService.getCharacteristic(Characteristic.On).value;
|
||||||
let nogoLines = this.vacuumRobotNoGoLinesService.getCharacteristic(Characteristic.On).value;
|
|
||||||
let room = (typeof boundary === 'undefined') ? '' : boundary.name;
|
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 + ")");
|
||||||
|
|
||||||
@ -430,6 +436,25 @@ NeatoVacuumRobotAccessory.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getFindMe: function (callback)
|
||||||
|
{
|
||||||
|
callback(false, false);
|
||||||
|
},
|
||||||
|
|
||||||
|
setFindMe: function (on, callback)
|
||||||
|
{
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
debug(this.name + ": ## Find me");
|
||||||
|
setTimeout(() =>
|
||||||
|
{
|
||||||
|
this.vacuumRobotFindMeService.setCharacteristic(Characteristic.On, false);
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
this.robot.findMe(callback);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getDock: function (callback)
|
getDock: function (callback)
|
||||||
{
|
{
|
||||||
this.platform.updateRobot(this.robot._serial, () =>
|
this.platform.updateRobot(this.robot._serial, () =>
|
||||||
|
4
index.js
4
index.js
@ -48,9 +48,7 @@ function NeatoVacuumRobotPlatform(log, config)
|
|||||||
NeatoVacuumRobotPlatform.prototype = {
|
NeatoVacuumRobotPlatform.prototype = {
|
||||||
accessories: function (callback)
|
accessories: function (callback)
|
||||||
{
|
{
|
||||||
debug("##############################################");
|
debug("Get robots");
|
||||||
debug("################# GET ROBOTS #################");
|
|
||||||
debug("##############################################");
|
|
||||||
let accessories = [];
|
let accessories = [];
|
||||||
this.boundaryNames = [];
|
this.boundaryNames = [];
|
||||||
this.getRobots(() =>
|
this.getRobots(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user