Ejemplo n.º 1
0
def check_for_fitbit():
    '''This method will check if a FITBIT device of the ID given in the config file 
    is present in the vicinity. If so, it will write a True to the at_home pkl file'''
    dongle = FitBitDongle()
    dongle.setup()
    fitbit = FitbitClient(dongle)
    FitBitUUID = uuid.UUID('{ADAB0000-6E7D-4601-BDA2-BFFAA68956BA}')
    for tracker in fitbit.discover(FitBitUUID):
        tracker_id = a2x(tracker.id)
        if tracker_id == fitbit_tracker_id:
            check_buffer.append(True)
            check_buffer.pop(0)
            pkl.dump(check_buffer, open("/home/pi/sentinel/at_home.p", "wb"))
            return
        else:
            continue
    check_buffer.append(False)
    check_buffer.pop(0)
    pkl.dump(check_buffer, open("/home/pi/sentinel/at_home.p", "wb"))
Ejemplo n.º 2
0
 def testNotShorten(self):
     self.assertEqual(a2x([0] * 5), '00 00 00 00 00')
Ejemplo n.º 3
0
 def testSimple(self):
     self.assertEqual(a2x(range(10)), '00 01 02 03 04 05 06 07 08 09')
Ejemplo n.º 4
0
 def testDelim(self):
     self.assertEqual(a2x(range(190, 196), '|'), 'BE|BF|C0|C1|C2|C3')
Ejemplo n.º 5
0
 def testEncrypt(self):
     z = xtea_encrypt(bytearray('0123456789012345', 'utf-8'),
                      bytearray('ABCDEFGH', 'utf-8'))
     self.assertEqual(a2x(z), 'B6 7C 01 66 2F F6 96 4A')
 def testNotShorten(self):
     self.assertEqual(a2x([0] * 5), '00 00 00 00 00')
 def testSimple(self):
     self.assertEqual(a2x(range(10)), '00 01 02 03 04 05 06 07 08 09')
 def testDelim(self):
     self.assertEqual(a2x(range(190, 196), '|'), 'BE|BF|C0|C1|C2|C3')