Versions in this module Expand all Collapse all v1 v1.4.0 Jul 18, 2026 v1.3.0 Jan 6, 2023 Changes in this version + var ErrHandshakeFailed = errors.New("esphome_api: handshake failed") + var ErrHandshakeNotDone = errors.New("esphome_api: handshake not done") + var ErrInvalidEncryptionPreamble = errors.New("esphome_api: invalid preamble. encrypted message should starts with 0x01") + type ApiConnection interface + Handshake func() error + Read func(reader *bufio.Reader) (proto.Message, error) + Write func(message proto.Message) error + func GetConnection(conn net.Conn, communicationTimeout time.Duration, encryptionKey string) (ApiConnection, error) + func NewEncryptedConnection(conn net.Conn, communicationTimeout time.Duration, encryptionKey string) (ApiConnection, error) + func NewPlaintextConnection(conn net.Conn, communicationTimeout time.Duration) (ApiConnection, error) + type EncryptedConnection struct + CommunicationTimeout time.Duration + func (ec *EncryptedConnection) Handshake() error + func (ec *EncryptedConnection) Read(reader *bufio.Reader) (proto.Message, error) + func (ec *EncryptedConnection) Write(message proto.Message) error + type PlaintextConnection struct + CommunicationTimeout time.Duration + func (ptc *PlaintextConnection) Handshake() error + func (ptc *PlaintextConnection) Read(reader *bufio.Reader) (proto.Message, error) + func (ptc *PlaintextConnection) Write(message proto.Message) error