Skip to main content

Module bthome

Module bthome 

Source
Expand description

BTHome v2 (https://bthome.io/format/): service data of UUID 0xFCD2.

The first byte is the device information: bit 0 encryption, bit 2 trigger-based, bits 5 to 7 the version (2). Objects follow, each an object id and a value whose size the id fixes. An encrypted frame is AES-128-CCM with a 4-byte tag and the nonce MAC (6, as printed) || UUID (d2 fc) || device info || counter (4); the counter and tag follow the ciphertext.

A receiver must stop at an object id it does not know, since it cannot know that object’s size; BtHome::unknown_object says where that happened.

Structs§

BtHome
A BTHome v2 frame.
Event
A button or dimmer event.
Measurement
A measurement or state.

Constants§

SERVICE_UUID
BTHome’s service UUID.

Functions§

decode
Decodes BTHome service data (after the UUID). None when it is not v2.
encrypt
Encrypts a BTHome v2 payload (the objects, without the device info byte) into service data, as a device would: for tests and for a gateway that broadcasts BTHome itself.