Hi there,
i just updated openHAB from 5.0.2 and 5.1.
I checked the breaking changes and adjusted all my persistence files before.
Maybe i missed an annoucement to this topic but my rules worked until the upgrade.
Every rule where i use <group>.members.forEach is ignored due to this error:
DSL model 'XYZ.rules' has errors, therefore ignoring it:
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
Some examples:
gEchoCommands.members.forEach[ i | i.postUpdate('')]
gLicht.members.filter[i | i.state != OFF].forEach[i | i.sendCommand(OFF)]
Tankstellen.members.forEach[ i | GasPrices.append(i.label+": " + String::format("%.3f", (i.state as Number).doubleValue)+"ā¬/l (" + String::format("%.3f", (i.minimumSince(now.minusDays(1), "influxdb").state as Number).doubleValue)+"ā¬/l)\n")]
But i“m also using some more complex approaches:
AralTankstellen.members.filter[i | i.state != UNDEF].forEach[ i |
val String stationNameItem = i.name.split("_").get(0) + "_Name"
val stationName = ScriptServiceUtil.getItemRegistry.getItem(stationNameItem)?.state.toString ?: "Unbekannt"
val String stationPrice = String::format("%.3f", (i.state as Number).doubleValue)
val String minimumPrice = String::format("%.3f", (i.minimumSince(now.minusDays(1), "influxdb").state as Number).doubleValue)
GasPrices.append(stationName + ": " + stationPrice + "ā¬/l (" + minimumPrice + "ā¬/l)\n")
]
I“ve already seen this thread with a similiar problem:
The solution was to add SwitchItem as a context.
I“m not sure what i need to add to my rules to get them working again.
Is there a documentation what context i need to use for different types of groups?
Honest question, shouldn“t this be declared as a breaking change?
Cheers