Max of multiple items?

Ok, I think I got closer to the problem. I set up the following workaround:

rule FirstFloor_Bedroom_Mainlight_Cold_Rulex
    when
        Item FirstFloor_Bedroom_Mainlight_Cold1 received update or
        Item FirstFloor_Bedroom_Mainlight_Cold2 received update
    then
        if( 1==1 )
            postUpdate(FirstFloor_Bedroom_Mainlight_Cold,FirstFloor_Bedroom_Mainlight_Cold1.state)
        else
            postUpdate(FirstFloor_Bedroom_Mainlight_Cold,FirstFloor_Bedroom_Mainlight_Cold2.state)

        var Number meanBrightness = (FirstFloor_Bedroom_Mainlight_Cold.state+FirstFloor_Bedroom_Mainlight_Cold.state)/2
        postUpdate(FirstFloor_Bedroom_Mainlight,meanBrightness)
    end

This gives the following error

Error during the execution of rule 'FirstFloor_Bedroom_Mainlight_Cold_Rulex': Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null

despite the fact that FirstFloor_Bedroom_Mainlight_Cold was updated right before. (In the final version, the second term is FirstFloor_Bedroom_Mainlight_Warm, of course, to get the mean, but I want to rule out unnecessary sources of error right now.)