Just migrated from 4.19 (32 bits) to 4.20 (64 bits).
Full install from GitHub manually downloaded xz image (RaspBerry Imager fails to download the image with 404 !).
Data and configuration restored from last backup.
Most seems to work, but Item.history
Item.history now fails with error message
failed: org.graalvm.polyglot.PolyglotException: TypeError: undefined has no such function “averageSince”<<
Here is my code:
// Update Average value
var My_Item = items.getItem(‘Lx_01_Illuminance’);
var My_Avg_Item = items.getItem(‘Lx_01_Illuminance_Avg’);
var now = time.ZonedDateTime.now();
var My_Time = time.ZonedDateTime.now().minusMinutes(7);
console.log(utils.OPENHAB_JS_VERSION);
var My_Avg_Val = My_Item.history.averageSince( My_Time );
This is what I ended up with reading the persistence information and modifying/testing the code while you were posting your answer.
I’d better have been waiting for you !
Indeed, the returned value is now a persistedState object.
This makes things a bit more complicated and less intuitive.
For the community: here is my corrected code:
// Update Average value
var My_Item = items.getItem(‘Lx_01_Illuminance’);
var My_Avg_Item = items.getItem(‘Lx_01_Illuminance_Avg’);
var now = time.ZonedDateTime.now();
var My_Time = time.ZonedDateTime.now().minusMinutes(7);
//var My_Avg_Val = My_Item.history.averageSince( My_Time ); Old code not working anymore
var My_Avg_Val = My_Item.persistence.averageSince( My_Time ).state;