]> git.basschouten.com Git - openhab-addons.git/commitdiff
[sonyprojector] fix mac address (#16972)
authorAndrew Fiddian-Green <software@whitebear.ch>
Mon, 1 Jul 2024 11:31:35 +0000 (12:31 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Jul 2024 11:31:35 +0000 (13:31 +0200)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/sdcp/SonyProjectorSdcpConnector.java

index c97b7ddf8a751c497fb3f7626485580b1a348365..bc0678df8e7a0b13aeb07cf190361b7ce1be19cf 100644 (file)
@@ -320,6 +320,14 @@ public class SonyProjectorSdcpConnector extends SonyProjectorConnector {
      * @throws SonyProjectorException in case of any problem
      */
     public String getMacAddress() throws SonyProjectorException {
-        return new String(getSetting(SonyProjectorItem.MAC_ADDRESS), StandardCharsets.UTF_8);
+        String macAddress = "";
+        byte[] macBytes = getSetting(SonyProjectorItem.MAC_ADDRESS);
+        for (byte macByte : macBytes) {
+            if (!macAddress.isEmpty()) {
+                macAddress = macAddress + "-";
+            }
+            macAddress = macAddress + Integer.toHexString(macByte);
+        }
+        return macAddress.toLowerCase();
     }
 }