members.sortBy[lastUpdate].last does not work

All members of gAllAlarmSensors must have a state (i.e. they cannot be NULL) and they all must be persisted by your default persistence or else lastUpdate returns null.

You can filter these problem items out using:

val sensor = gAllAlarmSensors. members.filter[sensor | sensor.lastUpdate != null].sortBy[lastUpdate].last
if(sensor == null) logWarn("FILE", "Something is amiss, no Item has a valid lastUpdate!")