document state

This commit is contained in:
J. Nick Koston
2025-12-22 16:57:31 -10:00
parent 748a6d79a3
commit 9542882464

View File

@@ -107,7 +107,9 @@ struct UrlMatch {
return method && method_len == strlen(str) && memcmp(method, str, method_len) == 0;
}
/// Check if method is empty or "state" (for sub-device GET requests)
/// Check if method is empty or "state" (for backward compatibility with old frontends)
/// Old frontends send /{domain}/{entity}/state for GET requests, so "state" is treated as no action.
/// This is safe because no ESPHome entity type has a "state" action - actions are like "turn_on", "toggle", etc.
bool method_empty() const { return method_len == 0 || this->method_equals("state"); }
};