Rules-dsl: error after update from 4.1.1 to 4.2: 'doubleValue' is not a member of 'org.openhab.core.types.State'

Hi,

I have a few rules in which I have accessed “doubleValue” so far.

var Number dev = Math::abs((IGLR2_ValveOpening.deviationSince(now.minusMinutes(30))).doubleValue)

After the update to 4.2, I get the following error in these places:

2024-07-15 15:03:07.575 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'heat_eg_wohn-7' failed: 'doubleValue' is not a member of 'org.openhab.core.types.State'; line 300, column 32, length 69 in heat_eg_wohn

How do I rewrite the code for 4.2 correctly?

var Number dev = Math::abs((IGLR2_ValveOpening.deviationSince(now.minusMinutes(30)) as DecimalType).doubleValue)

Should work I think. Persistence actions have been changed to return a State (which could be a Quantity type as well) instead of a DecimalType. If the Item has a dimension, you might need to change to as QuantityType to account for that.

1 Like

thank you :slight_smile: