Skip to content

Commit

Permalink
Only enable AirQualityService on isFakeGatoEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
hannseman committed Mar 17, 2024
1 parent 16c981a commit 97df919
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
9 changes: 0 additions & 9 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@
"placeholder": "e.g. 00:00:00:00:00:00",
"description": "Optional. Specify when running multiple devices"
},
"airQualityName": {
"title": "Air Quality Name",
"type": "string",
"format": "string",
"default": "AirQuality",
"condition": {
"functionBody": "return ['Hygrotermograph'].includes(model.type);"
}
},
"temperatureName": {
"title": "Temperature",
"type": "string",
Expand Down
14 changes: 9 additions & 5 deletions lib/accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class HygrothermographAccessory {
}

get airQuality() {
// placeholder for future implementation
// Required for Elgato Eve integration, so we just return a dummy value here
return Characteristic.AirQuality.EXCELLENT;
}

Expand Down Expand Up @@ -571,9 +571,10 @@ class HygrothermographAccessory {
}

getAirQualityService() {
const airQualityService = new Service.AirQualitySensor(
this.airQualityName
);
if (!this.isFakeGatoEnabled) {
return;
}
const airQualityService = new Service.AirQualitySensor(this.airQualityName);
airQualityService
.getCharacteristic(Characteristic.AirQuality)
.on("get", this.onCharacteristicGetValue.bind(this, "airQuality"));
Expand Down Expand Up @@ -657,7 +658,10 @@ class HygrothermographAccessory {
];
switch (this.type) {
case AccessoryType.Hygrotermograph:
services.push(this.airQualityService, this.temperatureService, this.humidityService);
services.push(this.temperatureService, this.humidityService);
if (this.isFakeGatoEnabled) {
services.push(this.airQualityService);
}
break;
case AccessoryType.MiFlora:
services.push(
Expand Down

0 comments on commit 97df919

Please sign in to comment.