diff --git a/Changelog.md b/Changelog.md index c90d7f2..1ec5005 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,10 @@ All notable changes to this project will be documented in this file. This project uses [semantic versioning](https://semver.org/). -## 1.0.0 +## 1.1.0 (2020-10-29) +* Added support for bin full notifications. + +## 1.0.0 (2020-10-28) * Plugin verified ## 0.0.2 (2020-10-28) diff --git a/README.md b/README.md index 74ed5c7..ad843ad 100755 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ - Roomba battery level (with low battery warning) - Roomba docked notifcation - Roomba running notification +- Roomba bin full notification diff --git a/config.schema.json b/config.schema.json index 9bc75c1..a16d612 100644 --- a/config.schema.json +++ b/config.schema.json @@ -50,6 +50,11 @@ "title": "Show running status as a contact sensor", "required": false }, + "binContactSensor": { + "type": "boolean", + "title": "Show if bin is full as a contact sensor", + "required": false + }, "cacheTTL": { "type": "number", "title": "TTL Cache", diff --git a/index.js b/index.js index 04f2633..5f9c545 100755 --- a/index.js +++ b/index.js @@ -11,6 +11,7 @@ const roombaAccessory = function (log, config) { this.log = log; this.name = config.name; this.model = config.model; + this.serialnum = config.serialnum; this.blid = config.blid; this.robotpwd = config.robotpwd; this.ipaddress = config.ipaddress; @@ -19,6 +20,7 @@ const roombaAccessory = function (log, config) { this.autoRefreshEnabled = config.autoRefreshEnabled; this.showDockAsContactSensor = config.dockContactSensor == undefined ? true : config.dockContactSensor; this.showRunningAsContactSensor = config.runningContactSensor; + this.showBinStatusAsContactSensor = config.binContactSensor; this.cacheTTL = config.cacheTTL || 5; this.disableWait = config.disableWait; this.roomba = null; @@ -33,7 +35,9 @@ const roombaAccessory = function (log, config) { if (this.showRunningAsContactSensor) { this.runningService = new Service.ContactSensor(this.name + " Running", "running"); } - + if (this.showBinStatusAsContactSensor) { + this.binService = new Service.ContactSensor(this.name + " BinFull", "Full"); + } this.cache = new nodeCache({ stdTTL: this.cacheTTL, checkperiod: 1, @@ -237,6 +241,8 @@ roombaAccessory.prototype = { }); }, + + identify(callback) { this.log("Identify requested. Not supported yet."); @@ -348,12 +354,12 @@ roombaAccessory.prototype = { getServices() { const services = []; - this.accessoryInfo.setCharacteristic(Characteristic.Manufacturer, "iRobot"); - this.accessoryInfo.setCharacteristic(Characteristic.SerialNumber, "See iRobot App"); + this.accessoryInfo.setCharacteristic(Characteristic.Manufacturer, "iRayanKhan"); + this.accessoryInfo.setCharacteristic(Characteristic.SerialNumber, this.serialnum); this.accessoryInfo.setCharacteristic(Characteristic.Identify, false); this.accessoryInfo.setCharacteristic(Characteristic.Name, this.name); this.accessoryInfo.setCharacteristic(Characteristic.Model, this.model); - this.accessoryInfo.setCharacteristic(Characteristic.FirmwareRevision, this.firmware); + this.accessoryInfo.setCharacteristic(Characteristic.FirmwareRevision, "1.1.0"); services.push(this.accessoryInfo); this.switchService @@ -388,6 +394,12 @@ roombaAccessory.prototype = { .on("get", this.getRunningStatus.bind(this)); services.push(this.runningService); } + if (this.showBinStatusAsContactSensor) { + this.binService + .getCharacteristic(Characteristic.ContactSensorState) + .on("get", this.getFilterStatus.bind(this)) ; + services.push(this.binService); + } return services; }, @@ -434,6 +446,11 @@ roombaAccessory.prototype = { .getCharacteristic(Characteristic.ContactSensorState) .updateValue(status.running); } + if (this.showBinStatusAsContactSensor) { + this.binService + .getCharacteristic(Characteristic.ContactSensorState) + .updateValue(status.binStatus); + } }, enableAutoRefresh() { diff --git a/package.json b/package.json index ea8def8..545186e 100644 --- a/package.json +++ b/package.json @@ -56,5 +56,5 @@ "scripts": { "getrobotpwd": "cd node_modules/dorita980 && npm install && node ./bin/getpassword.js" }, - "version": "1.0.0" + "version": "1.1.0" }