Features Wishlist

Bluetooth proxy plugin for P4 boards

Completed

HeronimonimoSuggested this wish Β·

Boards with ESP32P4 have enough memory to run bluetooth proxy. Does require a up to date firmware for the ESP32C6 co-hosted processor that handles WiFi and Bluetooth.

Already running bluetooth proxy using the override yaml on my P4 boards.

Discussion 8

Add a comment
MaxGramser Admin

Can you share the YAML?

Heronimonimo

Β· Edited

Using the code below. Two things need to be checked still:

  • by how much does adding bluetooth proxy degrade the wifi performance because they use the same modem together
  • are there any settings in the bluetooth components that can be optimized to reduce any performance impact it has
esp32_ble_tracker:
  scan_parameters:
    active: true

bluetooth_proxy:
  active: true

http_request:

update:
  - platform: esp32_hosted
    type: http
    source: https://esphome.github.io/esp-hosted-firmware/manifest/esp32c6.json
    update_interval: 6h
    name: esp32_cohost_update
Heronimonimo

My n=1 test showed quite a dramatic improvement in the video stream performance when disabling the bluetooth proxy. This should be further tested and added as warning if such a plugin is made.

MaxGramser Admin

Thanks for the YAML and for testing it on your boards, that made this quick. There is now a Bluetooth proxy plugin: in Tessera, open Plugins, choose Bluetooth proxy and tick your screen. If it does not show as fitting your P4 screens yet, the next app update brings what it needs.

What it does and how it differs from your override:

  • Every ESP32-P4 screen, nothing else. It goes by the hardware: a board with the ESP32-C6 beside the chip (the esp32_hosted block, which ESPHome itself looks for to run Bluetooth over the C6) can take it, so a new P4 board fits without anyone keeping a list. The ESP32-S3 screens with an RGB panel stay out, for the memory reasons in the earlier Bluetooth thread.
  • ESPHome's default scan (30 ms of every 320 ms, active) instead of 1100/1100 ms. The C6 does Wi-Fi and Bluetooth on one radio, and a window as long as the interval means it listens all the time, which takes the Wi-Fi the screen needs. The default is what ESPHome's own Wi-Fi proxies use.
  • A switch, Bluetooth proxy, in Home Assistant, in the plugin's settings in the app and on the screen (Settings, Plugins, Bluetooth). Off stops Bluetooth altogether without a build, so the radio is Wi-Fi's alone.
  • Your camera stream finding is in the README, right at the top, as a warning before adding it: pictures and camera streams can be slower while it runs, and for screens that show cameras or sit on weak Wi-Fi a separate ESP32 proxy is the better choice.
  • The C6 update stays a step the owner takes on purpose, through the Override YAML block from your pull request (with a name, so Install shows up in Home Assistant). The README walks through it.

Please remove your own esp32_ble_tracker: and bluetooth_proxy: blocks from the Override YAML first, or the build finds them twice. The C6 update block can stay.

It builds and passes its checks, but it has not run on a screen yet. If you try it, I would love to hear two things: whether the camera stream is still clearly better with the switch off than with the default scan on, and which C6 firmware version you are running.

MaxGramser Admin

First test on real hardware: a reTerminal D1001 (ESP32-P4 with an ESP32-C6), with the Bluetooth proxy added through the Tessera app like any plugin, next to the voice assistant and the screen camera plugins.

  • The app offered it on the D1001 only, and refused it on the CYD, the Guition 4-inch and the Waveshare 4.3-inch on the same bench, as intended.
  • It built and installed over Wi-Fi, and the screen runs as before: pages, Wi-Fi and the connection to Home Assistant are fine, with 423 KB of internal memory free.
  • But Bluetooth did not start, and ESPHome says why at boot: BT controller init failed; co-processor firmware 2.3.2 may lack BT support. Update it with the esp32_hosted update component; BLE disabled. Home Assistant lists the screen as a Bluetooth proxy, but its scanner stays off.

So you were right: the C6 firmware these boards ship with is too old for Bluetooth, and updating it is not optional. The good news is that a screen with the old firmware keeps working normally, Bluetooth just stays off. I'll make the README say this plainly, with the exact log line to look for.

Next step on my side is updating the C6 on this board with the Override YAML route from the README and testing again. I'll post what that shows.

MaxGramser Admin

Update: it works on the D1001 now.

  • C6 update: done with the Override YAML block from the README and Install in Home Assistant, from 2.3.2 to 2.12.12. Home Assistant now shows the co-processor firmware as up to date.
  • Bluetooth starts: the error at boot is gone, and Home Assistant lists the screen as a connectable proxy with three connection slots. It shows up under the Bluetooth address of the C6, not the Wi-Fi address of the screen, so don't be surprised by a second address.
  • It hears devices: 51 different Bluetooth devices within the first minute.
  • Memory is fine: about 395 KB of internal memory stays free with the proxy, the voice assistant and the screen camera all on.
  • The switch works: with Bluetooth proxy off, no advertisements came through in 30 seconds; on again, they came back within seconds. No build needed either way.

The README now says what an old C6 looks like (the exact log line, and that the screen keeps working with Bluetooth off), and that Home Assistant shows the proxy under the C6's address.

What I haven't measured yet is your camera stream observation, with the proxy on and off on the same screen. That's next, and I'll add it to the README with whatever it shows. If you try it on your boards in the meantime, numbers like yours are very welcome.

MaxGramser Admin

Version 0.2.0 of the Bluetooth proxy is out, and it makes the C6 step much easier:

  • Wi-Fi chip update is now part of the plugin, ticked by default. It adds the same ESPHome update to Home Assistant as the Override YAML block did, under the same name. It still never installs by itself: you press Install when you're ready.
  • Bluetooth status shows on the screen's device in Home Assistant and on the screen's own settings page (Settings, Plugins, Bluetooth). It says Listening, Off, Starting, or Update the Wi-Fi chip when the C6 is too old for Bluetooth, so nobody has to dig through logs to find out why it doesn't scan.

Built and checked for all ten ESP32-P4 boards. On the D1001 the app built 0.2.0 like any update, and the screen shows Listening, with the C6 update up to date at 2.12.12.

Since you already had 0.1.0: an update keeps the parts you had, so after updating, tick Wi-Fi chip update in the plugin's details on the screen's Plugins tab and choose Save and build. Remove the C6 block from your Override YAML first, or the build finds it twice. If Home Assistant then shows the update as unavailable, reload the screen under ESPHome in Devices & services. I saw that once on the bench, and a reload fixed it.

The camera stream comparison with the proxy on and off is still on my list.

Add your thoughts, a screenshot or a useful link.

Markdown & basic HTML
Paste or drop images Β· URLs on their own line become previews0 / 10,000
Create your account to join in

We need a verified email address to reach you about your contribution. Your address stays private.

Continue with GitHub

Your draft stays in this tab. Return here after verification.