1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! # TP-Link Smart Device Client Library
//!
//! A pure Rust library for communicating with TP-Link smart devices including
//! smart plugs, smart lights, smart dimmers, and power strips.
//!
//! ## Features
//!
//! - Device discovery via UDP broadcast
//! - Control smart plugs (on/off, alias, reboot)
//! - Control smart lights (on/off, brightness, color)
//! - Control smart dimmers (brightness, inactivity timeout)
//! - Control power strips (individual socket control, energy monitoring)
//! - Async/await support with Tokio
//! - Proper error handling
//!
//! ## Examples
//!
//! ### Discover devices on the network
//!
//! ```rust,no_run
//! use tplink::{discover_devices, DeviceData};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let devices = discover_devices().await?;
//!
//! for device in devices {
//! match device {
//! DeviceData::SmartPlug(plug) => {
//! println!("Found smart plug: {}", plug.alias);
//! }
//! DeviceData::SmartLight(light) => {
//! println!("Found smart light: {}", light.alias);
//! }
//! _ => {}
//! }
//! }
//! Ok(())
//! }
//! ```
//!
//! ### Control a smart plug
//!
//! ```rust,no_run
//! use tplink::TpLinkClient;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = TpLinkClient::new();
//!
//! // Turn on the plug
//! client.turn_plug_on("192.168.1.100").await?;
//!
//! // Set brightness if it's a dimmer
//! client.set_dimmer_brightness("192.168.1.101", 75).await?;
//!
//! Ok(())
//! }
//! ```
// Re-export the most commonly used items
// Re-export device operations for convenience
pub use ;
pub use ;