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