OH 4.3.0 Persistence filter broken?

Hi folks,

I’m using groups with items and an influxdb config for persistence.

$ cat /srv/openhab-conf/persistence/influxdb.persist

Strategies {
  everyMinute : "0 * * * * ?"
  everyFifteenMinutes : "0 0/15 * * * ?"
  everyHour : "0 0 * * * ?"
  everyDay : "0 0 0 * * ?"
}

Filters {
  atMostEveryFiveSeconds : T 5 s
}

Items {
  persistence_change* : strategy = everyChange
  persistence_update* : strategy = everyUpdate
  persistence_restore* : strategy = restoreOnStartup
  persistence_periodic* : strategy = everyFifteenMinutes
  persistence_min_interval* : filter = atMostEveryFiveSeconds
}

I have an item which gets updates every second via mqtt channel. I want to persist at most every 5 seconds. So the item has the parent groups:

  • persistence_change
  • persistence_restore
  • persistence_periodic
  • persistence_min_interval

The item gets persisted every change and doesn’t get filtered by the filter defined.

The influx data for this item:

SELECT * FROM smartpi_ptot ORDER BY time DESC LIMIT 20;

name: smartpi_ptot
time                item         value
----                ----         -----
1728433443362000000 smartpi_ptot 233.907237
1728433442368000000 smartpi_ptot 232.664805
1728433441375000000 smartpi_ptot 235.013778
1728433440369000000 smartpi_ptot 234.528453
1728433439371000000 smartpi_ptot 235.421451
1728433438368000000 smartpi_ptot 234.586692
1728433437366000000 smartpi_ptot 236.333862
1728433436385000000 smartpi_ptot 237.692772
1728433435377000000 smartpi_ptot 235.033191
1728433434398000000 smartpi_ptot 235.169082
1728433433389000000 smartpi_ptot 233.771346
1728433432401000000 smartpi_ptot 234.625518
1728433431369000000 smartpi_ptot 234.353736
1728433430374000000 smartpi_ptot 237.80925
1728433429384000000 smartpi_ptot 234.334323
1728433428365000000 smartpi_ptot 234.625518
1728433427376000000 smartpi_ptot 232.276545
1728433426396000000 smartpi_ptot 234.12078
1728433425371000000 smartpi_ptot 235.770885
1728433424361000000 smartpi_ptot 233.887824

Am I doing something wrong? Or is the implementation simply broken at the moment?

OH version:

runtimeInfo:
  version: 4.3.0
  buildString: "Build #4315"
locale: en-AT
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.12
  javaVendor: Ubuntu
  osName: Linux
  osVersion: 6.8.0-1012-raspi
  osArchitecture: aarch64
  availableProcessors: 4
  freeMemory: 102888184
  totalMemory: 542113792
  uptime: 1784
  startLevel: 100
addons:
  - automation-jsscripting
  - binding-enigma2
  - binding-http
  - binding-mielecloud
  - binding-modbus
  - binding-mqtt
  - binding-netatmo
  - binding-tado
  - misc-openhabcloud
  - persistence-influxdb
  - transformation-jsonpath
  - transformation-regex
  - ui-basic
clientInfo:
  device:
    ios: false
    android: true
    androidChrome: true
    desktop: false
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    os: android
    osVersion: "10"
    webView: false
    webview: false
    standalone: false
    pixelRatio: 4
    prefersColorScheme: dark
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 8
    language: en-AT
    languages:
      - en-AT
      - en-GB
      - en-US
      - en
      - de
    onLine: true
    platform: Linux armv81
  screen:
    width: 360
    height: 792
    colorDepth: 24
  support:
    touch: true
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
    blocklyRenderer: null
  userAgent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like
    Gecko) Chrome/129.0.0.0 Mobile Safari/537.36
timestamp: 2024-10-08T23:54:18.746Z

Thanks,
Daniel

OK, I found out the following: definitions without strategy and only with filters are not merged into strategies when an item is subordinated to these groups. You have to use your own definition with strategy and filter. You could call this buggy, or you could document this limitation. The following works:

configurations:
  - items:
      - persistence_change*
    strategies:
      - everyChange
    filters:
      - atMostEvery5Seconds
  - items:
      - persistence_update*
    strategies:
      - everyUpdate
    filters: []
  - items:
      - persistence_restore*
    strategies:
      - restoreOnStartup
    filters: []
  - items:
      - persistence_periodic*
    strategies:
      - every15Minutes
    filters: []
  - items:
      - persistence_change_at_most*
    strategies:
      - everyChange
    filters:
      - atMostEvery5Seconds
cronStrategies:
  - name: every15Minutes
    cronExpression: 0 0/15 * * * ? *
defaultStrategies: []
thresholdFilters: []
timeFilters:
  - name: atMostEvery5Seconds
    value: 5
    unit: s
equalsFilters: []
includeFilters: []

So my item smartpi_ptot has now the following groups:

  • persistence_restore
  • persistence_periodic
  • persistence_change_at_most