BTHome.Decoder (BTHome v0.1.0)

View Source

Decoder for BTHome v2 format.

This module provides functions to decode BTHome v2 binary data into structured measurement data.

Summary

Functions

Decode BTHome v2 binary data

Decode BTHome v2 binary data with decryption support.

Functions

decode_measurements(data, opts \\ [])

Decode BTHome v2 binary data

decode_with_decryption(data, key, mac_address)

Decode BTHome v2 binary data with decryption support.

Options

  • :key - 16-byte encryption key (required for encrypted data)
  • :mac_address - 6-byte MAC address (required for encrypted data)

Examples

# Unencrypted data
{:ok, decoded} = decode_measurements(data)

# Encrypted data
opts = [key: encryption_key, mac_address: device_mac]
{:ok, decoded} = decode_measurements(encrypted_data, opts)