From b724e805dd3d72943b83ec8f540ec8b68fb70015 Mon Sep 17 00:00:00 2001 From: Mike Johnston Date: Mon, 6 Apr 2026 20:58:43 -0400 Subject: [PATCH] better fix for toggle? --- apps/desktop/resources/web/index.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/desktop/resources/web/index.html b/apps/desktop/resources/web/index.html index 899bf5c..8f70236 100644 --- a/apps/desktop/resources/web/index.html +++ b/apps/desktop/resources/web/index.html @@ -777,10 +777,12 @@ function renderDevices() { if (stateData.status === 'fulfilled') { const checkbox = document.getElementById('dchk-'+i); if (checkbox) { - const shouldBeChecked = !!stateData.value; - checkbox.checked = shouldBeChecked; - console.log(`[DWM] Device ${d.host}:${d.port} - BinaryState: ${stateData.value ? 'ON' : 'OFF'}, Last brightness: ${brightnessData.value?.brightness || 'N/A'}%`); - console.log(`[DWM] Setting checkbox.checked to: ${shouldBeChecked}`); + // stateData.value is the response object, not the boolean + const actualState = !!stateData.value; + checkbox.checked = actualState; + console.log(`[DWM] Device ${d.host}:${d.port} - BinaryState: ${actualState ? 'ON' : 'OFF'}, Last brightness: ${brightnessData.value?.brightness || 'N/A'}%`); + console.log(`[DWM] Setting checkbox.checked to: ${actualState}`); + console.log(`[DWM] Raw stateData.value:`, stateData.value); // Force a DOM update to ensure the change takes effect checkbox.dispatchEvent(new Event('change'));