on off toggle fix
Build Images and Deploy / Update-PROD-Stack (push) Successful in 19s

This commit is contained in:
2026-03-30 23:12:48 -04:00
parent d7e9f0d3d3
commit 5180b3bce1
+6 -2
View File
@@ -724,11 +724,15 @@ function renderDevices() {
})
.catch(() => {});
// Also fetch the actual on/off state to set the toggle correctly
// Also fetch the actual on/off state from the BinaryState response
api('GET', `/api/devices/${d.host}/${d.port}/state`)
.then((on) => {
const checkbox = document.getElementById('dchk-'+i);
if (checkbox) checkbox.checked = !!on;
if (checkbox) {
// Use the actual binary state, not brightness
checkbox.checked = !!on;
console.log(`[DWM] Device ${d.host}:${d.port} - BinaryState: ${on ? 'ON' : 'OFF'}, Last brightness: ${data.brightness}%`);
}
})
.catch(() => {});
} else {