ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
897 stars 91 forks source link

To low a voc limit for the Aqara TVOC sensor #1092

Closed JornDL closed 2 years ago

JornDL commented 2 years ago

Issue

To low a limit for the voc value for the Aqara TVOC sensor. I think the limit should be 10000 like also in the "Panko deconz release" where DDF Aqara air quality TVOC raised unhealthy max value to 10000

Log Messages

[10/02/2022, 18:59:50] [Hue] Aqara TVOC: set homekit Air Quality from 1304voc to 1145voc
[10/02/2022, 18:59:50] [homebridge-hue] This plugin generated a warning from the characteristic 'VOC Density': characteristic was supplied illegal value: number 1145 exceeded maximum of 1000. See https://git.io/JtMGR for more info.

Debug Files

ebaauw commented 2 years ago

I don't have the Aqara VOC sensor. Support was added by @sieren in https://github.com/ebaauw/homebridge-hue/pull/1020.

To my understanding the Aqara TVOC sensor reports VOC level (in ppb). deCONZ exposes this as airqualityppb. The PR exposes the Aqara TVOC sensor mimicking a gen-2 Eve room. This device reports the air quality (in 5 levels) and VOC density (in µg/m³). It uses the Apple-defined Air Quality and VOC Density characteristics.

Note that Eve doesn't show VOC Density; it only shows the Air Quality (from 1 to 5 stars, where 5 stars corresponds to numeric value 1). Eve shows VOC level (in ppb) in the history; the Eve app translates the density into level. I think this is because the gen-1 Eve Room reports VOC level, using an Eve-defined characteristic VOC Level (well before Apple defined VOC Density).
The Home app does show VOC Density, in the settings popup for the Air Quality tile (the tile only shows Air Quality).

[10/02/2022, 18:59:50] [Hue] Aqara TVOC: set homekit Air Quality from 1304voc to 1145voc

This message makes no sense: the characteristic name should be VOC Density and the unit should be µg/m³. "voc" is a quantity not a unit, and it's ambiguous; you'd need to specify whether it reports the level or density.

[10/02/2022, 18:59:50] [homebridge-hue] This plugin generated a warning from the characteristic 'VOC Density': characteristic was supplied illegal value: number 1145 exceeded maximum of 1000. See https://git.io/JtMGR for more info.

Indeed, Apple defines VOC Level as a FLOAT with values between 0 and 1,000, see: https://github.com/homebridge/HAP-NodeJS/blob/178bd7a6d707d258109be932f2e0055f9a3048f6/src/lib/definitions/CharacteristicDefinitions.ts#L4837-L4855.

I think the limit should be 10000 like also in the "Panko deconz release" where DDF Aqara air quality TVOC raised unhealthy max value to 10000

No, that's the limit for VOC level, not for VOC density. The density is 4.57 times the level (assuming an air temperature of 20°C), see https://github.com/simont77/fakegato-history/issues/107.
But the PR uses a factor of 4.56?

Looking at the history for my 3rd-gen Eve Room, I see VOC level values as high as 6,896 ppb. I didn't catch the corresponding density in Home, but these values could well be above 30,000 µg/m³. It wouldn't be the first time that Apple uses ridiculous default limits (e.g. the minimum value for Current Temperature is 0°C), but accessories are allowed to override these.

JornDL commented 2 years ago

Hi - thanks for the comments. I'm no expert in this - I'm only reporting what I see :-)

In Apply HomeKit - Aqara TVOC Air quality: excelent Value=283 µg/m³

In Homebridge status: [11/02/2022, 09:58:29] [Hue] Aqara TVOC: set homekit airquality from 2 V to 1 V [11/02/2022, 09:58:29] [Hue] Aqara TVOC: set homekit Air Quality from 447voc to 283voc

In deCONZ GUI: id = 0x0055 value=62

In Aqara display: 62ppb

sieren commented 2 years ago

Not much to add to what @ebaauw has said. The conversion formula is documented in https://github.com/simont77/fakegato-history/issues/107 as referenced before. I don't know why I set it to 4.56, could've been an oversight/typo. Happy to fix it but it wont change much.

Edit: thanks @ebaauw , i see u already changed it

sieren commented 2 years ago

Overall I have to add that history support is still broken because stuff is missing on the deCONZ side of things for reporting changed values.

JornDL commented 2 years ago

Hi @sieren But why do I get this error ?

[10/02/2022, 18:59:50] [Hue] Aqara TVOC: set homekit Air Quality from 1304voc to 1145voc [10/02/2022, 18:59:50] [homebridge-hue] This plugin generated a warning from the characteristic 'VOC Density': characteristic was supplied illegal value: number 1145 exceeded maximum of 1000.

ebaauw commented 2 years ago

I'm only reporting what I see

And that's much appreciated, especially since I don't have the device, and cannot see for myself.

[11/02/2022, 09:58:29] [Hue] Aqara TVOC: set homekit airquality from 2 V to 1 V

Also interesting... The air quality has no unit, certainly not Volts. Probably a copy/paste error on my part.

But why do I get this error

Because the Apple-defined default makes no sense, but wasn't changed.

sieren commented 2 years ago

It's just a warning, not an error. Safe to ignore I'd say.

JornDL commented 2 years ago

But that means that we will never get higher values than

1000 µg/m³ = 219 ppb

As values higher are at the moment set to these values as they exceeds the maximum

Also, will an Eve Room have the same limit (1000 µg/m³ ) in Apple HomeKit ?

ebaauw commented 2 years ago

Also, will an Eve Room have the same limit (1000 µg/m³ ) in Apple HomeKit ?

Of course not. As I said: the problem is with the default maximum that Apple defined. This can be overwritten by an accessory, which is what the commit above does.

JornDL commented 2 years ago

Sorry for all my questions

So could there be a fix, so the Aqara TVOC also overwrites the default maximum ? And where should this be made ?

ebaauw commented 2 years ago

Yes. The fix has already been made in https://github.com/ebaauw/homebridge-hue/commit/d9dea8a6ad32694e56d12e6814873633346825ca. It will be included in the next release of Homebridge Hue.

JornDL commented 2 years ago

Hi

That sounds super. Thanks a lot for your time and you plugin.

I am a donator.

JornDL commented 2 years ago

Hi Again

Is this the the properties in the next release: props: { minValue: 0, maxValue: 65535, minStep: 1 }

ebaauw commented 2 years ago

Yes, it is.

ebaauw commented 2 years ago

In v0.13.38.

JornDL commented 2 years ago

Hi

I can confirm that it is now working with the correct unit and not cutting values above 1000

[13/02/2022, 07:59:11] [Hue] Aqara TVOC: set homekit VOC density from 302 µg/m³ to 160 µg/m³

Aqara TVOC