1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.62k stars 795 forks source link

BME/BMP280: Don't publish data if no sensor is present & hotplugging #2069

Open chris-heo opened 1 month ago

chris-heo commented 1 month ago

Is your feature request related to a problem? Please describe. Currently, when no BME/BMP280 is attached, each report cycle temperatures/humidity/pressure being 0 are published to MQTT

Describe the solution you'd like Only report, if data is actually available, init sensor when it's hot plugged and make the sensor address selectable via compiler flag

Describe alternatives you've considered I implemented it but am not as used to clone chungus repos & post pull requests, so find a patch attached :) BME280.diff.txt

Additional context Compiler flag in environment.ini e.g. '-DBME280_ADDR=0x77' can be used Limitation: if sensor are swapped in between reads (without an unsuccessful read), calibration data is not updated.