I’ve found an other library which is using Bosch’s prorietery library for the BME680 to calculate IAQ. Check this out:
Well I noticed that the sensor stops working after nearly 60 minutes. I’m investigating now, what the reason is… A simple restart fixes the issue but there must be a source for the issue.
I found a solution. It seems that the heater is somehow dying after about an hour. I check if there was a result delivert within 10 minutes and if not, I simply call the sensor to init again. With this setup its pretty stable for about a day now.
That’s interesting, il take a look at the algo
I have written a new BME680 sensor plugin for directly connected devices.
This version is purely written as a sensor plugin and does not require external command execution.
AQ calculation still uses the Pimorini algorithm but it is run in a separate thread on a 1 second interval to prevent the degradation in gas resistance sampling when this is run on the event loop due to infrequent updates.
The default i2c_address is 0x77 which is the default for Adafruit BME680 so if you have a Pimorini board you will need to change it in the configuration.yaml to 0x76.
Great work! Can it be used with a Hassio instance? Cheers
I don’t see why not but don’t have any experience with Hass.io.
Place it in your custom_components/sensor directory in your .homeassistant folder of the homeassistant user on the instance and configure as per the examples on the README.md
So the Pimorini calculation is dependant on a continuous read out that is stabilized during the burn in time (5 minutes is the default I set but is configurable).
The idea is that it reads for the burn in time then takes the last 50 readings and averages them to get the baseline. This essentially means that it assumes that, during initialization, the air quality is perfect. It then uses that baseline and reducing gas resistance means that the VOC gas has increased. It uses that as a ratio of 75% gas to 25% humidity (configurable in config) with an ideal humidity specified (40% default but again configurable).
It is by no means an ideal measurement but if you do your calibration when you feel the air is clear you will see changes in air quality if VOC content or humidity changes.
I don’t think there is any way to get an accurate air quality measurement without lab based calibration and I think that would be specific to each and every sensor manufactured. I believe the Bosch algorithm has some curve calculations but I think this will only improve accuracy not make it accurate without calibration. At any rate, no way to tell without disassembly of their code which is prohibited in their license.
If anyone has some fancy math that they think will work better, I am more than willing to try to implement it.
As I said there is a different lib that brings Bosch’s propriatary lib. They did some calibration in their labs.
As I mentioned above, I believe the C-Library helps to improve the accuracy by using some curve calculations (probably considerably). It will never be completely accurate without actually baselining each sensor individually.
The Issue is that that library is a C binary that is only distributed for specific platforms. There is certain licensing agreements required to use it and distribute it.
Without going into the licensing side of things, which could be problematic, the issue of requiring, detecting and distributing multiple binary blobs does not fit with the current HomeAssistant component model and would also limit usage to specific systems and glibc versions.
I want to get this component into the main dev branch soon. I have cleaned up the code and the only thing remaining is to write the documentation. Using the C-Library is out of scope for the effort I am currently working on. Maybe in future I can work out some way that this can be manually configured as an additional option but for now, having some relative Air Quality is better than no AQ and no support for the other sensors on this package.
Pull request into dev branch of Home Assistant code base. Passed all tests, documentation written, just pending review and merge.
BME680 Sensor Component was included in the Home Assistant 0.6.2 release.
Hi All,
Is this sensor running on same pi as Home Assistant or on a remote pi? I would like to have either another pi or ESP NodeMCU type device to take measurements and send via MQTT.
Just wondering what the best approach would be or more importantly, how have you successfully implemented it?
Thanks in Advance!
~Bryan
The BME680 it’s a tricky sensor and the python libraries are not so good.
I was able to get Bosch BSEC code on both ESP32 and on the Raspberry Pi.
Is actually quite simple to compile it in C.
Does anyone have suggestions on how to mqtt to home assistant?
Thanks @robmarkcole
What I’m trying to MQTT is the data generated using the Bosch BSEC library https://www.bosch-sensortec.com/bst/products/all_products/bsec and https://github.com/BoschSensortec/BME680_driver
It’s on C and uses precompiled libraries from Bosch.
The big advantages are that It returns IAQ Indoor Air Quality value instead of that strange kind of meaningless % and uses the measures to of self-calibrate itself and increase accuracy.
The results seem to look better than the ones from the python libraries. I might run two sensors and see how they behave.
You can probably fork the existing python libraries and add that functionality.
Did you ever manage to complete this?
No I did not. I never got the mqtt part and recovery from fail to work properly. It is doable but beyond my programming skills. An ESPhome would be the best solution, but probably the hardest to get BSEC to load. I haven’t tested but check this one. BME680 using the official Bosch Sensortec BSEC Library
I’ve carried on with the BSEC library usage in https://github.com/alexh-name/bsec_bme680_linux and handled the MQTT integration as well. Please see my post at https://community.home-assistant.io/t/bme680-for-air-quality-usage-and-interpretation/607323