add bluetooth proxy

This commit is contained in:
Aiden
2025-12-19 14:11:19 +08:00
parent 2aef41a350
commit 56527787da
2 changed files with 42 additions and 7 deletions
+40 -5
View File
@@ -6,11 +6,11 @@ substitutions:
# Allows ESP device to be automatically linked to an 'Area' in Home Assistant. Typically used for areas such as 'Lounge Room', 'Kitchen' etc
room: ""
# Description as appears in ESPHome & top of webserver page
device_description: "athom esp32-c3 smart plug"
device_description: "athom esp32-c3 power monitoring smart plug"
# Project Name
project_name: "Athom Technology.Smart Plug V3"
project_name: "China Athom Technology.Smart Plug V3"
# Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version
project_version: "v2.0.0"
project_version: "v2.0.1"
# Restore the relay (GPO switch) upon reboot to state:
relay_restore_mode: RESTORE_DEFAULT_ON
# Set the update interval for sensors
@@ -36,7 +36,7 @@ substitutions:
# Enable or disable the use of IPv6 networking on the device
ipv6_enable: "false"
# Power plug icon selection. Change to reflect the type/country of powr plug in use, this will update the power plug icon shown next to the switch
power_plug_type: "power-socket-us" # Options: power-socket-au | power-socket-ch | power-socket-de | power-socket-eu | power-socket-fr | power-socket-it | power-socket-jp | power-socket-uk | power-socket-us |
power_plug_type: "power-socket-eu" # Options: power-socket-au | power-socket-ch | power-socket-de | power-socket-eu | power-socket-fr | power-socket-it | power-socket-jp | power-socket-uk | power-socket-us |
########################## End of Substitutions #########################
@@ -85,18 +85,40 @@ esp32:
framework:
type: esp-idf
version: recommended
sdkconfig_options:
# @grigi found in testing that these options resulted in better responsiveness.
# BLE 4.2 is supported by ALL ESP32 boards that have bluetooth, the original and derivatives.
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
# Also enable this on any derivative boards (S2, C3 etc) but not the original ESP32.
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
# Extend the watchdog timeout, so the device reboots if the device appears locked up for over 10 seconds.
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
preferences:
flash_write_interval: 5min
api:
# reboot_timeout: 0s
# Only enable BLE tracking when wifi is up and api is connected
# Gives single-core ESP32-C3 devices time to manage wifi and authenticate with api
on_client_connected:
- esp32_ble_tracker.start_scan:
continuous: true
# Disable BLE tracking when there are no api connections live
on_client_disconnected:
if:
condition:
not:
api.connected:
then:
- esp32_ble_tracker.stop_scan:
ota:
- platform: esphome
logger:
baud_rate: 0 # 0 Enables logging, but disables serial-port logging to free CPU and memory
level: ${log_level}
baud_rate: 0
mdns:
disabled: false
@@ -121,6 +143,19 @@ captive_portal:
esp32_improv:
authorizer: none
esp32_ble_tracker:
scan_parameters:
# Don't auto start BLE scanning, we control it in the `api` block's automation.
continuous: false
active: true # send scan-request packets to gather more info, like device name for some devices.
interval: 320ms # default 320ms - how long to spend on each advert channel
window: 300ms # default 30ms - how long to actually "listen" in each interval. Reduce this if device is unstable.
# If the device cannot keep up or becomes unstable, reduce the "window" setting. This may be
# required if your device is controlling other sensors or doing PWM for lights etc.
bluetooth_proxy:
active: true
dashboard_import:
package_import_url: github://athom-tech/esp32-configs/athom-smart-plug.yaml
+2 -2
View File
@@ -10,7 +10,7 @@ substitutions:
# Project Name
project_name: "China Athom Technology.Athom Wall Outlet V3"
# Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version
project_version: "v3.0.0"
project_version: "v3.0.1"
# Restore the relay (GPO switch) upon reboot to state:
relay_restore_mode: RESTORE_DEFAULT_OFF
# Set the update interval for sensors
@@ -94,7 +94,7 @@ esp32:
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
preferences:
flash_write_interval: 1min
flash_write_interval: 5min
api:
# reboot_timeout: 0s