Skip to content

Commit

Permalink
'awair-pm' IAQ method update
Browse files Browse the repository at this point in the history
If `awair-pm` selected, Glow and Glow-C will use `awair-aqi` method with configured `endpoint` and `limit`.

Pushing as v5.8.0 as `awair-pm` adds new functionality.
  • Loading branch information
DMBlakeley committed Feb 6, 2021
1 parent a8e7bc6 commit d085f84
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/).

## v5.8.0
* [Enhancement] If `awair-pm` selected, Glow and Glow-C will use `awair-aqi` method with configured `endpoint` and `limit`.

## v5.7.3
* [New] Add `awair-pm` 'air quality method'. When 'awair-pm' selected, the HomeKit Air Quality tile only reflects the particulates value, which is useful for automating air purifiers.

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": false,
"displayName": "Homebridge Awair2",
"name": "homebridge-awair2",
"version": "5.7.3",
"version": "5.8.0",
"description": "HomeKit integration of Awair air quality monitor as Dynamic Platform.",
"main": "dist/index.js",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,17 @@ class AwairPlatform implements DynamicPlatformPlugin {
if (this.airQualityMethod === 'awair-aqi') {
airQualityService
.updateCharacteristic(hap.Characteristic.AirQuality, this.convertAwairAqi(accessory, sensors));

} else if ((this.airQualityMethod === 'awair-pm') &&
!((accessory.context.deviceType === 'awair-glow') || (accessory.context.deviceType === 'awair-glow-c'))) {
airQualityService // only use awair-pm for Omni, Mint, Awair, Awair-R2, Element
// eslint-disable-next-line max-len
.updateCharacteristic(hap.Characteristic.AirQuality, this.convertAwairPm(accessory, sensors)); // pass response data
} else if ((this.airQualityMethod === 'awair-pm')
&& (accessory.context.deviceType === 'awair-glow' || accessory.context.deviceType === 'awair-glow-c')) {
airQualityService // for Glow or Glow-C use awair-aqi if awair-pm selected
.updateCharacteristic(hap.Characteristic.AirQuality, this.convertAwairAqi(accessory, sensors));

} else if ((this.airQualityMethod === 'nowcast-aqi') &&
!((accessory.context.deviceType === 'awair-glow') || (accessory.context.deviceType === 'awair-glow-c'))) {
airQualityService // only use nowcast-aqi for Omni, Mint, Awair, Awair-R2, Element
Expand All @@ -688,9 +694,11 @@ class AwairPlatform implements DynamicPlatformPlugin {
&& (accessory.context.deviceType === 'awair-glow' || accessory.context.deviceType === 'awair-glow-c')) {
airQualityService // for Glow or Glow-C use awair-aqi if nowcast-aqi selected
.updateCharacteristic(hap.Characteristic.AirQuality, this.convertAwairAqi(accessory, sensors));

} else if (this.airQualityMethod === 'awair-score') {
airQualityService
.updateCharacteristic(hap.Characteristic.AirQuality, this.convertScore(score));

} else {
airQualityService
.updateCharacteristic(hap.Characteristic.AirQuality, this.convertScore(score));
Expand Down

0 comments on commit d085f84

Please sign in to comment.