rule "Vaillant_status"
when
Item VaillantVRT39239200DisplayedRoomTempDisplayedRoomTemp received update or Item VaillantVRT39239200ActualRoomTempDesiredHc1ActualRoomTempDesiredHc1 received update or Item VaillantVRT39239200Hc1OPModeHc1OPMode received update
then
if(VaillantVRT39239200Hc1OPModeHc1OPMode.state == 2 ){
var String VRTstatus = "AUTO"
logInfo("FILE", "AUTOOOOO")
}else if (VaillantVRT39239200Hc1OPModeHc1OPMode.state == 1 ){
var String VRTstatus = "MANUAL"
logInfo("FILE", "MANUALLLLL")
}else{
var String VRTstatus = "OFF"
logInfo("FILE", "OFFFFF")
}
Vaillant_status.postUpdate(VaillantVRT39239200ActualRoomTempDesiredHc1ActualRoomTempDesiredHc1.state.toString + "°C/" + VaillantVRT39239200DisplayedRoomTempDisplayedRoomTemp.state.toString + "°C/" + VRTstatus.state.toString)
end
ERROR
10:13:44.498 [INFO ] [del.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'test.rules', using it anyway:
The value of the local variable VRTstatus is not used
The value of the local variable VRTstatus is not used
The value of the local variable VRTstatus is not used
10:14:44.329 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Vaillant_status': 'state' is not a member of 'java.lang.String'; line 1042, column 201, length 15
``
By way of explanation, the var exists only within the { } block, and vanishes at the closing }
By defining the var outside the block, it continues to exist before, during, and after the { } block.