Skip to content

fix: correct MMC-T201 body temperature estimates - #413

Open
lukaskrnac wants to merge 2 commits into
Bluetooth-Devices:mainfrom
lukaskrnac:fix/mmc-t201-body-temperature
Open

lukaskrnac wants to merge 2 commits into
Bluetooth-Devices:mainfrom
lukaskrnac:fix/mmc-t201-body-temperature

Conversation

@lukaskrnac

Copy link
Copy Markdown

Summary

  • Replace the existing MMC-T201 temperature approximation with a stateful estimate based on the Miaomiaoce app's behavior. The estimate limits how much the difference between T1 and T2 contributes and keeps the existing temperature sensor key.
  • Expose T1 and T2 separately. If either reading is invalid, skip the body temperature estimate and still report the battery level and any valid channel.

Testing

  • All 177 tests passed locally. The regression tests cover invalid readings, duplicate packets, and the limit on the temperature difference.
  • Tested with a physical MMC-T201-2 (MiBeacon product ID 0x00DB) in Home Assistant via an ESP32 Bluetooth proxy. The updated readings closely matched the Miaomiaoce app in the tested range.

@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.69027% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.02%. Comparing base (4f2e29f) to head (b1162f8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/xiaomi_ble/thermometer.py 94.79% 2 Missing and 3 partials ⚠️
src/xiaomi_ble/parser.py 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #413      +/-   ##
==========================================
+ Coverage   61.74%   64.02%   +2.28%     
==========================================
  Files           7        8       +1     
  Lines        1448     1554     +106     
  Branches      290      313      +23     
==========================================
+ Hits          894      995     +101     
- Misses        430      432       +2     
- Partials      124      127       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant