Introducing "Add-on: Bluetooth Proxy"

Supports:
- #1983
- #1946
- #1815
This commit is contained in:
Edward Firmo
2024-04-18 18:34:49 +02:00
parent c9be4d2422
commit 544b2bc9cf
21 changed files with 198 additions and 113 deletions

View File

@@ -0,0 +1,43 @@
#####################################################################################################
##### NSPANEL ESPHOME created by Blackymas - https://github.com/Blackymas/NSPanel_HA_Blueprint #####
##### ESPHome Add-on for Bluetooth proxy #####
##### PLEASE only make changes if it is necessary and also the required knowledge is available. #####
##### For normal use with the Blueprint, no changes are necessary. #####
#####################################################################################################
##### ATTENTION: This will add climate elements to the core system and requires the core part. #####
#####################################################################################################
---
bluetooth_proxy:
id: ble_proxy
# Enable Bluetooth tracker
esp32_ble_tracker:
id: ble_tracker
esphome:
platformio_options:
build_flags:
- -D NSPANEL_HA_BLUEPRINT_ADDON_BLUETOOTH_PROXY
script:
- id: !extend dump_config
then:
- lambda: |-
// Check if this is installed with Arduino
#ifdef USE_ARDUINO
#error "Invalid settings for add-on Bluetooth Proxy. Arduino framework is not supported when using Bluetooth in this project."
#endif
if (!id(is_uploading_tft)) {
static const char *const TAG = "nspanel_ha_blueprint";
ESP_LOGCONFIG(TAG, "Add-on Bluetooth Proxy:");
ESP_LOGCONFIG(TAG, " Mode: %s", ble_proxy->has_active() ? "Active" : "Passive");
ESP_LOGCONFIG(TAG, " Connections: %i", int(ble_proxy->get_bluetooth_connections_limit() -
ble_proxy->get_bluetooth_connections_free()));
ESP_LOGCONFIG(TAG, " Limit: %i", int(ble_proxy->get_bluetooth_connections_limit()));
}
# Set Wi-Fi power save mode to "LIGHT" as required for Bluetooth on ESP32
wifi:
power_save_mode: LIGHT
...