pub struct Client { /* private fields */ }Expand description
Client for discovering ESPHome devices using mDNS. This client allows you to discover devices on the local network that are running ESPHome and have the mDNS service enabled.
Requires the discovery feature to be enabled.
§Usage:
use esphome_client::discovery::Client;
#[tokio::main]
async fn main() {
let mut discovery_results = Client::default().discover().expect("Results");
while let Ok(device) = discovery_results.next().await {
println!("Discovered device: {device:?}");
}
}Implementations§
Source§impl Client
impl Client
Sourcepub fn with_interface_ip(self, addr: IpAddr) -> Self
pub fn with_interface_ip(self, addr: IpAddr) -> Self
Set the interface ip to discover devices on. If not set, it will use the all interfaces.
Sourcepub fn with_interface(self, interface: &str) -> Self
pub fn with_interface(self, interface: &str) -> Self
Set the interface name to discover devices on. If not set, it will use the all interfaces.
Sourcepub fn with_service_name(self, service_name: impl Into<String>) -> Self
pub fn with_service_name(self, service_name: impl Into<String>) -> Self
Set the service name to filter devices by.
If not set, it will default to _esphomelib._tcp.local.
Sourcepub const fn with_interval(self, interval: Duration) -> Self
pub const fn with_interval(self, interval: Duration) -> Self
Set custom ip check interval.
Defaults to the default interval of the mdns-sd crate.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more