Class PersistenceThresholdFilter

java.lang.Object
org.openhab.core.persistence.filter.PersistenceFilter
org.openhab.core.persistence.filter.PersistenceThresholdFilter

@NonNullByDefault public class PersistenceThresholdFilter extends PersistenceFilter
The PersistenceThresholdFilter is a filter to prevent persistence based on a threshold.

The filter returns false if the new value deviates by less than value. If unit is "%" is true, the filter returns false if the relative deviation is less than value.

Author:
Jan N. Klug - Initial contribution
  • Constructor Details

    • PersistenceThresholdFilter

      public PersistenceThresholdFilter(String name, BigDecimal value, @Nullable String unit, @Nullable Boolean relative)
  • Method Details

    • getValue

      public BigDecimal getValue()
    • getUnit

      public String getUnit()
    • isRelative

      public boolean isRelative()
    • apply

      public boolean apply(Item item)
      Description copied from class: PersistenceFilter
      Apply this filter to an item
      Specified by:
      apply in class PersistenceFilter
      Parameters:
      item - the item to check
      Returns:
      true if the filter allows persisting this value
    • persisted

      public void persisted(Item item)
      Description copied from class: PersistenceFilter
      Notify filter that item was persisted
      Specified by:
      persisted in class PersistenceFilter
      Parameters:
      item - the persisted item
    • toString

      public String toString()
      Overrides:
      toString in class PersistenceFilter