better fix for toggle?
Build Images and Deploy / Update-PROD-Stack (push) Successful in 19s

This commit is contained in:
2026-04-06 20:58:43 -04:00
parent 93dc2952ec
commit b724e805dd
+6 -4
View File
@@ -777,10 +777,12 @@ function renderDevices() {
if (stateData.status === 'fulfilled') { if (stateData.status === 'fulfilled') {
const checkbox = document.getElementById('dchk-'+i); const checkbox = document.getElementById('dchk-'+i);
if (checkbox) { if (checkbox) {
const shouldBeChecked = !!stateData.value; // stateData.value is the response object, not the boolean
checkbox.checked = shouldBeChecked; const actualState = !!stateData.value;
console.log(`[DWM] Device ${d.host}:${d.port} - BinaryState: ${stateData.value ? 'ON' : 'OFF'}, Last brightness: ${brightnessData.value?.brightness || 'N/A'}%`); checkbox.checked = actualState;
console.log(`[DWM] Setting checkbox.checked to: ${shouldBeChecked}`); 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 // Force a DOM update to ensure the change takes effect
checkbox.dispatchEvent(new Event('change')); checkbox.dispatchEvent(new Event('change'));