https://github.com/pixelspark/esphome-rs
ESPHome API client for Rust
https://github.com/pixelspark/esphome-rs
Last synced: about 1 year ago
JSON representation
ESPHome API client for Rust
- Host: GitHub
- URL: https://github.com/pixelspark/esphome-rs
- Owner: pixelspark
- License: mit
- Created: 2021-08-22T12:06:05.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T09:02:02.000Z (over 3 years ago)
- Last Synced: 2025-04-23T00:05:40.707Z (about 1 year ago)
- Language: Rust
- Size: 162 KB
- Stars: 9
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ESPHome.rs
ESPHome API client for Rust.
## Usage
````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)?;
// ...
}
````
## Running an example
````sh
cargo run --example connect -- -a some.device:6053 -p some_password
````
## License
[MIT](./LICENSE.txt) except for the following:
* [src/api.proto](./src/api.proto) and [src/api_options.proto](./src/api_options.proto): copied from
[the aioesphomeapi repository](https://github.com/esphome/aioesphomeapi/tree/main/aioesphomeapi) under the MIT license.