device state setting fix 3

This commit is contained in:
2025-11-19 10:20:46 +01:00
parent 381f8521d4
commit 99580f8ff9
2 changed files with 6 additions and 3 deletions

View File

@@ -73,6 +73,10 @@ class HomeAutomationClient {
return await this.fetch(this.api('/devices'));
}
async getDevice() {
return await this.fetch(this.api(`/devices/${deviceId}`));
}
/**
* Get current state of a specific device
* @param {string} deviceId - Device ID

View File

@@ -324,11 +324,10 @@
try {
// Load device info using API client
// NEW: Use new endpoints for device info and layout
deviceData = await window.apiClient.getDeviceState(deviceId);
const deviceData = await window.apiClient.getDevice(deviceId);
deviceState = await window.apiClient.getDeviceState(deviceId);
const layoutInfo = await window.apiClient.getDeviceLayout(deviceId);
roomName = layoutInfo.room;
// deviceState is now the result of getDeviceState
deviceState = deviceData;
// Update header
document.getElementById('device-icon').textContent = deviceIcons[deviceData.type] || '📱';