Last temperature shown when sensor gets disconnected #412
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I accidentally disconnected my I2C BME280 sensor, and the UI kept showing the last temperature instead of something like -1/error.
I've encountered the same issue.
check_enclosure_temp invokes get_sensor_data which in turn invokes read_bme280_temp which in turn invokes the BME280.py Python script. With the BME280 temperature / humidity sensor disconnected, the Python script returns -1, -1 corresponding to the temperature and humidity.
Since the temperature or humidity is -1, get_sensor_data returns None, None. Consequently, check_enclosure_temp ignores the sensor data and the temperature and humidity are never updated.
I'd like to try to differentiate the case in which the BME280 sensor is disconnected (-1, -1) and the case in which the BME280 sensor returns bogus values (negative values other than -1). I have five BME280 sensors and several other I2C devices on the same bus. Periodically, a BME280 sensor (while connected) will return negative values. With the BME280 sensor disconnected, I'd like the temperature and humidity updated to read "-1" or "err" as @dwery suggested. However, with negative values other than -1, I'd prefer to ignore the temperature and humidity reading as is currently the case. I have several 'heater' and 'cooler' controllers based on BME280 sensors. If infrequent invalid temperature readings aren't ignored, the controller is effectively disabled until the next reading (10 seconds later).