@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void setEntity(EntityLocal entity) {
super.setEntity(entity);
this.producer = getConfig(PRODUCER) == null ? entity: getConfig(PRODUCER);
this.sourceSensor = (AttributeSensor<T>) getRequiredConfig(SOURCE_SENSOR);
this.targetSensor = (Sensor<String>) getRequiredConfig(TARGET_SENSOR);
highlightTriggers(sourceSensor, producer);
subscriptions().subscribe(producer, sourceSensor, this);
Object value = producer.getAttribute((AttributeSensor<?>) sourceSensor);
if (value != null) {
onEvent(new BasicSensorEvent(sourceSensor, producer, value, -1));
}
}