pub struct Switch { /* private fields */ }
Expand description
For things that go on and off. Ex: lights, water pump, water heater, etc.
Implementations§
Source§impl Switch
impl Switch
Sourcepub fn new(thing: Thing) -> Result<Self, SwitchError>
pub fn new(thing: Thing) -> Result<Self, SwitchError>
Create a new Switch from a generic “Thing”. LCI gateway must publish the type as a Switch.
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
Returns the label of the device such as “Water Pump” or “Kitchen Lights”.
Sourcepub async fn online(&self) -> Result<OnlineState, OnlineStateConversionError>
pub async fn online(&self) -> Result<OnlineState, OnlineStateConversionError>
Returns the device’s online state.
Sourcepub async fn state(&self) -> Result<SwitchState, SwitchStateConversionError>
pub async fn state(&self) -> Result<SwitchState, SwitchStateConversionError>
Gets the current relay state.
Sourcepub async fn fault(&self) -> Result<SwitchState, SwitchStateConversionError>
pub async fn fault(&self) -> Result<SwitchState, SwitchStateConversionError>
Gets if the fault state is on or off.
Sourcepub async fn relay_current(&self) -> Result<String, SwitchRelayCurrentError>
pub async fn relay_current(&self) -> Result<String, SwitchRelayCurrentError>
Gets the current being used by the relay.
Auto Trait Implementations§
impl Freeze for Switch
impl RefUnwindSafe for Switch
impl Send for Switch
impl Sync for Switch
impl Unpin for Switch
impl UnwindSafe for Switch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more