garaga page 8

This commit is contained in:
2025-11-28 08:06:17 +01:00
parent b4e0fc8ddd
commit 5c97bb3c1e

View File

@@ -407,7 +407,10 @@
const toggleSwitch = document.createElement('button');
toggleSwitch.className = `toggle-switch ${currentPower ? 'on' : ''}`;
toggleSwitch.onclick = () => toggleOutlet(device.device_id, currentPower ? 'off' : 'on');
toggleSwitch.onclick = () => {
const currentState = deviceStates[device.device_id]?.power === 'on';
toggleOutlet(device.device_id, currentState ? 'off' : 'on');
};
const label = document.createElement('div');
label.className = 'toggle-label';