EspHomeClientBuilder

Struct EspHomeClientBuilder 

Source
pub struct EspHomeClientBuilder { /* private fields */ }

Implementations§

Source§

impl EspHomeClientBuilder

Source

pub fn address(self, addr: &str) -> Self

Sets the host address of the ESPHome API server to connect to.

Takes the address of the server in the format “host:port”.

Source

pub fn key(self, key: &str) -> Self

Enables the use of a 32-byte base64-encoded key for encrypted communication.

If no key is provided, the connection will be established in plain text. Further reference: https://esphome.io/components/api.html#configuration-variables

Source

pub fn password(self, password: &str) -> Self

Enables the use of a password to authenticate the client.

Note that this password is deprecated and will be removed in a future version of ESPHome. This only works if connection setup is enabled.

Source

pub const fn timeout(self, timeout: Duration) -> Self

Sets the timeout duration during the tcp connection.

Source

pub fn client_info(self, client_info: &str) -> Self

Sets the client info string that will be sent in the HelloRequest.

Defaults to the package name and version of the client. This only works if connection setup is enabled.

Source

pub const fn without_connection_setup(self) -> Self

Disable connection setup messages.

Most api requests require a connection setup, which requires a sequence of messages to be sent and received.

  • HelloRequest -> HelloResponse
  • ConnectionRequest -> ConnectionResponse

By disabling this, the connection can be established manually.

Source

pub const fn without_ping_handling(self) -> Self

Disable automatic handling of ping request.

The ESPHome API server will send a ping request to the client on a regular interval. The client needs to respond with a PingResponse to keep the connection alive.

Source

pub async fn connect(self) -> Result<EspHomeClient, ClientError>

Connect to the ESPHome API server.

§Errors

Will return an error if the connection fails, or if the connection setup fails.

Trait Implementations§

Source§

impl Debug for EspHomeClientBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more