State Filter (Range Filter) Profile

https://github.com/openhab/openhab-addons/pull/17362

  • Improve the conditions flexibility so that any type of operand can be on either side of the operator, e.g.: ItemName > 10 and 10 < ItemName
  • Add support for functions:
    • $DELTA to represent the absolute difference between the incoming value and the previously accepted value.
    • $AVERAGE, or $AVG to represent the average of the previous incoming values, excluding the incoming value.
    • $STDDEV to represent the population standard deviation of the previous unfiltered incoming values.
    • $MEDIAN to represent the median value of the previous incoming values.
    • $MIN to represent the minimum value of the previous incoming values.
    • $MAX to represent the maximum value of the previous incoming values.
      By default, 5 samples of the previous values are kept.
      This can be customized by specifying the “window size” or sample count applicable to the function, e.g. $MEDIAN(10) will return the median of the last 10 values.
      All the functions except $DELTA support a custom window size.

Example:

Filter out incoming data with very small difference from the previous one:

Number:Power PowerUsage {
  channel="mybinding:mything:mychannel" [ 
    profile="basic-profiles:state-filter",
    conditions="$DELTA > 10 W"
  ]
}
3 Likes