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'));