#ble #bluetooth #bthome


A library for decoding sensor readings from BLE advertisements, including the BTHome format

1 unstable release

0.1.0 Sep 2, 2023

#646 in Hardware support

44 downloads per month
Used in mijia-homie


1.5K SLoC

BLE sensor advertisement library

crates.io page docs.rs page

A library for decoding sensor readings from BLE advertisements.

Currently supports:

The actual BLE scanning is up to you, so this library doesn't depend on any particular Bluetooth library or platform. It just provides types and functions to decode the data you give it.


use std::collections::HashMap;
use btsensor::{bthome, Reading};

// In a real program, this service data would be obtained from a BLE scan.
let service_data: HashMap<Uuid, Vec<u8>> = [(
    vec![0x23, 0x02, 0xC4, 0x09, 0x03, 0x03, 0xBF, 0x13],

let decoded = Reading::decode(&service_data).unwrap();
println!("{}", decoded);

For a more complete example, see the examples directory.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~23K SLoC