コード例 #1
0
ファイル: set_current_steps.py プロジェクト: felipeq/miband
#!/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"
コード例 #2
0
ファイル: get_realtime_steps.py プロジェクト: felipeq/miband
#!/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:
コード例 #3
0
ファイル: get_realtime_steps.py プロジェクト: felipeq/miband
#!/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)
コード例 #4
0
ファイル: set_user_info.py プロジェクト: felipeq/miband
#!/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()
コード例 #5
0
ファイル: self_test.py プロジェクト: felipeq/miband
#!/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"
コード例 #6
0
ファイル: set_goal.py プロジェクト: felipeq/miband
#!/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"
コード例 #7
0
ファイル: self_test.py プロジェクト: felipeq/miband
#!/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"
コード例 #8
0
ファイル: get_date_time.py プロジェクト: felipeq/miband
#!/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"
コード例 #9
0
ファイル: colors.py プロジェクト: felipeq/miband
#!/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
コード例 #10
0
ファイル: pair.py プロジェクト: felipeq/miband
#!/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"
コード例 #11
0
ファイル: colors.py プロジェクト: felipeq/miband
#!/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
コード例 #12
0
#!/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"
コード例 #13
0
ファイル: set_alarm.py プロジェクト: felipeq/miband
# -*- 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)
コード例 #14
0
ファイル: vibrate.py プロジェクト: felipeq/miband
#!/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()
コード例 #15
0
#!/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)
コード例 #16
0
#!/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()
コード例 #17
0
ファイル: custom_vibration.py プロジェクト: felipeq/miband
#!/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)