oliexdev / openScale

Open-source weight and body metrics tracker, with support for Bluetooth scales
GNU General Public License v3.0
1.73k stars 298 forks source link

Support for nameless OKOK scales (Myria MY4836) #1081

Closed Florin9doi closed 6 days ago

Florin9doi commented 1 month ago

Closes #950

TRex22 commented 1 week ago

@Florin9doi Thank you for this 🙏🏻

It helped me use my scale.

I did notice that the impedance readings were not coming through. I took a look at core/bluetooth/BluetoothOKOK.java and see that the code appears incomplete. My scale uses the fallback conditional branch which does not extract impedance.

Ive started building out a processing module for OKOK compatible scales but Im not sure 100% which calculations to be using. Kind of guessing, trying to reverse engineer the app, and also looking at how the other scales calculate their data. My work is forked off your PR since my scale is one of the ones with no name.

I don't have examples of the other type of OKOK scales. Ill try my best to update the code in a way that helps everyone who uses these scales.

If anyone has example payloads I could use them to test my work

oliexdev commented 6 days ago

Thanks for your PR, yeah some scales has no Bluetooth names. Might be problem if we have different vendors using scales with no Bluetooth names.

Could you explain why you using TextUtils.isEmpty instead of name.isEmpty()? If there is no specific reason I would change it to name.isEmpty() to make the code more consistent.

Florin9doi commented 6 days ago

TextUtils.isEmpty is used to check also for null in a single operation, instead of name==null || name.isEmpty

oliexdev commented 6 days ago

Thanks for your quick reply and your explanation, I have just merged your PR into the master branch. Thanks again! :1st_place_medal:

oliexdev commented 6 days ago

I am sorry I had to revert it as it appears that of course every Bluetooth address appears now as the nameless scale. We need to figure out how to filter these out. Unfortunately I cannot reopen this PR again :( My fault sorry.

oliexdev commented 6 days ago

I created a new PR https://github.com/oliexdev/openScale/pull/1088 for reopen this PR