merdok / homebridge-miot

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

Option to disable CO2 Sensor for Air Quality Monitor #334

Closed andrewtzn closed 2 years ago

andrewtzn commented 2 years ago

Hi,

First of all. Thank you for adding support for the Air Quality Monitor (cgllc.airmonitor.b1). I have been looking for a replacement plug in for a long time for https://github.com/Defensor7/homebridge-airmonitor The air quality monitor has a feature to turn on and off its CO2 monitor. (It doesn't have a real CO2 sensor, it uses TVOC to calculate CO2) I have turned of the CO2 monitor on the device itself, but the plugin still exposes the CO2 sensor to Homekit which caused CO2 value stuck at 1087ppm and will not change. Adding a way to turn off CO2 sensor on the plugin will be awesome.

Please check here for a similar request. https://github.com/Defensor7/homebridge-airmonitor/issues/3

Thanks!!

merdok commented 2 years ago

You can try to set the onlyMainService property to true.

andrewtzn commented 2 years ago

Hi merdok,

Thanks! Yes, just added that and only the Air Quality sensor is exposed to Homekit. PM2.5 and TVOC are exposed. However, the temperature, humidity and battery charging status and level are now missing from the accessory. I tried adding propertyMonitor, for the battery levels but they show as light level sensor.

Also, please let me know if you would like me to open a new issue for this, 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?

Thanks again!!

merdok commented 2 years ago

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 :)

andrewtzn commented 2 years ago

Ah I see. Please let me know if you need any additional information.

Created a new issue. Thanks again!

merdok commented 2 years ago

Thanks for creating the new issue!

To come back to the original question. The property onlyMainService is the way to go here in such cases, but yeah the battery indication will be lost. I think i will need to adjust the battery service to either stay on the main service all the time or add option to correctly re-add it. For now i will close it as your original question is solved is assume?

andrewtzn commented 2 years ago

To come back to the original question. The property onlyMainService is the way to go here in such cases, but yeah the battery indication will be lost.

Yes, at least I can eliminate the unwanted sensor. However, it sacrificed a bunch of other useful data coming from the monitor.

I think i will need to adjust the battery service to either stay on the main service all the time or add option to correctly re-add it. For now i will close it as your original question is solved is assume?

An option will be a great addition. Yes please. Thank you merdok!