All Projects → freezed-or-frozen → Pymb1a

freezed-or-frozen / Pymb1a

Licence: gpl-3.0
Python class to communicate with Xiaomi Mi band 1A fitness tracker

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Pymb1a

Web Bluetooth Terminal
Progressive Web Application for serial communication with your own Bluetooth Low Energy (Smart) devices
Stars: ✭ 130 (+441.67%)
Mutual labels:  bluetooth-low-energy, iot
Angular Web Bluetooth
The missing Web Bluetooth module for Angular
Stars: ✭ 164 (+583.33%)
Mutual labels:  bluetooth-low-energy, iot
Xiaomi Flower Care Api
Xiaomi Flower Care (MiFlora) API wrapper.
Stars: ✭ 111 (+362.5%)
Mutual labels:  bluetooth-low-energy, iot
Ehal
Embedded Hardware Abstraction Library
Stars: ✭ 84 (+250%)
Mutual labels:  bluetooth-low-energy, iot
Blynk Library
Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
Stars: ✭ 3,305 (+13670.83%)
Mutual labels:  bluetooth-low-energy, iot
Nrf52832 Mdk
An Open Source, Micro Development Kit for IoT Embedded Applications using the nRF52832 SoC
Stars: ✭ 166 (+591.67%)
Mutual labels:  bluetooth-low-energy, iot
Bluetoothlinux
Pure Swift Linux Bluetooth Stack
Stars: ✭ 149 (+520.83%)
Mutual labels:  bluetooth-low-energy, iot
Gort
Command Line Interface (CLI) for RobotOps
Stars: ✭ 425 (+1670.83%)
Mutual labels:  bluetooth-low-energy, iot
Fruitymesh
FruityMesh - The first completely connection-based open source mesh on top of Bluetooth Low Energy (4.1/5.0 or higher)
Stars: ✭ 229 (+854.17%)
Mutual labels:  bluetooth-low-energy, iot
Radareeye
A tool made for specially scanning nearby devices[BLE, Bluetooth & Wifi] and execute our given command on our system when the target device comes in-between range.
Stars: ✭ 218 (+808.33%)
Mutual labels:  bluetooth-low-energy, iot
Cylon
JavaScript framework for robotics, drones, and the Internet of Things (IoT)
Stars: ✭ 3,862 (+15991.67%)
Mutual labels:  bluetooth-low-energy, iot
Watchy
Watchy - An Open Source E-Ink Smartwatch
Stars: ✭ 469 (+1854.17%)
Mutual labels:  bluetooth-low-energy, iot
Arraymancer
A fast, ergonomic and portable tensor library in Nim with a deep learning focus for CPU, GPU and embedded devices via OpenMP, Cuda and OpenCL backends
Stars: ✭ 793 (+3204.17%)
Mutual labels:  iot
Mqttx
MQTT X - Elegant MQTT 5.0 Client Tool of Cross-platform
Stars: ✭ 892 (+3616.67%)
Mutual labels:  iot
Sitewhere
SiteWhere is an industrial strength open-source application enablement platform for the Internet of Things (IoT). It provides a multi-tenant microservice-based infrastructure that includes device/asset management, data ingestion, big-data storage, and integration through a modern, scalable architecture. SiteWhere provides REST APIs for all system functionality. SiteWhere provides SDKs for many common device platforms including Android, iOS, Arduino, and any Java-capable platform such as Raspberry Pi rapidly accelerating the speed of innovation.
Stars: ✭ 788 (+3183.33%)
Mutual labels:  iot
Awesome Beacon
A curated list of awesome Bluetooth beacon software and tools.
Stars: ✭ 785 (+3170.83%)
Mutual labels:  bluetooth-low-energy
Nativescript Particle
🕹 Control your https://particle.io devices from NativeScript
Stars: ✭ 19 (-20.83%)
Mutual labels:  iot
Esp32 ble wedo
A library to control LEGO wedo 2.0 with the ESP32 through Bluetooth low energy
Stars: ✭ 16 (-33.33%)
Mutual labels:  bluetooth-low-energy
Volantmq
High-Performance MQTT Server
Stars: ✭ 785 (+3170.83%)
Mutual labels:  iot
Pytradfri
IKEA Trådfri/Tradfri API. Control and observe your lights from Python. Examples available. On pypi. Sans-io.
Stars: ✭ 778 (+3141.67%)
Mutual labels:  iot

pymb1a

Python class to communicate with Xiaomi Mi band 1A fitness tracker. Should works on Python 3.4 under Linux OS (Ubuntu and Raspian).

I mainly use :

  • Bluetooth sniffing with Wireshark
  • Gadgetbridge logs file, source code and community.
  • bluepy as a Bluetooth Low Energy library

Thanks to all.

Requirements

You have to install bluepy.

pip3 install bluepy

Installation

Download the main class file and add it to your project

Usage

Import the class

import mi_band_1a

Instanciate object with user informations

mb1a = MiBand1A(gender=2, age=25, height=175, weight=70, alias="jbegood", which_hand=0, keep_data=True)

Scan with a 5s timeout all good device close enought with a -80 dBm RSSI threshold

if mb1a.scan_and_connect(5.0, ["c8:0f:10:01:02:03", "c8:0f:10:04:05:06"], -80) == True:
    # do the rest (get characteristics, subscribe notifications, read/write informations, authenticate, activity/sensor data...)

Get useful services and characteristics

mb1a.get_services_and_characteristics()

Subscribe to useful notifications

mb1a.subscribe_to_notifications()

Read some public informations

print("   + device_info : ", mb1a.read_device_info() )
print("   + date_time : ", mb1a.read_date_time() )
print("   + battery : ", mb1a.read_battery() )
print("   + realtime_steps : ", mb1a.read_realtime_steps() )

Vibrate during 0.5s

mb1a.vibrate(0.5)

Flash leds"

mb1a.flash_leds()

Authenticate in order to read private informations (activity data and sensor data)

print("   + authenticate success : ", mb1a.authenticate() )

Fetch activity data, decode it to read the steps recorded inside

print("   + activity data steps recorded : ", mb1a.fetch_activity_data("dump_activity_data.csv") )

Read and record about 300 sensor data samples in a CSV file (a little bit more actually)

mb1a.record_sensor_data("dump_sensor_data.csv", 300)

Finally disconnect to the device

mb1a.disconnect()

To do list

Basic informations roadmap :

  • read basic informations
    • battery
    • realtime steps
    • date time
    • device informations
    • device name
    • goal
  • write basic informations
    • date time
    • device name
    • goal
  • vibrate the wrist
  • light on/off leds

Security informations roadmap :

  • handle pairing (for now you have to pair the device manually before using this class using bluetooth manager)
  • authenticate to access private data (activity data and sensor data)

Sensor data roadmap :

  • read sensor data (accelerometer raw value)
  • analyse and record sensor data (accelerometer raw value) in a CSV file

Activity data roadmap :

  • read activity data (steps, sleep) recorded in the device
  • analyse and count steps contained in activity data
  • analyse sleep informations contained in activity data
  • analyse and record sensor data (accelerometer raw value) in a CSV file

Other roadmap

  • create a pip package
  • write documentation

Changelog

Release 0.1.0

  • first release
  • read basic informations like battery, realtime steps
  • can read and record in a CSV file raw value from accelerometer
  • can read and count steps done in activity data recorded in the device
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].