Struct homie_controller::Property
source · [−]pub struct Property {
pub id: String,
pub name: Option<String>,
pub datatype: Option<Datatype>,
pub settable: bool,
pub retained: bool,
pub unit: Option<String>,
pub format: Option<String>,
pub value: Option<String>,
}Expand description
A property of a Homie node.
The id, name and datatype are required, but might not be available immediately when the
property is first discovered. The other attributes are optional.
Fields
id: StringThe subtopic ID of the property. This is unique per node, and should follow the Homie ID format.
name: Option<String>The human-readable name of the property. This is a required attribute, but might not be available as soon as the property is first discovered.
datatype: Option<Datatype>The data type of the property. This is a required attribute, but might not be available as soon as the property is first discovered.
settable: boolWhether the property can be set by the Homie controller. This should be true for properties like the brightness or power state of a light, and false for things like the temperature reading of a sensor. It is false by default.
retained: boolWhether the property value is retained by the MQTT broker. This is true by default.
unit: Option<String>The unit of the property, if any. This may be one of the recommended units, or any other custom unit.
format: Option<String>The format of the property, if any. This should be specified if the datatype is Enum or
Color, and may be specified if the datatype is Integer or Float.
This field holds the raw string received from the device. Use color_format, enum_values or range to parse it according to the datatype of the property.
value: Option<String>The current value of the property, if known. This may change frequently.
This field holds the raw string received from the device. Use value to parse it according to the datatype of the property.
Implementations
Returns whether all the required attributes of the property are filled in.
The value of the property, parsed as the appropriate Homie Value type. This will return
WrongDatatype if you try to parse it as a type which doesn’t match the datatype declared
by the property.
If the datatype of the property is Color, returns the color format.
If the datatype of the property is Enum, gets the possible values of the enum.
If the dataype of the property is Integer or Float, gets the allowed range of values (if
any is declared by the device).
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Property
impl UnwindSafe for Property
Blanket Implementations
Mutably borrows from an owned value. Read more