1.0.3 • Published 5 years ago

xiaomi-gap-parser v1.0.3

Weekly downloads
5
License
ISC
Repository
-
Last release
5 years ago

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:

BitNameExplanation
0ConnectableTrue of device is cabable of establishing a connection
1beCentralTrue of device is cabable of serving as a central device
2securityTrue of device is capable of data encryption
3-4bonding00 - 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