From a3eeb46961a642d42f40950d95a75d4041f92a22 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 28 Jun 2025 23:01:48 -0500 Subject: [PATCH] reduce --- esphome/components/api/entity_iterator_macros.h | 6 ++++++ esphome/components/api/list_entities.cpp | 2 +- esphome/components/api/subscribe_state.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/entity_iterator_macros.h b/esphome/components/api/entity_iterator_macros.h index a3dac32e09..5bb5069a99 100644 --- a/esphome/components/api/entity_iterator_macros.h +++ b/esphome/components/api/entity_iterator_macros.h @@ -3,6 +3,9 @@ #include "esphome/core/defines.h" #ifdef USE_API +namespace esphome { +namespace api { + // Macro-based approach to eliminate duplication without runtime overhead // This generates the entity handler methods at compile time @@ -24,4 +27,7 @@ LIST_ENTITIES_HANDLER(entity_type, EntityClass, ResponseType) \ INITIAL_STATE_HANDLER(entity_type, EntityClass) +} // namespace api +} // namespace esphome + #endif // USE_API \ No newline at end of file diff --git a/esphome/components/api/list_entities.cpp b/esphome/components/api/list_entities.cpp index a9ce3524a4..d88d552691 100644 --- a/esphome/components/api/list_entities.cpp +++ b/esphome/components/api/list_entities.cpp @@ -91,4 +91,4 @@ bool ListEntitiesIterator::on_service(UserServiceDescriptor *service) { } // namespace api } // namespace esphome -#endif \ No newline at end of file +#endif diff --git a/esphome/components/api/subscribe_state.cpp b/esphome/components/api/subscribe_state.cpp index 3dbe0eb811..4516b551a1 100644 --- a/esphome/components/api/subscribe_state.cpp +++ b/esphome/components/api/subscribe_state.cpp @@ -72,4 +72,4 @@ InitialStateIterator::InitialStateIterator(APIConnection *client) : client_(clie } // namespace api } // namespace esphome -#endif \ No newline at end of file +#endif