From 11326e7b7725bec2ec636b878ff1ad843da1c0b3 Mon Sep 17 00:00:00 2001 From: Andrew Fiddian-Green Date: Mon, 1 Jul 2024 12:31:35 +0100 Subject: [PATCH] [sonyprojector] fix mac address (#16972) Signed-off-by: Andrew Fiddian-Green --- .../communication/sdcp/SonyProjectorSdcpConnector.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/sdcp/SonyProjectorSdcpConnector.java b/bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/sdcp/SonyProjectorSdcpConnector.java index c97b7ddf8a7..bc0678df8e7 100644 --- a/bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/sdcp/SonyProjectorSdcpConnector.java +++ b/bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/sdcp/SonyProjectorSdcpConnector.java @@ -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(); } }