1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-07 04:13:47 +01:00

Merge branch 'reduce_duplicate_gen_code_api' into integration

This commit is contained in:
J. Nick Koston
2025-06-16 06:06:19 -05:00
3 changed files with 21 additions and 39 deletions

View File

@@ -379,6 +379,26 @@ class ProtoService {
// Send the buffer
return this->send_buffer(buffer, message_type);
}
// Authentication helper methods
bool check_connection_setup_() {
if (!this->is_connection_setup()) {
this->on_no_setup_connection();
return false;
}
return true;
}
bool check_authenticated_() {
if (!this->check_connection_setup_()) {
return false;
}
if (!this->is_authenticated()) {
this->on_unauthenticated_access();
return false;
}
return true;
}
};
} // namespace api