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 4a0c6b2 commit 251c09f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/HueSensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const daylightPeriods = {
Day: { lightlevel: 65535, daylight: true, dark: false }
}

const eveRoom2sensors = ['lumi.airmonitor.acn01']

// ===== Homebridge ============================================================

// Link this module to homebridge.
Expand Down Expand Up @@ -973,7 +975,7 @@ function HueSensor (accessory, id, obj) {
key: 'temperature',
name: 'temperature',
unit: '°C',
history: this.obj.modelid === 'lumi.airmonitor.acn01' ? 'room2' : 'weather',
history: eveRoom2sensors.includes(this.obj.modelid) ? 'room2' : 'weather',
homekitValue: function (v) { return v ? Math.round(v / 10) / 10 : 0 }
}
break
Expand Down Expand Up @@ -1109,7 +1111,7 @@ function HueSensor (accessory, id, obj) {
key: 'humidity',
name: 'humidity',
unit: '%',
history: this.obj.modelid === 'lumi.airmonitor.acn01' ? 'room2' : 'weather',
history: eveRoom2sensors.includes(this.obj.modelid) ? 'room2' : 'weather',
homekitValue: function (v) { return v ? Math.round(v / 100) : 0 }
}
break
Expand Down Expand Up @@ -2046,7 +2048,7 @@ HueSensor.prototype.addEntry = function (changed) {
case 'room2':
{
let key = this.type.key === 'airqualityppb' ? 'voc' :
(this.type.key === 'temperature' ? 'temp' : key)
(this.type.key === 'temperature' ? 'temp' : this.type.key)
this.history.entry[key] = this.hk[this.type.key]
if (changed || this.type.key !== this.history.resource.type.key) {
return
Expand Down

0 comments on commit 251c09f

Please sign in to comment.