On my scale (Xiaomi Mi Body Composition 2), catty units is indicated by the 6th bit of the control byte being on (so in your code control_byte & (1 << 6) instead of measunit & (1 << 4) (miscale.py line 45].
I have not tested on other models, but I believe Mi Scale 2, etc. (all "V2" models) are the same.
I have not actually run your code (that's why I didn't make a PR), I just found this in my own testing with the device.
However, I have also noticed many other apps/libraries don't even detect catty units for V2 scales (e.g. https://github.com/esphome/esphome, https://github.com/lolouk44/xiaomi_mi_scale), not sure why. Either because nobody is using catty units (I don't either, I just noticed this while testing different units). Or there is some discrepancy between models or difficulty detecting it.
EDIT: my mistake, oliexdev/openScale actually is detecting catty units the same way as I described above (6th bit of control byte 1), however that code seems to have a bug where they are also using the 6th bit as "isDateInvalid", which has an open bug report
What happened?
On my scale (Xiaomi Mi Body Composition 2), catty units is indicated by the 6th bit of the control byte being on (so in your code
control_byte & (1 << 6)
instead ofmeasunit & (1 << 4)
(miscale.py line 45].I have not tested on other models, but I believe Mi Scale 2, etc. (all "V2" models) are the same.
I have not actually run your code (that's why I didn't make a PR), I just found this in my own testing with the device.
I have seen other sources found the same thing:
However, I have also noticed many other apps/libraries don't even detect catty units for V2 scales (e.g. https://github.com/esphome/esphome, https://github.com/lolouk44/xiaomi_mi_scale), not sure why. Either because nobody is using catty units (I don't either, I just noticed this while testing different units). Or there is some discrepancy between models or difficulty detecting it.
EDIT: my mistake, oliexdev/openScale actually is detecting catty units the same way as I described above (6th bit of control byte 1), however that code seems to have a bug where they are also using the 6th bit as "isDateInvalid", which has an open bug report
Sensor type
MiScale V2
Relevant log output
No response