You can create a Bluetooth proxy (a DIY Bluetooth gateway) which can read data from sensors around the home. All you need is an ESP32 development board which will use wifi and Bluetooth to send information to Home Assistant. I DON’T use the web-based ‘ready-made BT proxy project’ at ESPHOME. I use the method below to ensure that I can see, and edit the device in the esphome dashboard as well as in Home Assistant.
Presently I get data from my SVARA ventilation fans, Xiaomi room temperature sensors and Xiaomi Nightlights. The temperature sensors give me day by day history graphs – while the Nightlights detect motion which I use to turn on a corridor light. The Bluetooth proxy reacts to my Switchbot water leak sensors. At a some point I will get Home Assistant listening out for the presence of my phone.
Not every xiaomi device works with Home Assistant – these do however (product code in brackets)
what you need to set up a Bluetooth proxy
A Bluetooth proxy requires almost any of the ESP32 development boards you can find at maker shops or Amazon. You need an ESP32-based board not an ESP8266 board – some shop listings aim to confuse on this point. I rather like the M5Stack Atom Lite board because it looks cool and discrete.
You’ll also need a simple USB power supply, plus a mains socket fairly close to the centre of your house. One of these is sufficient if your devices are as close as one (even two) walls away. You can set up a couple of these should you need to ‘listen’ out for Bluetooth devices, such as phones around the home. In theory the Raspberry Pi running Home Assistant is very capable of picking up the data – however for some reasons we don’t want this BT running on the Pi – so we set up separate Bluetooth sniffing devices like this.
go to Home Assistant ESPHome
Click add device. The idea is to create a place in the ESPHome dashboard, upload some basic code and lastly upload the BT proxy code below.
Go through this initialisation process – it will put your device in the ESPHome dashboard. It will make the device update-able over wifi (OTA update).
replace the code in the ESPHome dashboard with this code
use the suggested encryption key; change the wifi SSID and password; DO use esp-idf framework as below – do NOT use arduino framework; do add mdns: as shown. When you’ve made the edits, compile the code and install it ‘wirelessly’ or ‘ota’.
When your BT proxy has been running a while it may discover devices on your network. Home Assistant should discover the BT proxy as a new device. If nothing seems to be happening leave it a while or reboot or move the M5stack BT proxy to another location before searching for help. I don’t have wifi problems with the M5 Stack nor can I find fault. When I had problems it was because I used the code for the wrong ESP32 board.
packages: moved: github://esphome/bluetooth-proxies/m5stack/m5stack-atom-lite.yaml@main # edit for your chip
# THIS IS FOR the M5 STACK Atom Lite. IF YOU USE a ESP32 chip # DO SEE THE CODE at github/esphome/bluetooth-proxies
esp32: board: m5stack-atom #edit for your chip framework: type: esp-idf
logger:
mdns: disabled: false
captive_portal: improv_serial:
dashboard_import: package_import_url: github://esphome/bluetooth-proxies/m5stack-atom-lite.yaml@main # EDIT FOR YOUR CHIP
esp32_ble_tracker: scan_parameters: # We currently use the defaults to ensure Bluetooth # can co-exist with WiFi In the future we may be able to # enable the built-in coexistence logic in ESP-IDF
rogerfrost.com is a compendium of ideas for using technology with sciencey questions in mind. Started in 1995 to offer ideas to school science teachers, its coverage now extends to gadgets, home automation, home living and sensors to help understand what’s going on around the house.
It’s fully indexed so you can use keywords and the search box above to find content.
Please enjoy and share this spam and advert free content. To say hi – hit the ‘leave a reply’ button on this page – the message goes only to me in Cambridge, UK.
Roger Frost (his cv) has been writing about technology since 1988 and this web includes his articles; tutorials, lesson outlines and radio interviews.