This commit is contained in:
@@ -724,11 +724,15 @@ function renderDevices() {
|
|||||||
})
|
})
|
||||||
.catch(() => {});
|
.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`)
|
api('GET', `/api/devices/${d.host}/${d.port}/state`)
|
||||||
.then((on) => {
|
.then((on) => {
|
||||||
const checkbox = document.getElementById('dchk-'+i);
|
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(() => {});
|
.catch(() => {});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user