satcar77 / miband4

Access Xiaomi MiBand 4 from Linux using Bluetooth LE
MIT License
483 stars 110 forks source link

how can i only read the last heart rate and save to txt? #12

Closed plscarrymeeeeeeee closed 4 years ago

plscarrymeeeeeeee commented 4 years ago

how can i read the live heart rate and save it to txt without the menu and the other stuff? with cron job thx ^^

satcar77 commented 4 years ago

The menu is only for the demo. Check this function: https://github.com/satcar77/miband4/blob/0935d0d85e8fefbd909e7c97a2e3023342e3f08d/miband4_console.py#L120 Instead of passing a callback function to simply print the data, pass a function to log the data into a text file in band.start_heart_rate_realtime(heart_measure_callback=heart_logger)