pub struct Device {
Show 19 fields pub id: String, pub homie_version: String, pub name: Option<String>, pub state: State, pub implementation: Option<String>, pub nodes: HashMap<String, Node>, pub extensions: Vec<Extension>, pub local_ip: Option<String>, pub mac: Option<String>, pub firmware_name: Option<String>, pub firmware_version: Option<String>, pub stats_interval: Option<Duration>, pub stats_uptime: Option<Duration>, pub stats_signal: Option<i64>, pub stats_cputemp: Option<f64>, pub stats_cpuload: Option<i64>, pub stats_battery: Option<i64>, pub stats_freeheap: Option<u64>, pub stats_supply: Option<f64>,
}
Expand description

A Homie device which has been discovered.

The id, homie_version, name and state are required, but might not be available immediately when the device is first discovered. The implementation is optional.

Fields§

§id: String

The subtopic ID of the device. This is unique per Homie base topic, and should follow the Homie ID format.

§homie_version: String

The version of the Homie convention which the device implements.

§name: Option<String>

The human-readable name of the device. This is a required attribute, but might not be available as soon as the device is first discovered.

§state: State

The current state of the device according to the Homie device lifecycle.

§implementation: Option<String>

An identifier for the Homie implementation which the device uses.

§nodes: HashMap<String, Node>

The nodes of the device, keyed by their IDs.

§extensions: Vec<Extension>

The Homie extensions implemented by the device.

§local_ip: Option<String>

The IP address of the device on the local network.

§mac: Option<String>

The MAC address of the device’s network interface.

§firmware_name: Option<String>

The name of the firmware running on the device.

§firmware_version: Option<String>

The version of the firware running on the device.

§stats_interval: Option<Duration>

The interval at which the device refreshes its stats.

§stats_uptime: Option<Duration>

The amount of time since the device booted.

§stats_signal: Option<i64>

The device’s signal strength in %.

§stats_cputemp: Option<f64>

The device’s CPU temperature in °C.

§stats_cpuload: Option<i64>

The device’s CPU load in %, averaged across all CPUs over the last stats_interval.

§stats_battery: Option<i64>

The device’s battery level in %.

§stats_freeheap: Option<u64>

The device’s free heap space in bytes.

§stats_supply: Option<f64>

The device’s power supply voltage in volts.

Implementations§

source§

impl Device

source

pub fn has_required_attributes(&self) -> bool

Returns whether all the required attributes of the device and all its nodes and properties are filled in.

Trait Implementations§

source§

impl Clone for Device

source§

fn clone(&self) -> Device

Returns a copy 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 Debug for Device

source§

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

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

impl PartialEq<Device> for Device

source§

fn eq(&self, other: &Device) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Device

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.