Skip to content

Commit

Permalink
Serial id's are upper case, also ignore case when searching for one.
Browse files Browse the repository at this point in the history
Fixes openhab#12654

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
  • Loading branch information
digitaldan committed Apr 25, 2022
1 parent dfd4bea commit 5aa864e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,16 @@ private void configure() {
}

if (confSerialId != null && !confSerialId.isBlank()) {
serialNumber = confSerialId.replaceAll("[^a-zA-Z0-9]", "").toLowerCase();
if (!Arrays.stream(devices).anyMatch(device -> device.getSerialNumber().equals(serialNumber))) {
serialNumber = confSerialId.replaceAll("[^a-zA-Z0-9]", "").toUpperCase();
if (!Arrays.stream(devices)
.anyMatch(device -> device.getSerialNumber().equalsIgnoreCase(serialNumber))) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
"No Device for given serialId found");
return;
}
} else {
serialNumber = devices[0].getSerialNumber();
logger.debug("Using serial number {}", serialNumber);
}

initPolling(COMMAND_REFRESH_SECONDS);
Expand Down

0 comments on commit 5aa864e

Please sign in to comment.