aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaise Thompson <blaise@untzag.com>2021-07-30 11:47:39 -0500
committerBlaise Thompson <blaise@untzag.com>2021-07-30 11:47:39 -0500
commit2964b7784a63ab534459d3020cef4afba6c8f7bd (patch)
tree44e3a86e85d4ddc0ae8f503b19254be6053a01c2
parentbcac66e038e81879006b78ad71c10599850daed8 (diff)
warm-up measurements
-rw-r--r--firmware/main.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/main.py b/firmware/main.py
index 6069e36..f6835b4 100644
--- a/firmware/main.py
+++ b/firmware/main.py
@@ -86,6 +86,15 @@ class WeatherSensor(HomieNode):
await sleep_ms(1_000)
if self.device.mqtt.isconnected():
break
+ # do 5 measurements to "warm up" the sensor
+ # for whatever reason the first measurements after poweron are systematically wrong
+ # I do not understand why
+ # --- Blaise 2021-07-30
+ for _ in range(5):
+ _ = self.bme280.temperature
+ _ = self.bme280.humidity
+ _ = self.bme280.pressure
+ await sleep_ms(500)
# loop forever
while True:
while self.device.mqtt.isconnected():