67 lines
2.1 KiB
Markdown
67 lines
2.1 KiB
Markdown

|
|

|
|
|
|
This application turns the Flipper Zero into a [BTHome](https://bthome.io)
|
|
beacon, and can be used to integrate the Flipper with home automation systems
|
|
that support BTHome, such as Home Assistant.
|
|
|
|
[BTHome](https://bthome.io) is an open standard for broadcasting sensor data
|
|
over Bluetooth Low Energy (BLE). It allows devices to transmit sensor readings
|
|
(temperature, humidity, battery level, button events, etc.) without requiring
|
|
pairing or an active connection.
|
|
|
|
Pressing any direction on the Flipper Zero D-pad (Up, Down, Left, Right, OK)
|
|
sends a BTHome button event. Each direction maps to a separate BTHome button
|
|
object, so Home Assistant sees them as `button`, `button_2`, `button_3`,
|
|
`button_4`, and `button_5` (OK, Up, Down, Left, Right respectively). Short and
|
|
long presses are both supported. The Flipper's battery percentage is also
|
|
included in each beacon.
|
|
|
|
### Building
|
|
|
|
Install [ufbt](https://github.com/flipperdevices/ufbt) into a virtual
|
|
environment:
|
|
|
|
```bash
|
|
python3 -m venv .venv
|
|
.venv/bin/pip install ufbt
|
|
```
|
|
|
|
Then build from the project root:
|
|
|
|
```bash
|
|
.venv/bin/ufbt
|
|
```
|
|
|
|
The first run downloads the Flipper SDK and compiler toolchain automatically.
|
|
The finished app is written to:
|
|
|
|
```
|
|
dist/bt_home_controller.fap
|
|
```
|
|
|
|
### Installing on the Flipper
|
|
|
|
Open [qFlipper](https://flipperzero.one/update), connect your Flipper via USB,
|
|
and use the file manager to copy `dist/bt_home_controller.fap` to:
|
|
|
|
```
|
|
SD:/apps/Bluetooth/
|
|
```
|
|
|
|
The app will then appear in **Apps → Bluetooth → BT Home Controller** on the
|
|
Flipper.
|
|
|
|
### Home Assistant setup
|
|
|
|
The first step is setting up the [BTHome](https://www.home-assistant.io/integrations/bthome/) integration in Home Assistant.
|
|
|
|
Once setup, the Flipper should be automatically discovered after pressing any
|
|
D-pad button once:
|
|
|
|

|
|
|
|
The device's page will then show the current battery status and its events:
|
|
|
|

|