#client #api-client #connection

esphome

ESPHome API客户端,用于Rust

1个不稳定版本

0.1.0 2021年8月22日

#229 in #connection

MIT授权

655KB
15K SLoC

ESPHome.rs

ESPHome API客户端,用于Rust。

用法

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)?;
	// ...
}

运行示例

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

授权

MIT授权,但以下内容除外

依赖项

~3.5MB
~78K SLoC