summaryrefslogtreecommitdiff
path: root/mqtt_ha.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2026-03-17 11:49:42 +0100
committerYuval Adam <_@yuv.al>2026-03-17 11:49:42 +0100
commit3a3d6ed1adc009cc6efee8e0b416137a8d17bb89 (patch)
treeab509587b5368f76dd43031159d46a778691d2a9 /mqtt_ha.py
parent2e79de0ad5024f6c0e53f1c10ce795c05cfb5416 (diff)
Fix 5 bugs in BME280.py verified against Bosch BME280_SensorAPI and Adafruit references
1. get_power_mode() missing parentheses in set_oversamp_pressure and set_oversamp_temperature โ€” compared method object instead of calling it, so sleep-mode check never worked correctly. 2. set_oversamp_humidity else branch wrote ctrl_hum_reg into CTRL_MEAS register instead of ctrl_meas_reg (per datasheet ยง5.4.3, humidity settings require a subsequent write to ctrl_meas with the correct value). 3. dig_H6 stored as unsigned byte โ€” should be int8_t per Bosch bme280_defs.h and Adafruit_BME280.h. 4. dig_H4/H5 sign extension wrong โ€” used to_s16() on 12-bit signed values. Now sign-extends from MSB byte first (to_s8) then combines with LSB nibble, matching Bosch parse_humidity_calib_data() and Adafruit readCoefficients(). 5. Humidity compensation formula was missing var5 multiplication factor vs Bosch compensate_humidity() (BME280_DOUBLE_ENABLE path). Rewritten with Bosch variable names for easy cross-referencing.
Diffstat (limited to 'mqtt_ha.py')
0 files changed, 0 insertions, 0 deletions