openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

RiemannType file based DSL not working

Open mherwege opened this issue 7 months ago • 2 comments

In persistence extensions, the RiemannSum methods have a RiemannType enum parameter.

In my testing, this paramater works well in javascript and Blockly. It also works when the DSL is defined through the UI.

The following DSL defined in the UI works:

val TRAPEZOIDAL = org.openhab.core.persistence.extensions.PersistenceExtensions.RiemannType.TRAPEZOIDAL
logInfo("Riemann Test", Aussentemperatur.riemannSumBetween(now.minusYears(1).minusHours(1),now(),TRAPEZOIDAL,"rrd4j").toString)

I do have to provide the full qualified name for the option though, which is not nice.

When defining the rule in a file, I am gettign an error. Rule:

rule "Test Riemann"
when
    Item TestSwitch received command
then
    val TRAPEZOIDAL = org.openhab.core.persistence.extensions.PersistenceExtensions.RiemannType.TRAPEZOIDAL
    logInfo("Riemann Test", Aussentemperatur.riemannSumBetween(now.minusYears(1).minusHours(1),now(),TRAPEZOIDAL,"rrd4j").toString)
end

And the log when triggered:

18:14:41.464 [ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'riemann-1' failed: An error occurred during the script execution: Could not access field: org.openhab.core.persistence.extensions.PersistenceExtensions$RiemannType.TRAPEZOIDAL on instance: null in riemann

I don't know the cause of this is.

Does anyone have an idea why this fails with file based rules? Is there a way to not have to qualify the RiemannType in DSL?

See https://community.openhab.org/t/how-to-use-the-riemann-sum-persistence-extension/163907/10

@lolodomo @wborn Does any of you have an idea?

mherwege avatar May 02 '25 16:05 mherwege