Skip to content

Commit

Permalink
fixup! Add Aqara TVOC Sensor Support with history
Browse files Browse the repository at this point in the history
  • Loading branch information
sieren committed Sep 11, 2021
1 parent 615314f commit 91241d1
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/HueSensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2405,20 +2405,18 @@ HueSensor.prototype.checkAirQuality = function (airquality) {
)
this.obj.state.airquality = airquality
}
var hkAirQuality;
if (airquality == 'excellent') {
hkAirQuality = Characteristic.AirQuality.EXCELLENT
} else if (airquality == 'good') {
hkAirQuality = Characteristic.AirQuality.GOOD
} else if (airquality == 'moderate') {
hkAirQuality = Characteristic.AirQuality.FAIR
} else if (airquality == 'poor') {
hkAirQuality = Characteristic.AirQuality.INFERIOR
} else if (airquality == 'unhealthy') {
hkAirQuality = Characteristic.AirQuality.POOR
} else {
let qualities = {
'excellent': Characteristic.AirQuality.EXCELLENT,
'good': Characteristic.AirQuality.GOOD,
'moderate': Characteristic.AirQuality.FAIR,
'poor': Characteristic.AirQuality.INFERIOR,
'unhealthy': Characteristic.AirQuality.POOR
}

let hkAirQuality = qualities[airquality]
if (!hkAirQuality)
hkAirQuality = Characteristic.AirQuality.UNKNOWN
}

if (this.hk.airquality !== hkAirQuality) {
if (this.hk.airquality !== undefined) {
this.log.info(
Expand Down

0 comments on commit 91241d1

Please sign in to comment.