use of org.openhab.binding.modbus.studer.internal.StuderParser.VSMode in project openhab-addons by openhab.
the class StuderHandler method handlePolledDataVarioString.
/**
* This method is called each time new data has been polled from the VarioString slave
* The register array is first parsed, then each of the channels are updated
* to the new values
*/
protected void handlePolledDataVarioString(int registerNumber, DecimalType quantity) {
switch(CHANNELS_VARIOSTRING.get(registerNumber)) {
case CHANNEL_PV_OPERATING_MODE:
case CHANNEL_PV1_OPERATING_MODE:
case CHANNEL_PV2_OPERATING_MODE:
VSMode vsmode = StuderParser.getVSModeByCode(quantity.intValue());
if (vsmode == VSMode.UNKNOWN) {
internalUpdateState(CHANNELS_VARIOSTRING.get(registerNumber), UnDefType.UNDEF);
} else {
internalUpdateState(CHANNELS_VARIOSTRING.get(registerNumber), new StringType(vsmode.name()));
}
break;
case CHANNEL_STATE_VARIOSTRING:
OnOffType vsstate = StuderParser.getStateByCode(quantity.intValue());
internalUpdateState(CHANNELS_VARIOSTRING.get(registerNumber), vsstate);
break;
default:
Unit<?> unit = UNIT_CHANNELS_VARIOSTRING.get(registerNumber);
if (unit != null) {
internalUpdateState(CHANNELS_VARIOSTRING.get(registerNumber), new QuantityType<>(quantity, unit));
}
}
}
Aggregations