Skip to content

Commit

Permalink
[yamahareceiver] Handle 'No Preset' tuner preset response (openhab#11471
Browse files Browse the repository at this point in the history
)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
  • Loading branch information
mlobstein authored and volkmarnissen committed Feb 17, 2022
1 parent 77c40cd commit add37df
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ private int convertToPresetNumber(String presetValue) {
// special handling for RX-V3900, where 'A1' becomes 101 and 'B2' becomes 202 preset
if (presetValue.length() >= 2) {
Character presetAlpha = presetValue.charAt(0);
if (Character.isLetter(presetAlpha) && Character.isUpperCase(presetAlpha)) {
if (Character.isLetter(presetAlpha) && Character.isUpperCase(presetAlpha)
&& Character.isDigit(presetValue.charAt(1))) {
int presetNumber = Integer.parseInt(presetValue.substring(1));
return (ArrayUtils.indexOf(LETTERS, presetAlpha) + 1) * 100 + presetNumber;
}
Expand Down

0 comments on commit add37df

Please sign in to comment.