From 7bd9a39bf53e5ea3fdb340fca117b7bbc8598ffd Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Thu, 8 May 2025 07:21:01 +0200 Subject: [PATCH] Fix bluetooth device info is encoding data twice (#25353) Data is already encoded --- .../bluetooth/dialog-bluetooth-device-info.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/panels/config/integrations/integration-panels/bluetooth/dialog-bluetooth-device-info.ts b/src/panels/config/integrations/integration-panels/bluetooth/dialog-bluetooth-device-info.ts index 25c09a9284..71ee7224c2 100644 --- a/src/panels/config/integrations/integration-panels/bluetooth/dialog-bluetooth-device-info.ts +++ b/src/panels/config/integrations/integration-panels/bluetooth/dialog-bluetooth-device-info.ts @@ -29,9 +29,8 @@ class DialogBluetoothDeviceInfo extends LitElement implements HassDialog { } public showDataAsHex(bytestring: string): string { - return Array.from(new TextEncoder().encode(bytestring)) - .map((byte) => byte.toString(16).toUpperCase().padStart(2, "0")) - .join(" "); + const bytes = bytestring.match(/.{2}/g) ?? []; + return bytes.map((byte) => `0x${byte.toUpperCase()}`).join(" "); } private async _copyToClipboard(): Promise {