The error is not about using val verses var but about the call to sendCommand. The problem is there are two different sendCommands actions that could both be valid, one that takes a Number and the other that takes a Command. This is because DecimalType is both a Number and a Command. So Designer doesn’t know which one you really want. It works because either one will work. You just don’t know which one is actually being called.
There are a host of ways you can fix this.
- don’t cast HeizungEco
val HeizungEco = setHeizungEcoTemperatur.state
- cast it to Number instead of DecimalType
val HeizungEco = (setHeizungEcoTemperatur.state as Number)
- use a String and let sendCommand convert it back
val HeisungEco = setHeixungEcoTemperatur.state.toString
- use the sendCommand method on the Item instead of the actions
Heizung_Wohnzimmer_Wand.sendCommand(HeizungEco)
This one is weird. You should be able to define and use alarmAusgeloest as defined here. The only thing I can think of is that not all of the members of gLicht_Alle are able to handle that String as an input (often a Null error really means an invalid data error) but moving the val into the Rule wouldn’t fix that.
What happens if you have the val global and you log it in the rule?