use of org.openhab.binding.modbus.studer.internal.StuderParser.VTType in project openhab-addons by openhab.
the class StuderHandler method handlePolledDataVarioTrack.
/**
* This method is called each time new data has been polled from the VarioTrack slave
* The register array is first parsed, then each of the channels are updated
* to the new values
*/
protected void handlePolledDataVarioTrack(int registerNumber, DecimalType quantity) {
switch(CHANNELS_VARIOTRACK.get(registerNumber)) {
case CHANNEL_MODEL_VARIOTRACK:
VTType type = StuderParser.getVTTypeByCode(quantity.intValue());
if (type == VTType.UNKNOWN) {
internalUpdateState(CHANNELS_VARIOTRACK.get(registerNumber), UnDefType.UNDEF);
} else {
internalUpdateState(CHANNELS_VARIOTRACK.get(registerNumber), new StringType(type.name()));
}
break;
case CHANNEL_OPERATING_MODE:
VTMode vtmode = StuderParser.getVTModeByCode(quantity.intValue());
if (vtmode == VTMode.UNKNOWN) {
internalUpdateState(CHANNELS_VARIOTRACK.get(registerNumber), UnDefType.UNDEF);
} else {
internalUpdateState(CHANNELS_VARIOTRACK.get(registerNumber), new StringType(vtmode.name()));
}
break;
case CHANNEL_STATE_VARIOTRACK:
OnOffType vtstate = StuderParser.getStateByCode(quantity.intValue());
internalUpdateState(CHANNELS_VARIOTRACK.get(registerNumber), vtstate);
break;
default:
Unit<?> unit = UNIT_CHANNELS_VARIOTRACK.get(registerNumber);
if (unit != null) {
internalUpdateState(CHANNELS_VARIOTRACK.get(registerNumber), new QuantityType<>(quantity, unit));
}
}
}
Aggregations