Skip to content
This repository has been archived by the owner on Apr 14, 2018. It is now read-only.

Put fitbit to sleep and poll (to support multiple fitbits) #45

Merged
merged 2 commits into from Oct 21, 2012

Conversation

tytso
Copy link
Contributor

@tytso tytso commented Sep 19, 2012

The first commit is an update (so it applies to the current master branch) of bensmithhurts's pull request (https://github.com/qdot/libfitbit/pull/20). The second uses the first so that instead of having the fitbit_client sleep for 15 minutes, to instead immediately restart polling for another fitbit device to wake up. This makes it much more useful in a multi-fitbit household, and is consistent with how the official Windows / Mac fitbit base station works.

This is a fix up of Ben Smithurst's pull request
(https://github.com/qdot/libfitbit/pull/20) so that it applies to the
current fitbit tree.  His original commit request read:

    From reading the logs on windows it appears that the windows
    client sends a final command at the end to put the tracker to
    sleep for the 15 minute sync interval. This change appears to have
    the desired effect of making libfitbit do the same.

After experimenting with this change, I find it's an important thing
to do for two reasons.

1) It definitely improves the battery lifetime of the fitbit
device, in a very noticeable way.

2) If there is multiple people within range of the base station (say,
if there is someone else also using a fitbit on the walkstation right
next to yours), it's important to put the device to sleep so that the
next time the fitbit client runs, the client can talk to the other
device.  Otherwise, the fitbit device with the lower serial number
appears to always "win" and if you have the newer fitbit, you can ever
get the information sent back to the fitbit servers.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Now that we are putting the fitbit device to sleep for 15 minutes, it
is not necessary for the fitbit_client.py script to sleep for 15
minutes before restarting the cycle.

If there are multiple devices in range of the base station, this is
important so that the fitbit client can quickly collect information
from both devices.  It is also useful in the situation where someone
wanders by the base station software while it is running; by not
making the base station software be quiscient for 15 minutes between
polls, it makes it more likely that we will collect information from a
fitbit client which is near us, and send that information back to the
fitbit servers.

(This is especially handy if there are going to be large number of
users at a site all using fitbits as part of a employee fitness
program.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
qdot added a commit that referenced this pull request Oct 21, 2012
Put fitbit to sleep and poll (to support multiple fitbits)
@qdot qdot merged commit 588885a into openyou:master Oct 21, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants