pub struct Condition {
pub topic: String,
pub compare: Compare,
pub threshold: f32,
pub hysteresis: f32,
}Expand description
A line drawn through one topic’s readings, with the release band that stops it firing over and over.
In a rule file it is the when object, which names the line with below or above:
{ "topic": "garden/bed-1/moisture", "below": 30.0, "hysteresis": 5.0 }The condition becomes true the moment a reading crosses the threshold in the named
direction, and stops holding once a reading has come back past the threshold by the
hysteresis; readings in between leave it as it was. That is a
Trigger, and trigger builds it.
Fields§
§topic: StringThe topic whose readings are watched, exactly as the node publishes to it.
compare: CompareWhich side of the threshold the condition holds on.
threshold: f32The line a reading crosses.
hysteresis: f32How far back past the line a reading must come for the condition to clear.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Condition
impl<'de> Deserialize<'de> for Condition
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
impl StructuralPartialEq for Condition
Auto Trait Implementations§
impl Freeze for Condition
impl RefUnwindSafe for Condition
impl Send for Condition
impl Sync for Condition
impl Unpin for Condition
impl UnsafeUnpin for Condition
impl UnwindSafe for Condition
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