Skip to content

Commit

Permalink
[velbus] Fixed parsing of channel bytes on VMB4AN. (openhab#10627)
Browse files Browse the repository at this point in the history
Signed-off-by: Cedric Boon <cedric.boon@hotmail.com>
  • Loading branch information
cedricboon authored and computergeek1507 committed Jul 13, 2021
1 parent 2a48b0f commit 8984c6d
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ protected boolean isAlarmChannel(ChannelUID channelUID) {
}

protected byte convertAlarmChannelUIDToChannelByte(ChannelUID channelUID) {
return Byte.parseByte(channelUID.getIdWithoutGroup());
return Byte.parseByte(channelUID.getIdWithoutGroup().replaceAll(CHANNEL, ""));
}

protected boolean isTextAnalogInputChannel(ChannelUID channelUID) {
Expand All @@ -246,27 +246,28 @@ protected boolean isRawAnalogInputChannel(ChannelUID channelUID) {
}

protected byte convertRawAnalogInputChannelUIDToChannelByte(ChannelUID channelUID) {
return Byte.parseByte(channelUID.getIdWithoutGroup().replaceAll(RAW_CHANNEL_SUFFIX, ""));
return Byte
.parseByte(channelUID.getIdWithoutGroup().replaceAll(CHANNEL, "").replaceAll(RAW_CHANNEL_SUFFIX, ""));
}

protected byte convertTextAnalogInputChannelUIDToChannelByte(ChannelUID channelUID) {
return Byte.parseByte(channelUID.getIdWithoutGroup());
return Byte.parseByte(channelUID.getIdWithoutGroup().replaceAll(CHANNEL, ""));
}

protected String convertAnalogInputChannelByteToRawChannelUID(byte channelByte) {
return convertAnalogInputChannelByteToChannelUID(channelByte) + RAW_CHANNEL_SUFFIX;
}

protected String convertAnalogInputChannelByteToChannelUID(byte channelByte) {
return ANALOG_INPUT_GROUP + "#" + channelByte;
return ANALOG_INPUT_GROUP + "#" + CHANNEL + channelByte;
}

protected boolean isAnalogOutputChannel(ChannelUID channelUID) {
return ANALOG_OUTPUT_GROUP.equals(channelUID.getGroupId());
}

protected byte convertAnalogOutputChannelUIDToChannelByte(ChannelUID channelUID) {
return Byte.parseByte(channelUID.getIdWithoutGroup());
return Byte.parseByte(channelUID.getIdWithoutGroup().replaceAll(CHANNEL, ""));
}

@Override
Expand Down

0 comments on commit 8984c6d

Please sign in to comment.