This commit is contained in:
J. Nick Koston 2025-06-28 23:06:09 -05:00
parent 3e66c28aff
commit f5ae5cade8
No known key found for this signature in database
4 changed files with 15 additions and 2 deletions

View File

@ -2,7 +2,6 @@
#ifdef USE_API
#include "api_connection.h"
#include "api_pb2.h"
#include "entity_iterator_macros.h"
#include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/util.h"

View File

@ -9,6 +9,14 @@ namespace api {
class APIConnection;
// Macro for generating ListEntitiesIterator handlers
// Calls schedule_message_ with try_send_*_info
#define LIST_ENTITIES_HANDLER(entity_type, EntityClass, ResponseType) \
bool ListEntitiesIterator::on_##entity_type(EntityClass *entity) { \
return this->client_->schedule_message_(entity, &APIConnection::try_send_##entity_type##_info, \
ResponseType::MESSAGE_TYPE); \
}
class ListEntitiesIterator : public ComponentIterator {
public:
ListEntitiesIterator(APIConnection *client);

View File

@ -1,7 +1,6 @@
#include "subscribe_state.h"
#ifdef USE_API
#include "api_connection.h"
#include "entity_iterator_macros.h"
#include "esphome/core/log.h"
namespace esphome {

View File

@ -10,6 +10,13 @@ namespace api {
class APIConnection;
// Macro for generating InitialStateIterator handlers
// Calls send_*_state
#define INITIAL_STATE_HANDLER(entity_type, EntityClass) \
bool InitialStateIterator::on_##entity_type(EntityClass *entity) { \
return this->client_->send_##entity_type##_state(entity); \
}
class InitialStateIterator : public ComponentIterator {
public:
InitialStateIterator(APIConnection *client);