use of org.eclipse.smarthome.binding.mqtt.generic.internal.generic.TransformationServiceProvider in project smarthome by eclipse.
the class GenericThingHandler method createChannelState.
/**
* For every Thing channel there exists a corresponding {@link ChannelState}. It consists of the MQTT state
* and MQTT command topic, the ChannelUID and a value state.
*
* @param channelConfig The channel configuration that contains MQTT state and command topic and multiple other
* configurations.
* @param channelUID The channel UID
* @param valueState The channel value state
* @return
*/
protected ChannelState createChannelState(ChannelConfig channelConfig, ChannelUID channelUID, Value valueState) {
ChannelState state = new ChannelState(channelConfig, channelUID, valueState, this);
String[] transformations;
// Incoming value transformations
transformations = channelConfig.transformationPattern.split("∩");
Stream.of(transformations).filter(t -> StringUtils.isNotBlank(t)).map(t -> new ChannelStateTransformation(t, transformationServiceProvider)).forEach(t -> state.addTransformation(t));
// Outgoing value transformations
transformations = channelConfig.transformationPatternOut.split("∩");
Stream.of(transformations).filter(t -> StringUtils.isNotBlank(t)).map(t -> new ChannelStateTransformation(t, transformationServiceProvider)).forEach(t -> state.addTransformationOut(t));
return state;
}
Aggregations