Xiaomi GAP sensor data parser
Clone or download
Latest commit 670ca6d Dec 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Jan 30, 2018
LICENSE Initial commit Jan 30, 2018
README.md table Jan 31, 2018
example.js initial commit Jan 30, 2018
index.js initial commit Jan 30, 2018
package-lock.json 1.0.2 Dec 11, 2018
package.json 1.0.2 Dec 11, 2018

README.md

xiaomi-gap

Xiaomi GAP sensor data parser

Used for parsing data frames from Xiaomi Mijia brand BLE sensors

API

readServiceData

In: Buffer|Array|String

Out:

result = {
	productId: Number,
	counter: Number,
	frameControl: [],
	mac: String, // Optional,
	capability: CapabilityBitMask, // Optional
	event: {
		eventID: Number,
		length: Number,
		raw: String,
		data: Object,
	} // Optional
}

CapabilityBitMask:

Bit Name Explanation
0 Connectable True of device is cabable of establishing a connection
1 beCentral True of device is cabable of serving as a central device
2 security True of device is capable of data encryption
3-4 bonding 00 - No MIOT binding, 01 - before MIOT binding, 10 - after MIOT binding

Usage

To use this library you need to be able to discover the Xiaomi sensor advertising and then pass the Xiaomi service data (0xfe95) to it as a Buffer. For full example, see example.js.

Supported sensors

Xiaomi Mijia Bluetooth Temperature and Humidity sensor (with LCD)

This sensor is fully supported in normal operation. Library is able to read Temperature, Humidity and battery levels from frames.

Sources

Sources used during this project are official Xiaomi MIOT documents available on their site