Skip to content

feat: add support for ZenMeasure CO2 Monitor Lite (MHO-H413) - #414

Open
DanielHou315 wants to merge 3 commits into
Bluetooth-Devices:mainfrom
DanielHou315:feat/mho-h413-co2
Open

DanielHou315 wants to merge 3 commits into
Bluetooth-Devices:mainfrom
DanielHou315:feat/mho-h413-co2

Conversation

@DanielHou315

Copy link
Copy Markdown

Adds the ZenMeasure / Miaomiaoce CO2 Monitor Lite (MHO-H413), a Mijia BLE temperature + humidity + CO2 sensor.

Changes

  • devices.py: product ID 0x6BDF → CO2 Monitor Lite / MHO-H413 / ZenMeasure
  • devices.py: add MHO-H413 to SLEEPY_DEVICE_MODELS. It advertises in bursts with gaps of several minutes, so without this Home Assistant flips the entities to unavailable roughly every 5 minutes (seen over 10 h of real use)
  • parser.py: new object 0x4C1D → CO2 (uint16 LE, ppm) via SensorLibrary.CO2__CONCENTRATION_PARTS_PER_MILLION
  • Tests for temperature (0x4C01), humidity (0x4C08), CO2 (0x4C1D) and the unencrypted header-only beacon

How the device behaves (captured from a real unit)

  • Unbound / broadcast-off: only header frames (0x5830/0x5A30: MAC + capability, no objects)
  • Bound in Mi Home: encrypted MiBeacon v5 frames, frame control 0x5948 (encrypted, object included, no MAC in frame), one object per advertisement roughly every 1–2 min:
    • 0x4C01 float32 → 22.8 °C
    • 0x4C08 float32 → 54.0 %
    • 0x4C1D uint16 → 951 ppm (later 1007 ppm vs 1008 on the device display)
  • Requires a bindkey (from the Xiaomi cloud).

Test frames are synthetic (dummy bindkey 00112233…), built to match the real frame layout.

Notes

  • Home Assistant's xiaomi_ble sensor.py has no (CO2, ppm) entry in SENSOR_DESCRIPTIONS, so HA needs a matching one-entry change to expose the CO2 sensor.
  • Battery is also reported via an existing object handler (seen in Home Assistant after a day of running).

Add product ID 0x6BDF and a parser for MiBeacon object 0x4C1D, which
the MHO-H413 uses for CO2 concentration (uint16, ppm). Temperature
(0x4C01) and humidity (0x4C08) already parse as floats.

The device sends one encrypted object per advertisement with frame
control 0x5948 (no MAC in the frame), plus unencrypted header-only
beacons. Tests use synthetic frames built with a dummy bindkey.
It advertises in bursts with multi-minute gaps, so Home Assistant's
learned advertising interval marks it unavailable between bursts.
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.87%. Comparing base (4f2e29f) to head (d3d4a45).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #414      +/-   ##
==========================================
+ Coverage   61.74%   61.87%   +0.13%     
==========================================
  Files           7        7              
  Lines        1448     1453       +5     
  Branches      290      291       +1     
==========================================
+ Hits          894      899       +5     
  Misses        430      430              
  Partials      124      124              

☔ 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