3 releases
0.1.2 | Feb 5, 2023 |
---|---|
0.1.1 | Jan 21, 2023 |
0.1.0 | Jan 21, 2023 |
#4 in #tp-link
Used in kasa_exporter
5KB
TP Link home protocol for rust
Simple library to easily communicate with a tp link smart device.
Made possible by this article.
Usage
use std::io;
use std::net::TcpStream;
use tplink_shome_protocol::{receive_message, send_message};
fn main() -> io::Result<()> {
let stream = TcpStream::connect("192.168.1.1:9999")?;
let raw = r#"{"system":{"get_sysinfo":{}}}"#;
send_message(&stream, raw)?;
let message = receive_message(&stream)?;
...
}
lib.rs
:
Simple library to easily communicate with a tp link smart device.
Usage
use std::io;
use std::net::TcpStream;
use tplink_shome_protocol::{receive_message, send_message};
fn main() -> io::Result<()> {
let stream = TcpStream::connect("192.168.1.1:9999")?;
let raw = r#"{"system":{"get_sysinfo":{}}}"#;
send_message(&stream, raw)?;
let message = receive_message(&stream)?;
...
}