You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
A MicroPython module to format sensor readings for BTHome BLE advertising payloads.
3
3
4
4
## What is it?
5
-
BTHome-MicroPython provides an easy way to send sensor readings, via Bluetooth Low Energy (BLE) advertisements, to home automation systems like Home Assistant. The sample main.py shows how to collect temperature and humidity data and make it available to Home Assistant with the BTHome integration.
6
-
7
-
The use case I had in mind when creating this is an ESP32 that sits on my front porch and measures outdoor temperature, humidity, and sunlight levels.
5
+
BTHome-MicroPython provides an easy way to send sensor readings from MicroPython-based microcontrollers, via Bluetooth Low Energy (BLE) advertisements, to home automation systems like Home Assistant that support the BTHome data format. The sample main.py shows how to transmit mocked-up temperature and humidity data in BTHome format using this module.
8
6
9
7
## Why should I care?
10
8
While many popular Bluetooth devices can have their stock firmware flashed to use BTHome and therefore easily integrate with Home Assistant, this does not help the hobbyist who wants to create a DIY sensor using an easily learned language like MicroPython. With this module, you can create custom sensors that act as Bluetooth beacons. Where you take it from there is up to your imagination.
11
9
10
+
The use case I had in mind when creating this is an ESP32 that sits on my front porch and measures outdoor temperature, humidity, and sunlight levels.
11
+
12
12
## Couldn't I just use ESPHome?
13
13
You could, but do you really want a device containing your WiFi credentials in an unsecured location outside your home? I don't. I'd rather broadcast BLE advertisements I can read from indoors. If the device sending them is lost or stolen, I'm out a few dollars, but no data is compromised.
14
14
@@ -25,11 +25,11 @@ mpremote connect PORT mip install aioble-peripheral
25
25
Once you've got the modules installed, have a look at the code sample in [main.py](main.py) here in this repository.
26
26
27
27
Building your own sensor beacon boils down to this...
28
-
1. Import the bthome module
29
-
2. Create a new instance of the BTHome class, passing in the device name you want
30
-
3.Write the sensor readings to the BTHome properties you're using
31
-
4. Call the `pack_advertisement()` method with parameters to indicate what data to broadcast
32
-
5. Send that advertising data to `aioble.advertise()`
28
+
1. Import the bthome module.
29
+
2. Create a new instance of the BTHome class, passing in the device name you want.
30
+
3.Read the sensors and write their values to the BTHome properties you want to communicate.
31
+
4. Call the `pack_advertisement()` method with parameters to indicate what data to broadcast.
32
+
5. Send that advertising data to `aioble.advertise()`.
33
33
34
34
As MicroPython statements, those steps would be something like this:
0 commit comments