#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(1) steps = 1234 print "Setting current steps to {}...".format(steps) dev.setCurrentSteps(steps) print "OK"
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(1) print "Enabling RealTime notifications..." dev.enableRealTimeSteps() print "Now, move on! (Ctrl+c to stop)" try: while True:
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(1) print "Enabling RealTime notifications..." dev.enableRealTimeSteps() print "Now, move on! (Ctrl+c to stop)" try: while True: time.sleep(1)
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() male = True # gender age = 30 # years height = 189 # cms weight = 80 # kgs type_ = 00 uid = 1563037356 alias = str(uid) # must be 10 digits print "Setting user info..." dev.setUserInfo(uid, male, age, height, weight, type_) time.sleep(1) dev.locate()
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() dev.selfTest() print "OK"
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(1) steps = 11 print "Setting goal to {} steps...".format(steps) dev.setGoal(steps) print "OK"
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(2) print "Sending command..." dt = dev.getDateTime() print "Device Date/Time:", dt print "OK"
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(5) print "changing colors..." colors = [ (0, 0, 0), # off (0, 0, 6), # blue (0, 6, 0), # green (0, 6, 6), # cyan (6, 0, 0), # red
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() print "OK"
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(5) print "changing colors..." colors = [(0, 0, 0), # off (0, 0, 6), # blue (0, 6, 0), # green (0, 6, 6), # cyan (6, 0, 0), # red
# -*- mode: python; coding: utf-8 -*- import sys import time from datetime import datetime, timedelta from mibanda import BandDevice, EVERYDAY if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(1) print "Setting alarm to run in a few seconds..." timeout = 90 now = datetime.now() dev.setDateTime() when = now + timedelta(seconds=timeout) dev.setAlarm1(when, smart=False, repeat=EVERYDAY)
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) time.sleep(1) print "Set vibration on..." dev.startVibration() time.sleep(2) print "Set vibration off..." dev.stopVibration()
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- from __future__ import print_function import sys from datetime import datetime from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print("Usage: {} <mac_address>".format(sys.argv[0])) sys.exit(1) print("Connectiing, please wait...") dev = BandDevice(sys.argv[1], "") dev.connect() devinfo = dev.getDeviceInfo() print("DEVICE INFO:") print(" - firmware_version: ", devinfo.firmware_version) binfo = dev.getBatteryInfo() elapsed = (datetime.now() - binfo.last_charged).days print("BATTERY:") print(" - level: {}%".format(binfo.level)) print(" - last_charged:", binfo.last_charged) print(" - charge_counter: {} times".format(binfo.charge_counter)) print(" - elapsed: {} days".format(elapsed)) print(" - status:", binfo.status)
#!/usr/bin/python -u # -*- mode: python; coding: utf-8 -*- import sys import time from mibanda import BandDevice if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {} <mac_address>".format(sys.argv[0]) sys.exit(1) print "Connectiing, please wait..." dev = BandDevice(sys.argv[1], "") dev.connect() print "Pairing..." dev.pair() # NOTE: after locate, you must send the user info to your miband dev.setUserInfo(uid=1, male=False, age=2, height=2, weight=2, type_=0) print "Faster vibration (10 times)..." time.sleep(2) dev.customVibration(10, 25, 10) print "Water drop vibration (5 times)..." time.sleep(2) dev.customVibration(5, 25, 1200)