shemerey / node-xiaomi-scale

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-xiaomi-scale

MiScale class

Constructor

constructor optionally accepts mac address string. If string is given, it only emits data from given address.

MiScale.startScanning()

Start BLE scan and search for Mi scale.

MiScale.stopScanning()

Stop BLE scan.

MiScale.on('data', function cb(scale))

If nearby Mi Scale is scanned and if it met given criteria (matching mac address, not a duplicated entry), it emits its data using 'data' event.

scale.address

Bluetooth address of Mi Scale.

scale.svcUUID

Mi Scale service uuid.

scale.svcData

Raw Mi Scale service data.

scale.manufacturerData

Raw Mi Scale manufacturer data.

scale.isStabilized

If scale reading is stabilized, This flag will set to true.

scale.loadRemoved

If weight on scale is removed, This flag will set to true.

scale.unit

Measurement unit.

scale.sequence

Sequence number.

Thanks to

https://github.com/chaeplin, who built Xiaomi scale protocol parser prototype with Python. (https://github.com/chaeplin/Xiaomi_scale_scan)

About

License:GNU Lesser General Public License v3.0


Languages

Language:JavaScript 100.0%