Module tplinker::discovery[][src]

Expand description

Discover devices on the local network

use tplinker::{
  discovery::discover,
  devices::Device,
  capabilities::Switch,
};

for (addr, data) in discover().unwrap() {
  let device = Device::from_data(addr, &data);
  let sysinfo = data.sysinfo();
  println!("{}\t{}\t{}", addr, sysinfo.alias, sysinfo.hw_type);
  match device {
    Device::HS110(device) => { device.switch_on().unwrap(); },
    _ => {},
  }
}

Functions

Discover TPLink smart devices on the local network

Discover TPLink smart devices on the local network