From 251c09f3e439bd4641ef5992e9d0e1febc50bf20 Mon Sep 17 00:00:00 2001 From: Sieren Date: Sat, 11 Sep 2021 10:12:24 +0200 Subject: [PATCH] fixup! Add Aqara TVOC Sensor Support with history --- lib/HueSensor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/HueSensor.js b/lib/HueSensor.js index 953d25d..5338945 100644 --- a/lib/HueSensor.js +++ b/lib/HueSensor.js @@ -60,6 +60,8 @@ const daylightPeriods = { Day: { lightlevel: 65535, daylight: true, dark: false } } +const eveRoom2sensors = ['lumi.airmonitor.acn01'] + // ===== Homebridge ============================================================ // Link this module to homebridge. @@ -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 @@ -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 @@ -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