merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
388 stars 61 forks source link

TVOC unit calculation for Air Quality Monitor (cgllc.airmonitor.b1) #335

Closed andrewtzn closed 1 year ago

andrewtzn commented 2 years ago

The unit Apple Home uses for TVOC is µg/m3 and Xiaomi is using mg/m3. Could you please add a calculation of x1000 when TVOC is exposed to Homekit please? Currently, Apple Home shows the TVOC value directly from source but with the incorrect unit. For example, source is 1.2 mg/m3, Apple Home shows 1.2 µg/m3. The correct value should be 1200 µg/m3.

Yeah, battery is actually not part of the main service hence it also disappeared. Adding it manually causes it be a light sensor hence it will only display the reported value by the device.

Yes, please open a new issue for the value calculations so i do not forget it :)

Originally posted by @merdok in https://github.com/merdok/homebridge-miot/issues/334#issuecomment-1242901589

Thank you!

merdok commented 2 years ago

Thanks for opening the issue. Do you know if that is true for every xiaomi device or is it just specific to yours?

andrewtzn commented 2 years ago

No problem! Thanks for getting back to me!

I am not sure since I only have that air quality device from xiaomi. Side note, I can change unit on the air quality monitor itself, it's only for its display though. There are three options mg/m3., ppm and ppb. Changing them doesn't effect the value going to the plugin.

merdok commented 1 year ago

Should now be fixed in version 1.4.0

andrewtzn commented 1 year ago

Thank you!

andrewtzn commented 1 year ago

Quick update: it seems like Homebridge is showing the warning below after installing the 1.4.0 update, the maximum value is set at 9.999. [26/10/2022, 18:54:37] [homebridge-miot] This plugin generated a warning from the characteristic 'VOC Density': characteristic was supplied illegal value: number 1279.0000000000002 exceeded maximum of 9.999. See https://homebridge.io/w/JtMGR for more info. [26/10/2022, 18:54:47] [homebridge-miot] This plugin generated a warning from the characteristic 'VOC Density': characteristic was supplied illegal value: number 1332.0000000000002 exceeded maximum of 9.999. See https://homebridge.io/w/JtMGR for more info. I checked the cgllc.airmonitor.b1.js file. The "valueRange":[0.005,9.999,0.001] should be changed to a higher value? Please correct me if I'm wrong. If it needs to be updated, can you please change 9.999 to a higher value? something like this: "valueRange":[0,65535,1] Please take a look at some discussions regarding the VOC value here: https://github.com/ebaauw/homebridge-hue/issues/1092

Thank you again. Please let me know if a new issue is needed.

merdok commented 1 year ago

Oh, that is odd. Will have a look! Thanks!

andrewtzn commented 1 year ago

thanks again!!

merdok commented 1 year ago

Found the issue, will be fixed in a bug fix release in the next days.

andrewtzn commented 1 year ago

thank you merdok! you're the best!