HS300

Struct HS300 

Source
pub struct HS300<T: Protocol> { /* private fields */ }
Expand description

A HS300 smart power strip with energy monitoring

When directly creating a device using the from_* methods below, you must make sure that the address you pass is indeed that of a HS300, as there is no further checking.

Implementations§

Source§

impl HS300<DefaultProtocol>

Source

pub fn new(addr: &str) -> Result<Self, AddrParseError>

Make a HS300 device from an address string

Source

pub fn from_addr(addr: SocketAddr) -> Self

Make a HS300 device from an address struct

Source§

impl<T: Protocol> HS300<T>

Source

pub fn from_raw(raw: RawDevice<T>) -> Self

Make a HS300 device from an already constructed raw device

Trait Implementations§

Source§

impl<T: Clone + Protocol> Clone for HS300<T>

Source§

fn clone(&self) -> HS300<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Protocol> Debug for HS300<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Protocol> DeviceActions for HS300<T>

Source§

fn send<D: DeserializeOwned>(&self, msg: &str) -> Result<D>

Send a message to a device and return its parsed response Read more
Source§

fn sysinfo(&self) -> Result<SysInfo>

Get system information
Source§

fn alias(&self) -> Result<String>

Get the alias of the device Read more
Source§

fn set_alias(&self, alias: &str) -> Result<()>

Set the alias of the device Read more
Source§

fn location(&self) -> Result<(f64, f64)>

Get the latitude and longitude coordinates
Source§

fn reboot(&self) -> Result<()>

Reboot the device in 1 second
Source§

fn reboot_with_delay(&self, delay: Duration) -> Result<()>

Reboot the device with a specified delay
Source§

impl<T: Protocol> Emeter for HS300<T>

Source§

fn emeter_type(&self) -> String

Type of the emeter Read more
Source§

fn get_emeter_realtime(&self) -> Result<Value>

Get the realtime energy usage
Source§

fn get_emeter_daily(&self, year: u16, month: u8) -> Result<Value>

Get the daily energy usage for a given month
Source§

fn get_emeter_monthly(&self, year: u16) -> Result<Value>

Get the monthly energy usage for a given year
Source§

impl<T: Protocol> MultiSwitch for HS300<T>

Source§

fn is_on(&self, index: usize) -> Result<bool>

Check whether the specified outlet is on
Source§

fn is_off(&self, index: usize) -> Result<bool>

Check whether the specified outlet is off
Source§

fn switch_on(&self, index: usize) -> Result<()>

Switch the specified outlet on
Source§

fn switch_off(&self, index: usize) -> Result<()>

Switch the specified outlet off
Source§

fn switch(&self, index: usize, on: bool) -> Result<()>

Switch the specified outlet to a particular on/off value
Source§

fn toggle(&self, index: usize) -> Result<bool>

Toggle the specified outlet’s on state Read more

Auto Trait Implementations§

§

impl<T> Freeze for HS300<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for HS300<T>
where T: RefUnwindSafe,

§

impl<T> Send for HS300<T>

§

impl<T> Sync for HS300<T>
where T: Sync,

§

impl<T> Unpin for HS300<T>
where T: Unpin,

§

impl<T> UnwindSafe for HS300<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.