Hi,
I am on OH2.5x and trying to work out how to add a number to var pointing to an item. I have no idea if that is an accurate description of what I trying to do. I feel like I have tried all variations, but I suspect I will have missed totally the way to solve this problem.
Here is a failing example, I am expecting the var to + 5 from its original value held in .state.
var _Max = gHumidMax.members.findFirst[ max | max.name == "HO_Max_Humid" ]
logInfo("Test.rules", " Max was " + _Max.state)
_Max = (_Max.state) as Number + 5
logInfo("Test.rules", " Max now " + _Max.state)
I have tried all variations so have seen many different errors, I do note that if I change the last line to be
logInfo("Test.rules", " Max now " + _Max)
I do get the right answer but I really want to be able to reference it as _Max.state
Thanks
Paul