def main():
    fb = fitbit.make_class()
    devices = fb.devices_json()
    device = devices[0]
    battery = device['battery']
    pu = p.pushover()
    pu.send_message( 'Current Battery Status: ' + battery )
Beispiel #2
0
def main():
    fb = fitbit.make_class()
    devices = fb.devices_json()
    device = devices[0]
    battery = device['battery']
    pu = p.pushover()
    pu.send_message('Current Battery Status: ' + battery)
Beispiel #3
0
def main():
    fb = fitbit.make_class()
    db = mydb.Database( 'csoc' )
    sql = "select weight from weight where CURRENT_DATE = DATE(date)"
    out = db.db_array( sql , )
    if len(out) > 0 :
        weight = out[-1][-1] 
        response = fb.log_body_weight( weight )
        if response['weightLog'] :
            a = 1
        else:
            print response
def get_day_data( date='' ):
    if date == '' :
        date = datetime.date( 2012,06,20 )
    # start is june 20 2012
    weekdays = ( 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat' , 'Sun' ) 
    data = {}
    datestr = date.strftime("%Y-%m-%d")
    fb = fitbit.make_class()
    fbr = fb.activities_date_json( datestr )
    summary         = fbr['summary']
    distances       = summary['distances']
    data['date']    = datestr
    data['floors']  = summary['floors']
    data['steps']   = summary['steps']
    data['distance_k'] = 0
    
    for d in distances:
        activity = d['activity']
        if activity == 'total':
            data['distance_k'] = d['distance']
    data['distance_m'] = "%.02f" % ( data['distance_k'] * 0.621371 )
    data['distance_k'] = "%.02f" % data['distance_k'] 
    return data