fix: reset S400 stabilized on idle packet and add stabilized support for Scale v1/v2#322
Merged
Ernst79 merged 12 commits intoJun 7, 2026
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #322 +/- ##
==========================================
+ Coverage 54.91% 55.19% +0.27%
==========================================
Files 7 7
Lines 1393 1406 +13
Branches 271 276 +5
==========================================
+ Hits 765 776 +11
- Misses 513 514 +1
- Partials 115 116 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8ba42b1 to
08b5c40
Compare
08b5c40 to
a54f0c4
Compare
Contributor
Author
|
@Ernst79 Great, thank you! As soon as you merge these changes, I'll handle the next step and open a PR to add these modifications to Home Assistant's native xiaomi_ble component. |
Ernst79
reviewed
Jun 7, 2026
Ernst79
requested changes
Jun 7, 2026
…ub.com/dckiller51/xiaomi-ble into fix-scales-stabilization-binary-sensor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the merged PR adding
stabilizedbinary sensor for S400. This PR fixes a bug where the S400 stabilized sensor was not reset when the user stepped off the scale, and extendsstabilizedsupport to Mi Smart Scale v1 and Mi Body Composition Scale v2.Changes
_parse_xiaomi— S400 idle packet fix_S400_MODELSclass attribute (MJTZC01YM,MJTZC03YM)frctrl_object_include == 0), the stabilized sensor is now reset toOFF— previously it was silently ignored, leaving the sensor stuck onONafter a barefoot weighing_parse_scale_v1— Mi Smart Scale (XMTZC01HM/XMTZC04HM)stabilizedbinary sensor:ONwhenmass_stabilized=Trueandmass > 0,OFFotherwiseOFFonmass == 0(person stepped off)_parse_scale_v2— Mi Body Composition Scale (XMTZC02HM/XMTZC05HM/NUN4049CN)stabilizedbinary sensor with the same logic as v1impedance_stabilized=TrueTests added
test_Xiaomi_Scale1_reset— v1 reset when person steps off (mass=0, stabilized=False)test_Xiaomi_Scale2_reset— v2 reset when person steps off (mass=0, stabilized=False)