diff --git a/accessories/neatoVacuumRobot.js b/accessories/neatoVacuumRobot.js index 0cb258c..b16699e 100644 --- a/accessories/neatoVacuumRobot.js +++ b/accessories/neatoVacuumRobot.js @@ -11,18 +11,20 @@ module.exports = function (_Service, _Characteristic) return NeatoVacuumRobotAccessory; }; -function NeatoVacuumRobotAccessory(robotObject, platform, boundary = undefined) +function NeatoVacuumRobotAccessory(platform, robotObject, boundary = undefined) { this.platform = platform; - this.boundary = boundary; this.log = platform.log; this.refresh = platform.refresh; this.hiddenServices = platform.hiddenServices; + + this.robotObject = robotObject; this.robot = robotObject.device; - this.mainAccessory = robotObject.mainAccessory; - this.nextRoom = null; this.meta = robotObject.meta; + this.boundary = boundary; + this.nextRoom = null; + if (typeof boundary === 'undefined') { this.name = this.robot.name; @@ -277,9 +279,9 @@ NeatoVacuumRobotAccessory.prototype = { }, 60 * 1000); } - let eco = this.mainAccessory.vacuumRobotEcoService.getCharacteristic(Characteristic.On).value; - let extraCare = this.mainAccessory.vacuumRobotExtraCareService.getCharacteristic(Characteristic.On).value; - let nogoLines = this.mainAccessory.vacuumRobotNoGoLinesService.getCharacteristic(Characteristic.On).value; + let eco = this.robotObject.mainAccessory.vacuumRobotEcoService.getCharacteristic(Characteristic.On).value; + let extraCare = this.robotObject.mainAccessory.vacuumRobotExtraCareService.getCharacteristic(Characteristic.On).value; + let nogoLines = this.robotObject.mainAccessory.vacuumRobotNoGoLinesService.getCharacteristic(Characteristic.On).value; let room = (typeof boundary === 'undefined') ? '' : boundary.name; debug(this.name + ": ## Start cleaning (" + room + " eco: " + eco + ", extraCare: " + extraCare + ", nogoLines: " + nogoLines + ")"); diff --git a/index.js b/index.js index 192e3fe..d6005c7 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,7 @@ NeatoVacuumRobotPlatform.prototype = { this.updateRobotTimer(robot.device._serial); let NeatoVacuumRobotAccessory = require('./accessories/neatoVacuumRobot')(Service, Characteristic); - let mainAccessory = new NeatoVacuumRobotAccessory(robot, this); + let mainAccessory = new NeatoVacuumRobotAccessory(this, robot); accessories.push(mainAccessory); robot.mainAccessory = mainAccessory; @@ -77,7 +77,7 @@ NeatoVacuumRobotPlatform.prototype = { { if (boundary.type === "polygon") { - let roomAccessory = new NeatoVacuumRobotAccessory(robot, this, boundary); + let roomAccessory = new NeatoVacuumRobotAccessory(this, robot, boundary); accessories.push(roomAccessory); robot.roomAccessories.push(roomAccessory); diff --git a/package.json b/package.json index efd57b6..ee0673b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-neato", - "version": "0.7.0-beta.4", + "version": "0.7.0-beta.5", "description": "A Neato vacuum robot plugin for homebridge.", "license": "MIT", "keywords": [