Another hard find was the persistence usage from javascript - as the documentation is again only for the good old DSL rules - but fortunately I found a great example here: Need advice on making my OH3 rules more flexible
For quick reference, here’s a custom version of the rule persistence extension part:
var logger = Java.type("org.slf4j.LoggerFactory").getLogger("org.openhab.rule." + ctx.ruleUID);
var PersistenceExtensions = Java.type("org.openhab.core.persistence.extensions.PersistenceExtensions");
var ZonedDateTime = Java.type("java.time.ZonedDateTime");
logger.info(PersistenceExtensions.sumSince(ir.getItem("your_item_name"), ZonedDateTime.now().minusHours(24)));
I’m wondering if there’s a plan to make the examples in the documentation tabbed, containing codes for each supported scripting languages?