From 12a49d6da5b5ad50f5bf0eafdae868b582fd4af6 Mon Sep 17 00:00:00 2001 From: Sebastian Kroll Date: Sat, 19 Jan 2019 15:58:42 +0100 Subject: [PATCH] added c02-alert-treshold configuration option --- HISTORY.md | 3 +++ README.md | 2 ++ index.js | 1 + package.json | 2 +- service/eveatmo-co2.js | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 9e356d4..a876bcc 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,8 @@ ## version history +### 0.4.3 +- added configuration-option to override the alert-state threshold for the extra co2-sensors (https://github.com/skrollme/homebridge-eveatmo/issues/24) + ### 0.4.2 - hopefully fixed a problem which caused the low-battery warning to persist even after replacing the module's battery (https://github.com/skrollme/homebridge-eveatmo/issues/21) diff --git a/README.md b/README.md index 0c6afc2..b40620d 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Because this plugin's base was taken from [homebridge-netatmo](https://github.co "platform": "eveatmo", "name": "eveatmo platform", "extra_co2_sensor": false, + "co2_alert_threshold": 1000, "ttl": 540, "auth": { "client_id": "XXXXX Create at https://dev.netatmo.com/", @@ -33,6 +34,7 @@ Because this plugin's base was taken from [homebridge-netatmo](https://github.co ``` - **extra_co2_sensor:** Adds an extra CO2 sensor which is available via Apple's stock Home.app, too. +- **co2_alert_threshold:** Sets the co2-level [ppm] at which the sensors switch to alert-state - **ttl:** Seconds between two Netatmo API polls. Lower is not neccessarily better! The weatherstation itself collects one value per 5minutes, so going below 300s makes no sense - **auth:** Credentials for the Netatmo API diff --git a/index.js b/index.js index 9a6d32c..b32004d 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,7 @@ class EveatmoPlatform { this.foundAccessories = []; this.config.extra_co2_sensor = typeof config.extra_co2_sensor !== 'undefined' ? Boolean(config.extra_co2_sensor) : false; + this.config.co2_alert_threshold = typeof config.co2_alert_threshold !== 'undefined' ? parseInt(config.co2_alert_threshold) : 1000; // If this log message is not seen, most likely the config.js is not found. this.log.debug('Creating EveatmoPlatform'); diff --git a/package.json b/package.json index 869558a..6fef959 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-eveatmo", - "version": "0.4.2", + "version": "0.4.3", "description": "Homebridge plugin which adds a Netatmo weatherstation as HomeKit device and tries to act like Elgato Eve Room/Weather", "license": "ISC", "keywords": [ diff --git a/service/eveatmo-co2.js b/service/eveatmo-co2.js index 17f4806..0768edd 100644 --- a/service/eveatmo-co2.js +++ b/service/eveatmo-co2.js @@ -45,7 +45,7 @@ module.exports = function(pHomebridge) { } transformCO2ToCarbonDioxideDetected() { - return (this.accessory.co2 > 1000 ? Characteristic.CarbonDioxideDetected.CO2_LEVELS_ABNORMAL : Characteristic.CarbonDioxideDetected.CO2_LEVELS_NORMAL); + return (this.accessory.co2 >= this.accessory.config.co2_alert_threshold ? Characteristic.CarbonDioxideDetected.CO2_LEVELS_ABNORMAL : Characteristic.CarbonDioxideDetected.CO2_LEVELS_NORMAL); } }