use rustuya::sync::Device;
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let device_id = "device_id";
let local_key = "device_key";
let device = Device::new(device_id, local_key);
println!("--- Rustuya Basic Control Example ---");
println!("Target Device: {}", device_id);
println!("Step 1: Switching ON (using set_value)...");
device.set_value(1, json!(true))?;
std::thread::sleep(std::time::Duration::from_secs(1));
println!("Step 2: Switching OFF (using set_dps)...");
device.set_dps(json!({"1": false}))?;
println!("Done!");
Ok(())
}