This commit is contained in:
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user