openyou / libfitbit

Library for accessing and transfering data from the Fitbit health device
http://www.openyou.org
BSD 3-Clause "New" or "Revised" License
422 stars 66 forks source link

Cannot complete data bank error #28

Open dinyar opened 12 years ago

dinyar commented 12 years ago

When using the fitbit_client script I receive a "Cannot complete data bank" error. Detailed log output can be found at https://gist.github.com/2774859

dinyar commented 12 years ago

Ok, I "fixed" it by increasing the number of times the get_data_bank function loops:


diff --git a/python/fitbit.py b/python/fitbit.py
index 815d761..ecfea0b 100755
--- a/python/fitbit.py
+++ b/python/fitbit.py
@@ -269,7 +269,7 @@ class FitBit(object):
     def get_data_bank(self):
         data = []
         cmd = 0x70  # Send 0x70 on first burst
-        for parts in range(20):
+        for parts in range(20000):
             bank = self.check_tracker_data_bank(self.current_bank_id, cmd)
             self.current_bank_id += 1
             cmd = 0x60  # Send 0x60 on subsequent bursts

However this is not a great solution. A part of the log output of the working fitbit_client can be found at https://gist.github.com/2782792 -- apparently there are more banks to be retrieved than expected.

qdot commented 12 years ago

Ok, we can up it to something more at least. I probably just hadn't had it on without syncing long enough to get beyond that many banks when I'd written it.

rb2k commented 12 years ago

I had the same problem and the fix worked for me. (yay!)

milessabin commented 12 years ago

I've also just experienced this issue ... it might be coincidental, but I received the "Cannot complete data bank" error after not having synced for a couple of days. Upping the iteration count as suggested by @dinyar fixed the problem for me too.

qdot commented 12 years ago

Ok, I wrote the damn library and I'm running into this myself now, heh. There's gotta be an index somewhere of how many databanks we're supposed to read. Will try to find that.