IamTheCarl / esphome-rs

ESPHome API client for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESPHome.rs

ESPHome API client for Rust.

Usage

use esphome::Connection;
use std::net::TcpStream;

let mut stream = TcpStream::connect(opt.address)?;
let mut write_stream = stream.try_clone()?;
let connection = Connection::new(&mut stream, &mut write_stream);
let device = connection.connect()?;
println!("Connected to {}", device.server_info());

if let Some(password) = opt.password {
	let ad = device.authenticate(&password)?;
	// ...
}

Running an example

cargo run --example connect -- -a some.device:6053 -p some_password

License

MIT except for the following:

About

ESPHome API client for Rust

License:MIT License


Languages

Language:Rust 100.0%