mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 06:33:51 +00:00
Merge upstream/dev into integration
This commit is contained in:
@@ -3,6 +3,7 @@ import base64
|
||||
from esphome import automation
|
||||
from esphome.automation import Condition
|
||||
import esphome.codegen as cg
|
||||
from esphome.config_helpers import get_logger_level
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ACTION,
|
||||
@@ -23,7 +24,7 @@ from esphome.const import (
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_VARIABLES,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.core import coroutine_with_priority
|
||||
|
||||
DEPENDENCIES = ["network"]
|
||||
AUTO_LOAD = ["socket"]
|
||||
@@ -320,7 +321,10 @@ def FILTER_SOURCE_FILES() -> list[str]:
|
||||
# api_pb2_dump.cpp is only needed when HAS_PROTO_MESSAGE_DUMP is defined
|
||||
# This is a particularly large file that still needs to be opened and read
|
||||
# all the way to the end even when ifdef'd out
|
||||
if "HAS_PROTO_MESSAGE_DUMP" not in CORE.defines:
|
||||
#
|
||||
# HAS_PROTO_MESSAGE_DUMP is defined when ESPHOME_LOG_HAS_VERY_VERBOSE is set,
|
||||
# which happens when the logger level is VERY_VERBOSE
|
||||
if get_logger_level() != "VERY_VERBOSE":
|
||||
return ["api_pb2_dump.cpp"]
|
||||
|
||||
return []
|
||||
|
||||
@@ -303,7 +303,7 @@ class APIConnection : public APIServerConnection {
|
||||
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
// Helper to check voice assistant validity and connection ownership
|
||||
bool check_voice_assistant_api_connection_() const;
|
||||
inline bool check_voice_assistant_api_connection_() const;
|
||||
#endif
|
||||
|
||||
// Helper method to process multiple entities from an iterator in a batch
|
||||
|
||||
@@ -59,10 +59,12 @@ bool BluetoothProxy::parse_device(const esp32_ble_tracker::ESPBTDevice &device)
|
||||
// This achieves ~97% WiFi MTU utilization while staying under the limit
|
||||
static constexpr size_t FLUSH_BATCH_SIZE = 16;
|
||||
|
||||
// Global batch buffer to avoid guard variable (saves 8 bytes)
|
||||
namespace {
|
||||
// Batch buffer in anonymous namespace to avoid guard variable (saves 8 bytes)
|
||||
// This is initialized at program startup before any threads
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
static std::vector<api::BluetoothLERawAdvertisement> batch_buffer;
|
||||
std::vector<api::BluetoothLERawAdvertisement> batch_buffer;
|
||||
} // namespace
|
||||
|
||||
static std::vector<api::BluetoothLERawAdvertisement> &get_batch_buffer() { return batch_buffer; }
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ from collections.abc import Callable
|
||||
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_LEVEL,
|
||||
CONF_LOGGER,
|
||||
KEY_CORE,
|
||||
KEY_TARGET_FRAMEWORK,
|
||||
KEY_TARGET_PLATFORM,
|
||||
@@ -157,3 +159,20 @@ def filter_source_files_from_platform(
|
||||
]
|
||||
|
||||
return filter_source_files
|
||||
|
||||
|
||||
def get_logger_level() -> str:
|
||||
"""Get the configured logger level.
|
||||
|
||||
This is used by components to determine what logging features to include
|
||||
based on the configured log level.
|
||||
|
||||
Returns:
|
||||
The configured logger level string, defaults to "DEBUG" if not configured
|
||||
"""
|
||||
# Check if logger config exists
|
||||
if CONF_LOGGER not in CORE.config:
|
||||
return "DEBUG"
|
||||
|
||||
logger_config = CORE.config[CONF_LOGGER]
|
||||
return logger_config.get(CONF_LEVEL, "DEBUG")
|
||||
|
||||
Reference in New Issue
Block a user