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