OH4.3: how is persistence "lastUpdate/lastChanged" calculated and held with forecast items?

Running OH4.3.3-release on a Pi4(4GB) with openHABian.

So, I’m maximal confused. Some of my rules rely on “lastupdate” in persistence. And for that I’m using mostly ‘jdbc’, because sometimes it’s about “now” and rrd4j was too slow for that.

Use case with hourly updated item (dynamic pricing with Tibber):

  • I want to see the last update for a item. But, now I’m maximal confused, or it’s simply, the Tibber “forecast”-item doesn’t get “updated” for 24h?
  • (I could compare the current price with the price last hour, but that isn’t reliable, sometimes prices stay the same for consecutive hours.)

So I tested three items:

  • TIB_Current_StartsAt => an item, which should be updated via Tibber-Binding on the hour.
  • EMS_VarTibberLow => an item, which has no link to a thing, which I updated months ago
  • WS_TempOutside => an item, which is updated via MQTT randomly
console.info("DEBUG: lastUpdate jdbc TIB_Current_StartsAt: " + items.getItem("TIB_Current_StartsAt").persistence.lastUpdate('jdbc'));
console.info("DEBUG: lastUpdate jdbc EMS_VarTibberLow: " + items.getItem("EMS_VarTibberLow").persistence.lastUpdate('jdbc'));
console.info("DEBUG: lastUpdate jdbc WS_TempOutside: " + items.getItem("WS_TempOutside").persistence.lastUpdate('jdbc'));

console.info("DEBUG: lastChange jdbc TIB_Current_StartsAt: " + items.getItem("TIB_Current_StartsAt").persistence.lastChange('jdbc'));
console.info("DEBUG: lastChange jdbc EMS_VarTibberLow: " + items.getItem("EMS_VarTibberLow").persistence.lastChange('jdbc'));
console.info("DEBUG: lastChange jdbc WS_TempOutside: " + items.getItem("WS_TempOutside").persistence.lastChange('jdbc'));

Output:

2025-03-29 20:43:07.214 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastUpdate jdbc TIB_Current_StartsAt: 2025-03-29T19:53:51.494+01:00[Europe/Berlin]
2025-03-29 20:43:07.227 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastUpdate jdbc EMS_VarTibberLow: 2024-09-14T10:20:39.189+02:00[Europe/Berlin]
2025-03-29 20:43:07.241 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastUpdate jdbc WS_TempOutside: 2025-03-29T20:17:24.254+01:00[Europe/Berlin]

2025-03-29 20:43:07.313 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastChange jdbc TIB_Current_StartsAt: 2025-03-29T19:53:51.494+01:00[Europe/Berlin]
2025-03-29 20:43:07.548 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastChange jdbc EMS_VarTibberLow: 2024-09-14T10:20:39.189+02:00[Europe/Berlin]d
2025-03-29 20:43:07.575 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastChange jdbc WS_TempOutside: 2025-03-29T20:17:24.254+01:00[Europe/Berlin]

It seems, both “normal” items get their updates and changes as they should, but a forecast item doesn’t get both updated and changed - except the forecast intervall changes? (I restarted Tibber at 19:53, because the Binding didn’t update (again: Tibber price- and live-updates stopped sometime a month ago)

So, is there a way to tell, the tibber binding is running as it should?

now I’m totally confused! :wink:

New day, new test with

  • TIB_Current_Total_Price => tibber binding: tibber:tibberapi:pl12:current_total (Number:Dimensionless)
  • AWT_Current_Totalgross => aWATTar binding: awattar:prices:awattar:stundenpreise:current#total-gross (Number)

my test-rule:

console.info("DEBUG: value of TIB_Current_Total_Price: " + items.getItem("TIB_Current_Total_Price").state);
console.info("DEBUG: value of AWT_Current_Totalgross: " + items.getItem("AWT_Current_Totalgross").state);

console.info("DEBUG: lastUpdate jdbc TIB_Current_Total_Price: " + items.getItem("TIB_Current_Total_Price").persistence.lastUpdate('jdbc'));
console.info("DEBUG: lastUpdate jdbc AWT_Current_Totalgross: " + items.getItem("AWT_Current_Totalgross").persistence.lastUpdate('jdbc'));

console.info("DEBUG: lastChange jdbc TIB_Current_Total_Price: " + items.getItem("TIB_Current_Total_Price").persistence.lastChange('jdbc'));
console.info("DEBUG: lastChange jdbc AWT_Current_Totalgross: " + items.getItem("AWT_Current_Totalgross").persistence.lastChange('jdbc'));

the logfile:

2025-04-01 13:41:20.386 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: value of TIB_Current_Total_Price: 0.2263
2025-04-01 13:41:20.388 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: value of AWT_Current_Totalgross: 18.20

2025-04-01 13:41:20.396 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastUpdate jdbc TIB_Current_Total_Price: null
2025-04-01 13:41:20.410 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastUpdate jdbc AWT_Current_Totalgross: 2025-04-01T12:59:50.080+02:00[Europe/Berlin]

2025-04-01 13:41:20.667 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastChange jdbc TIB_Current_Total_Price: null
2025-04-01 13:41:20.732 [INFO ] [b.automation.script.ui.TestFuerAlles] - DEBUG: lastChange jdbc AWT_Current_Totalgross: 2025-04-01T12:59:50.080+02:00[Europe/Berlin]

why is the lastUpdate and lastChanged for the Tibber-item now null?

lastUpdate will return null if the current state of the Item doesn’t match the most recent value stored in the database. This is because if the states differ there really is no way to know what the last update was. This is what’s driving the PR to add a persistence independent implmentation for lastUpdate on the Item level.

I cannot tell you why the current state of the Item doesn’t match the most recent value in the DB (looking from now to the past).

yes, I remember from some other “concurrent” situations, where the value changes and before the persistence is ready the rule ask for lastUpdate.

but: this is consistently null. Now I think that’s because of some Tibber Binding ERROR, because the value did not change on the hour.