NobodyForNothing / blood-pressure-monitor-fl

A cross platform app to save blood pressure values with export function
MIT License
58 stars 10 forks source link

App always imports the first measurement instead the newest #352

Open DerSaxxe opened 2 months ago

DerSaxxe commented 2 months ago

Description

With Medisana BU550 connect the app imports not the newest measurement. Always the oldest one is saved.

Btw: Thank you for development!

Android version

Android 11

Reproduction steps

1. Delete memory of the BU550 connect
2. Make the first measurement and import it.
3. Make another measurement and try to import.
4. You will see that the first measurement was imported.

Screenshots & Settings backup

No response

App debug info

No response

NobodyForNothing commented 1 month ago

Unfortunately I have no experience with the BU550 connect but if I understood you correctly you have to manually transmit values. (Please correct me if I'm wrong)

The intended scenario for the Bluetooth input feature was the following:

  1. You take a measurement
  2. Your measurement device automatically advertises data over Bluetooth
  3. You open the app and tap on Bluetooth input
  4. The app and the device figure out how to prefill measured data

Could you check whether your devices supports such a protocol? If not I can convert this to a feature request for importing data from Bluetooth.

NobodyForNothing commented 1 month ago

A similar problem was reported on the Beurer BM 57 through another channel. After attempting the process described in my reply above, any further reports on which devices work and which don't are welcome:

Preliminary compatibility table

Reported working Reported broken
Boso medicus CE6674 Medisana BU550
Omron x7 smart Beurer BM 57
- Silvercrest SBM69
pimlie commented 1 week ago

An older Silvercrest SBM69 from the Lidl doesn't work as expected either unfortunately. It has an internal memory for 2 users with each 100 measurements. The measurement that is imported by the app is the average value of all the measurements of the current user. The manual says it always transfers all available measurements when sending bluetooth data to the Lidl HealthForYou app. So apparently it never sends a single measurement.

pimlie commented 1 week ago

FWIW: With this tool I can read all data from the SBM69: https://github.com/ignisf/sbm69

Relevant code seems to be these lines: https://github.com/ignisf/sbm69/blob/master/src/sbm69/connection.py#L66-L71

If I understand the BleReadCubit class correctly, the issue might be this line: https://github.com/NobodyForNothing/blood-pressure-monitor-fl/blob/main/app/lib/features/bluetooth/logic/ble_read_cubit.dart#L179 as this means that currently after the first measurement is received this app stops listening for other measurements. So instead of calling cancel it should probably keep listening/reading measurements and wait until either the device disconnects or a timeout occurs

NobodyForNothing commented 1 week ago

That's a great find! Your approach to the solution is also much simpler and stable than my initial idea of device specific code.

Two remarks:

  1. From a glance it seems like the python code uses a notification instead of a indication. As far as I know the difference is just a few bits send to the ble device, but that needs more testing (from the behavior reported here it seems like it's fine for these cheap devices).
  2. I still wouldn't wait with filling in the measurements (some cheap devices might not implement connection closing) and replace them in the (presumably) rare case a newer measurement (timestamp) is reported later.