1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-15 09:42:19 +01:00

[api] Add new flag to request state/attribute once from HA only (#7258)

This commit is contained in:
Jesse Hills
2024-08-13 17:12:06 +12:00
committed by GitHub
parent ab51bbd8f7
commit 2b25daa199
5 changed files with 31 additions and 0 deletions

View File

@@ -112,10 +112,13 @@ class APIServer : public Component, public Controller {
std::string entity_id;
optional<std::string> attribute;
std::function<void(std::string)> callback;
bool once;
};
void subscribe_home_assistant_state(std::string entity_id, optional<std::string> attribute,
std::function<void(std::string)> f);
void get_home_assistant_state(std::string entity_id, optional<std::string> attribute,
std::function<void(std::string)> f);
const std::vector<HomeAssistantStateSubscription> &get_state_subs() const;
const std::vector<UserServiceDescriptor *> &get_user_services() const { return this->user_services_; }