Skip to content

Instantly share code, notes, and snippets.

@kabakaev
Last active September 11, 2025 12:15
Show Gist options
  • Select an option

  • Save kabakaev/759a3292112225db50b98e2254598793 to your computer and use it in GitHub Desktop.

Select an option

Save kabakaev/759a3292112225db50b98e2254598793 to your computer and use it in GitHub Desktop.
ESPHome BLE proxy on ESP32-C6 board
# # This is an esphome configuration file.
# # It is tested on debian-12 and [nanoESP32-C6](https://github.com/wuxx/nanoESP32-C6/blob/master/README_en.md).
# # This configuration should work on any Linux distribution and any ESP32-C6 board though.
#
# # Create and activate python venv, install esphome:
# test -d ./venv || python3 -m venv venv
# source ./venv/bin/activate
# pip install esphome --upgrade
#
# # Connect ESP32-C6 to USB, press and hold "Boot" button, press and release "Reset", release "Boot".
# # Run `sudo dmesg` to find the device name, usually ttyACM0 or ttyACM1.
# # In my case, the message was "cdc_acm 1-4.1.1:1.0: ttyACM1: USB ACM device".
# esphome run --device /dev/ttyACM1 esphome_ble_esp32c6.yaml
# esphome logs --device /dev/ttyACM1 esphome_ble_esp32c6.yaml
esphome:
name: esphome-ble-esp32c6
platformio_options:
upload_port: /dev/ttyACM1
framework: espidf
board_build.flash_mode: dio
platform_packages:
- platformio/toolchain-xtensa-esp-elf @ 14.2.0+20241119
esp32:
variant: esp32c6
board: esp32-c6-devkitc-1
framework:
type: esp-idf
version: 5.3.1 # https://github.com/espressif/esp-idf/releases/tag/v5.3.1
platform_version: 6.9.0 # https://github.com/platformio/platform-espressif32/releases/tag/v6.9.0
sdkconfig_options:
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT: y
COMPILER_OPTIMIZATION_SIZE: y
bluetooth_proxy:
active: true
network:
enable_ipv6: False
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret home_assistant_api_password
reboot_timeout: 300s
ota:
platform: esphome
password: !secret ota_password
wifi:
networks:
- ssid: !secret wifi1_ssid
password: !secret wifi1_password
- ssid: !secret wifi2_ssid
password: !secret wifi2_password
sensor:
- platform: uptime
type: seconds
name: Uptime Sensor
entity_category: diagnostic
- platform: internal_temperature
entity_category: diagnostic
name: "Internal Temperature"
time:
- platform: sntp
id: sntp_time
timezone: Europe/Berlin
servers:
- 0.pool.ntp.org
- 1.pool.ntp.org
wifi1_ssid: wifi-2ghz
wifi1_password: cannotRememberThePassword
wifi2_ssid: backup-wifi
wifi2_password: neitherOfThose
mqtt_host: 10.11.12.13
mqtt_username: esphome
mqtt_password: howAboutThat
api_password: dontEvenTryToGuess
ota_password: dontEvenTryToGuess
home_assistant_api_password: Y2hhbmdlbWV0b3NvbWV2ZXJ5bG9uZ3N0cmluZw==
web_server_auth_username: admin
web_server_auth_password: howCanPeopleRememberSoManyPasswords
latitude: 11.111111
longitude: 9.999999
@HeusiHeusi
Copy link

Same here! Any solution?

@kabakaev
Copy link
Author

kabakaev commented Apr 29, 2025

The API Token is not base64 encoded error means that the value of api.encryption.key in line 51 above is not a valid base64 encoding.

Most probably, you need to create a secrets.yaml file in the same folder, and define the values referenced with !secret prefix.

I've updated the gist. See the secrets.yaml example above.

Then, in Home-Assistant, when you add an esphome device, you'll be asked to enter the base64-encoded password Y2hhbmdlbWV0b3NvbWV2ZXJ5bG9uZ3N0cmluZw== or whatever you put there.

@k9rdu
Copy link

k9rdu commented May 22, 2025

This was a HUGE help. Thank you! Any possibility of getting wifi 6 (802.11ax) in there? Several of mt BT proxies are in fringe areas, which is why I bought the C6. I've been messing with lambda calls to esp_wifi_set_protocol for a couple of hours but I suck at coding and can't get it going. Thanks again!

@kabakaev
Copy link
Author

I tried to enable 802.11ax on esp32-c6, with both esphome and bare ESP-IDF, to only find that my Unifi U6 Lite does not support 11ax on 2.4GHz.
I'd suggest to check your access point specs first.
If yours have 11ac chip on 2.4GHz too, then it may worth playing with access point settings such as transmit power and channel number. Also, the narrow 20MHz channel width should give slightly longer range than 40MHz.

@k9rdu
Copy link

k9rdu commented May 22, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment