pub struct SwitchStatus {
pub id: u8,
pub output: bool,
pub source: Option<String>,
pub power_watts: Option<f64>,
pub voltage: Option<f64>,
pub current: Option<f64>,
pub frequency: Option<f64>,
pub temperature_c: Option<f64>,
pub total_energy_wh: Option<f64>,
pub timer_active: bool,
pub timer_remaining: Option<f64>,
}Fields§
§id: u8§output: bool§source: Option<String>§power_watts: Option<f64>§voltage: Option<f64>§current: Option<f64>§frequency: Option<f64>§temperature_c: Option<f64>§total_energy_wh: Option<f64>§timer_active: bool§timer_remaining: Option<f64>Implementations§
Source§impl SwitchStatus
impl SwitchStatus
pub fn from_gen1_relay( id: u8, relay: &Gen1Relay, meter: Option<&Gen1Meter>, ) -> Self
pub fn from_gen2_switch(sw: &Gen2SwitchStatus) -> Self
Sourcepub fn from_gen1_relay_json(
id: u8,
relay: &Value,
meter: Option<&Value>,
) -> Self
pub fn from_gen1_relay_json( id: u8, relay: &Value, meter: Option<&Value>, ) -> Self
Parse from raw Gen1 JSON (used by API layer that still works with raw values).
Sourcepub fn from_gen2_switch_json(sw: &Value) -> Self
pub fn from_gen2_switch_json(sw: &Value) -> Self
Parse from raw Gen2 JSON (used by API layer that still works with raw values).
Trait Implementations§
Source§impl Clone for SwitchStatus
impl Clone for SwitchStatus
Source§fn clone(&self) -> SwitchStatus
fn clone(&self) -> SwitchStatus
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SwitchStatus
impl Debug for SwitchStatus
Source§impl<'de> Deserialize<'de> for SwitchStatus
impl<'de> Deserialize<'de> for SwitchStatus
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SwitchStatus
impl RefUnwindSafe for SwitchStatus
impl Send for SwitchStatus
impl Sync for SwitchStatus
impl Unpin for SwitchStatus
impl UnsafeUnpin for SwitchStatus
impl UnwindSafe for SwitchStatus
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