1个不稳定版本
0.1.0 | 2021年8月22日 |
---|
#229 in #connection
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授权,但以下内容除外
- src/api.proto和src/api_options.proto:从aioesphomeapi仓库中复制,授权为MIT。
依赖项
~3.5MB
~78K SLoC