@Override @SuppressWarnings({ "unchecked", "rawtypes" }) public void setEntity(EntityLocal entity) { super.setEntity(entity); if (producer==null) producer = entity; subscriptions().subscribe(producer, source, this); if (source instanceof AttributeSensor) { Object value = producer.getAttribute((AttributeSensor)source); // TODO Aled didn't you write a convenience to "subscribeAndRunIfSet" ? (-Alex) if (value!=null) onEvent(new BasicSensorEvent(source, producer, value, -1)); } highlightTriggers(source, producer); } }