In the quest for a DIY BT sensor I have stumbled upon BTHome.
It’s an open standard for bluetooth sensors that’s officially supported by Home Assistant with an integration.
You can use a ESP32 for example, connect a bunch of sensors on it and BTHome can directly send the supported entities to HA where will be direct discovered and available.
It’s very interesting project that I want to use for battery sensors (definetely less power than WiFi sensors)
The ESP32 example from TheDigital1 wasn’t working for me and tried to update it, making it more programmer friendly.
The result is here: BTHome V2 ESP32 example
You are free to use it for your DIY sensors.
EDIT: The encryption works
Please read the instructions on github, there are comments in the code for better understanding.
Happy programming!