vesync-rs

This crate lets you access and control your VeSync smart outlets including, for example, Etekcity smart plugs. You must have a VeSync account (which requires you install their iOS or Android app) in order to use this crate.

toml [depenencies] vesync = "0.1"

```rust use vesync_rs::{VeSyncAccount, VeSyncdevice, DeviceStatus};

const VESYNCACCOUNT: &str = "me@example.com"; const VESYNCKEY: &str = "my-secret-password";

fn main() -> Result<(), ()> { let account = VeSyncAccount::login(VESYNCACCOUNT, VESYNCKEY)?; let devices = account.devices()?;

let outside_light = devices
    .iter()
    .find(|device| device.cid == "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
    .unwrap();

// Toggle the state of the device
outside_light.device_toggle()?;

match outside_light.deviceStatus {
    DeviceStatus::On => println!("Outside light is on"),
    DeviceStatus::Off => println!("Outside light is off"),
    DeviceStatus::Unknown => println!("🤷‍♂️"), // toggle will update state, so this *should* be unreachable
};

Ok(())

} ```

TODO

Changelog

rust let account = VeSyncAccount { accountID: "1234".to_string(), tk: "ABCXYZ==".to_string() };

rust let mut inside_light = VeSyncDevice::from_id(&account, "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); inside_light.update();