From b4e0fc8ddd4e124045363c350c5e42057b937e36 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 28 Nov 2025 07:55:53 +0100 Subject: [PATCH] garaga page 7 --- apps/ui/templates/garage.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/ui/templates/garage.html b/apps/ui/templates/garage.html index 38a5f87..638063a 100644 --- a/apps/ui/templates/garage.html +++ b/apps/ui/templates/garage.html @@ -512,7 +512,10 @@ async function toggleOutlet(deviceId, newState) { try { const device = devicesData[deviceId]; - await window.apiClient.setDeviceState(deviceId, device.type, { power: newState }); + await sendCommand(deviceId, { + type: device.type, + payload: { power: newState } + }); console.log(`Set ${deviceId} to ${newState}`); } catch (error) { console.error('Error toggling outlet:', error); @@ -520,6 +523,11 @@ } } + async function sendCommand(deviceId, payload) { + const device = devicesData[deviceId]; + await window.apiClient.setDeviceState(deviceId, device.type, payload.payload); + } + function connectRealtime() { try { window.apiClient.connectRealtime((event) => {