1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 23:22:21 +01:00

[api] Add conditional compilation for Home Assistant state subscriptions (#9898)

This commit is contained in:
J. Nick Koston
2025-07-25 20:28:44 -10:00
committed by GitHub
parent da491f7090
commit a9d6ece752
14 changed files with 50 additions and 0 deletions

View File

@@ -83,6 +83,7 @@ class CustomAPIDevice {
}
#endif
#ifdef USE_API_HOMEASSISTANT_STATES
/** Subscribe to the state (or attribute state) of an entity from Home Assistant.
*
* Usage:
@@ -134,6 +135,7 @@ class CustomAPIDevice {
auto f = std::bind(callback, (T *) this, entity_id, std::placeholders::_1);
global_api_server->subscribe_home_assistant_state(entity_id, optional<std::string>(attribute), f);
}
#endif
/** Call a Home Assistant service from ESPHome.
*