trvrnrth / esphome-bsec-bme680

ESPHome component for the Bosch BME680 sensor via BSEC providing temperature, humidity, pressure and indoor air quality measurements.
85 stars 17 forks source link

Enhancement: Update intervals for temperature and humidity #34

Closed wifwucite closed 3 years ago

wifwucite commented 3 years ago

In ULP mode, the sample rate is 5min, which is fine for the gas sensor that needs heating. Would it be possible to specify a shorter interval like 1min for temperature and humidity? Btw. I have added a link to this repository in ESPHome‘s BME680 sensor documentation. ;-)

trvrnrth commented 3 years ago

Thanks for adding the link!

I believe that it should be possible to run with differing update intervals for each of the readings but I haven't actually tried it.

In the absence of any current way of configuring it if you edit update_subscription_ hardcoding the sensor sample rates to one of BSEC_SAMPLE_RATE_LP or BSEC_SAMPLE_RATE_ULP as appropriate do you get the behaviour you expect?

wifwucite commented 3 years ago

Could you elaborate on that? Where can I set update_subscription_? I did not find it.

trvrnrth commented 3 years ago

This is where the component sets the sample rate for the temperature sensor for example. At the moment all sensors are either set to BSEC_SAMPLE_RATE_LP or BSEC_SAMPLE_RATE_ULP depending on your config but it should be possible to use differing update intervals per sensor. In theory you could use any value but I believe the recommendation is to stick to one of those two standard values for the sake of the BSEC algorithm. As I say I've not tried it myself so I'd be interested to know how well it works out.

wifwucite commented 3 years ago

Thanks, after a git pull (sorry!), I see it, too. ;-) When I configure the global sample rate to ultra low power and I override the sample rate of the pressure or temperature sensor to BSEC_SAMPLE_RATE_LP, I get more frequent pressure or temperature readings. Other sample rates, however, seem to confuse it completely, then I do not see any readings at all anymore. But using BSEC_SAMPLE_RATE_LP for the temperature is fine. Of course, we do not know how well heat compensation works with this configuration. Anyhow, thank you very much for your advice.

trvrnrth commented 3 years ago

Thanks for reporting back! Good to know it works with a ULP/LP combo (and also that other values are a no-go). I'd read that it should work so hopefully the heat compensation is good enough for you.

trvrnrth commented 3 years ago

@wifwucite I suspect you may have seen already but there's a PR for this feature now at https://github.com/esphome/esphome/pull/1710. This also improves the heat compensation as it turns out the timestamp being supplied for the inputs should be the trigger time not the measurement time (a bug that appears to exist in some of the bosch examples too).

wifwucite commented 3 years ago

Thanks for the update, yes, I have seen the PR. I was not sure if it will impact this custom component as well. Or will this PR be merged into ESPHome?

trvrnrth commented 3 years ago

This component will be in the next core release of ESPHome so in future won't need adding as a custom component. Although I may keep this repo around anyway as it does no harm and allows for faster iterations if necessary. In the meantime as the next release date of ESPHome is unknown I'll probably formalise and release those changes here too.

wifwucite commented 3 years ago

Sounds good! And thank you for the clarification.

trvrnrth commented 3 years ago

Now released as 1.2.0.