From 4533b8f92c4b363c23d282ca61415913abaa30af Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 19 Nov 2025 23:20:24 -0600 Subject: [PATCH] tweaks --- esphome/components/api/api_connection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index f6eab5db9a..6d0a480ff4 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1537,8 +1537,8 @@ void APIConnection::on_home_assistant_state_response(const HomeAssistantStateRes for (auto &it : this->parent_->get_state_subs()) { // Compare entity_id and attribute with message fields bool entity_match = (strcmp(it.entity_id_, msg.entity_id.c_str()) == 0); - bool attribute_match = - it.has_attribute_ ? (strcmp(it.attribute_, msg.attribute.c_str()) == 0) : msg.attribute.empty(); + bool attribute_match = (it.has_attribute_ && strcmp(it.attribute_, msg.attribute.c_str()) == 0) || + (!it.has_attribute_ && msg.attribute.empty()); if (entity_match && attribute_match) { it.callback_(msg.state);