Bluetooth-Devices / bthome-ble

Parser for BTHome BLE devices
https://bthome.io/
MIT License
69 stars 14 forks source link

Missing support for Packet ID #34

Closed kzyapkov closed 1 year ago

kzyapkov commented 1 year ago

Describe the bug bthome.io defines "Packet id" as 0x00 and one byte payload. This is not supported in the current implementation, and it's presence in an advertisement prevents all other measurements to be processed, since it needs to come first.

To Reproduce Steps to reproduce the behavior:

Have a device which uses packet ID. Sample v2 service data payload: 40 00 1e 01 64 3a 01

Additional context Adding a dummy 0x00: MeasTypes(meas_format=description.BaseSensorDescription), to bthome_ble.const.MEAS_TYPES allows measurements to be parsed.

On https://bthome.io/format/ the table for Packet ID lists 0009 as sample value, but it should be 09, since packet ID is defined as uint8.

Ernst79 commented 1 year ago

Thanks, will fix it.

BTW, the example 0009 is the combination of object id 00 + packet id 9 09, hence 0009

Needs https://github.com/Bluetooth-Devices/sensor-state-data/pull/45 first. Done

Ernst79 commented 1 year ago

Fixed in 2.4.0. PR for HA is also submitted in https://github.com/home-assistant/core/pull/84189

After this PR in HA is merged, you will get a packet id sensor, which will be disabled by default and which will be of the sensorclass "diagnostics", like RSSI