Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  added config option to add module-name suffix
  • Loading branch information
Sebastian Kroll committed Apr 26, 2019
2 parents ec1b2d5 + 988c600 commit 38f74a6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## version history

### 0.4.4
- added a config option which prevents the netatmo's devicename to be prepended and instead appends a configurable name to the modules

### 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)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Because this plugin's base was taken from [homebridge-netatmo](https://github.co
- **co2_alert_threshold (optional):** Sets the co2-level [ppm] at which the sensors switch to alert-state
- **ttl: (optional)** 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. Default value is *540* (=9min)
- **auth:** Credentials for the Netatmo API
- **module_suffix: (optional)** If this is set, the Netatmo's devicename will not be prepended to the modulename. Instead this config-value will be appended - with a space - to the module name

### Retrieve client id and secret

Expand Down
15 changes: 13 additions & 2 deletions device/weatherstation-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,21 @@ module.exports = function(pHomebridge) {
var deviceMap = {};
devices.forEach(function(device) {
deviceMap[device._id] = device;
device._name = device.station_name + " " + device.module_name;

if(this.config.module_suffix != "") {
device._name = device.module_name + " " + this.config.module_suffix;
} else {
device._name = device.station_name + " " + device.module_name;
}

if (device.modules) {
device.modules.forEach(function(module) {
module._name = device.station_name + " " + module.module_name;
if(this.config.module_suffix != "") {
module._name = module.module_name + " " + this.config.module_suffix;
} else {
module._name = device.station_name + " " + module.module_name;
}

deviceMap[module._id] = module;
}.bind(this));
}
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class EveatmoPlatform {
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;

this.config.module_suffix = typeof config.module_suffix !== 'undefined' ? config.module_suffix : '';

// If this log message is not seen, most likely the config.js is not found.
this.log.debug('Creating EveatmoPlatform');

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-eveatmo",
"version": "0.4.3",
"version": "0.4.4",
"description": "Homebridge plugin which adds a Netatmo weatherstation as HomeKit device and tries to act like Elgato Eve Room/Weather",
"license": "ISC",
"keywords": [
Expand Down

0 comments on commit 38f74a6

Please sign in to comment.