From 782d894801c5740ccac3377bb4dcbe5cebef083e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 6 Jul 2025 14:18:05 -0500 Subject: [PATCH] preen --- esphome/components/api/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/esphome/components/api/__init__.py b/esphome/components/api/__init__.py index 2f1be28293..745a1bc58c 100644 --- a/esphome/components/api/__init__.py +++ b/esphome/components/api/__init__.py @@ -23,7 +23,7 @@ from esphome.const import ( CONF_TRIGGER_ID, CONF_VARIABLES, ) -from esphome.core import coroutine_with_priority +from esphome.core import CORE, coroutine_with_priority DEPENDENCIES = ["network"] AUTO_LOAD = ["socket"] @@ -313,3 +313,13 @@ async def homeassistant_tag_scanned_to_code(config, action_id, template_arg, arg @automation.register_condition("api.connected", APIConnectedCondition, {}) async def api_connected_to_code(config, condition_id, template_arg, args): return cg.new_Pvariable(condition_id, template_arg) + + +def FILTER_SOURCE_FILES() -> list[str]: + """Filter out api_pb2_dump.cpp when proto message dumping is not enabled.""" + # api_pb2_dump.cpp is only needed when HAS_PROTO_MESSAGE_DUMP is defined + # Check if HAS_PROTO_MESSAGE_DUMP is defined + if "HAS_PROTO_MESSAGE_DUMP" not in CORE.defines: + return ["api_pb2_dump.cpp"] + + return []