esphome-proto/src/lib.rs

28 lines
1.2 KiB
Rust

//! The Home Assistant protocol is structured as a simple
//! TCP socket with short binary messages encoded in the protocol buffers format.
//! First, a message in this protocol has a specific format:
//!
//! * A zero byte.
//! * VarInt denoting the size of the message object. (type is not part of this)
//! * VarInt denoting the type of message.
//! * The message object encoded as a ProtoBuf message
//!
//! The connection is established in 4 steps:
//!
//! * First, the client connects to the server and sends a [Hello Request](api::HelloRequest)
//! identifying itself
//! * The server responds with a [Hello Response](api::HelloResponse) and selects the
//! protocol version
//! * After receiving this message, the client attempts to authenticate itself using
//! the password and a [Connect Request](api::ConnectRequest)
//! * The server responds with a [Connect Response](api::ConnectResponse) and notifies
//! of invalid password if necessary.
//!
//! If anything in this initial process fails, the connection must immediately closed
//! by both sides and _no_ disconnection message is to be sent.
mod generated;
pub use protobuf;
pub use generated::api;
pub use generated::api_options;