Class PersistenceTimeFilter

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

@NonNullByDefault public class PersistenceTimeFilter extends PersistenceFilter
The PersistenceTimeFilter is a filter to prevent persistence base on intervals.

The filter returns false if the time between now and the time of the last persisted value is less than duration unit

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

    • PersistenceTimeFilter

      public PersistenceTimeFilter(String name, int value, @Nullable String unit)
  • Method Details

    • getValue

      public int getValue()
    • getUnit

      public String getUnit()
    • 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