Skip to content
utsavozaPublic

About

Library to control TP-Link smart home devices

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Latest commit

 

History

55 Commits

Folders and files

Repository files navigation

tplink-rs

CI

A simple library to control TP-Link Smart Home devices.

Examples

Discover

Discover existing TP-Link devices on your network.

use tplink::DeviceKind;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let devices = tplink::discover()?;

    for (ip, device) in devices {
        match device {
            DeviceKind::Plug(mut plug) => {
                plug.turn_off()?;
                assert_eq!(plug.is_on()?, false);
            }
            DeviceKind::Bulb(mut bulb) => {
                bulb.set_brightness(50)?;
                assert_eq!(bulb.brightness()?, 50);
            }
            _ => eprintln!("unrecognised device found on the network: {}", ip),
        }
    }

    Ok(())
}

More examples can be found here.

Supported Devices

Device Model
Plug HS100
Bulb LB100, LB110

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Library to control TP-Link smart home devices

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages