Number Item and dimension in rule

been using the following in a rule for a while but its suddenly started to fail after the 2.5 release.

if(GarageLUMISensor_Temperature.state < 5.0|°C )

log file is swamped, but it started with the lines. its got me stumped

==> /var/log/openhab2/openhab.log <==
2019-12-22 21:37:46.906 [ERROR] [xtext.validation.CompositeEValidator] - Error executing EValidator
java.lang.UnsupportedOperationException: Missing type computation for expression type: QuantityLiteral / RootExpressionTypeComputationStateWithNonVoidExpectation: ExpressionAwareStackedResolvedTypes: [
parent: [
parent: [

There have been previously observed inconsistencies around use of 5.0|°C or 5.0|"°C"

ive tried it both ways today… :frowning:

Would this work?

if(GarageLUMISensor_Temperature.state as Number < 5 )

What makes you think this line is the error? There’s no obvious linkage. (QuantityLiteral certainly seems like a clue though)

Confident your Item is still a Number:Temperature type?

I’ll try the as number tomorrow…

Don’t see why the item would have changed to be dimensionless but I’ll check

The rule fails if the |°C is there, if it’s just < 5 then it passes validation, but doesn’t work.

As I said it’s been working for about a month or so, the only update being 2.5.0 and I spotted the rule hadn’t fired since the upgrade.

as Number would be a bodge really, using units correctly allows you to compare e.g. 40°F > 5°C

I’ve just played in OH 2.5 release,
if (nmt_CurrentTemperature.state > 10 | "°C") {
works fine (where the Item is a Number:Temperature type, with an if-else action to determine path)
as it does without spaces e.g. ... > 10|"°C")
and indeed without quotes e.g ... > 10|°C).
although I’m sure that did not at some point.

if (nmt_CurrentTemperature.state > 283|K) {
works too.

Changing the test Item to a plain Number type does not produce the error you see (of course the comparison is never true).

Is that a run time error, or rules load time?
Not changed Java versions?


well im now even more confused…

a few reboots and cache clearouts and its back to functioning again, the only change being breaking out the failing rule into its own rule file, so go figure… well i say its functioning, at least its now not obliterating the log file and the rule is executing…ill shall monitor it closely. thanks for the pointers @rossko57 and @Bruce_Osborne

1 Like