Looking for feedback on possible aioble example code contribution for broadcast beacon #17025
DavesCodeMusings
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been playing around with Bluetooth Low Energy (BLE) beacons using MicroPython aoible. The idea behind BLE beacons is to communicate small amounts of data at regular intervals so Bluetooth listeners can read it without having to maintain a connection to the device. Many times the device spends most of its time sleeping, waking up to broadcast data only for a short period before sleeping again. For example a battery-powered weather sensor periodically communicating temperature and humidity to a home automation system.
I've successfully built one with an ESP32 and an open format called BTHome.
On my quest, I found no examples of building any type of BLE beacon using MicroPython, only C++. As such, I'd like to contribute a simple beacon example to the aioble examples
I'd like to get some feedback before doing a pull request and this is where I'm hoping you can help.
Below is the code I'm proposing. I'm hoping the comments are enough to make it easily understood, focusing on the advertising aspect rather than the details of the BTHome payload. If something's missing or unclear, let me know.
Sample code is not ESP specific and should run on anything with Bluetooth and deepsleep capability.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions