-
-
Notifications
You must be signed in to change notification settings - Fork 26
Description
I am trying to transmit readings from a digital smart meter over BLE to home assistant. BTHome appears well suited for broadcasting these values. However I am running into issues relating to the maximum packet size of a BLE advertising packet.
Given the maximal advertisable data (37bytes, with 6 for MAC, 3 for capabilities), 28 bytes are left for BTHome. Then, when using encryption, this leaves only (28-4(len, uuid, header)-4(counter)-4(mic)=) 16bytes. It is possible to transmit multiple advertisement containing different value types, but it is not possible to, for example, transmit 4 kWh readings.
I have looked at advertising using extended advertisements. This works well on the transmitter side, but is currently not feasible due to the lack of support in bleak (related to issue #45).
Therefore, would it be possible to add the possibility to 'tag' individual readings. For example, if a certain bit is set in the BThome header a measurement id is followed by an id. That would mean the data, even for the same reading type, can be spread over multiple advertisement packets.
In that case an advertisement of two temperatures could be:
0x44 0x02 0x00 0xC4 0x09 0x02 0x01 0xC4 0x09
where partial updates would be possible as well:
0x44 0x02 0x01 0xC4 0x09