device state setting fix 3
This commit is contained in:
@@ -73,6 +73,10 @@ class HomeAutomationClient {
|
|||||||
return await this.fetch(this.api('/devices'));
|
return await this.fetch(this.api('/devices'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getDevice() {
|
||||||
|
return await this.fetch(this.api(`/devices/${deviceId}`));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current state of a specific device
|
* Get current state of a specific device
|
||||||
* @param {string} deviceId - Device ID
|
* @param {string} deviceId - Device ID
|
||||||
|
|||||||
@@ -324,11 +324,10 @@
|
|||||||
try {
|
try {
|
||||||
// Load device info using API client
|
// Load device info using API client
|
||||||
// NEW: Use new endpoints for device info and layout
|
// 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);
|
const layoutInfo = await window.apiClient.getDeviceLayout(deviceId);
|
||||||
roomName = layoutInfo.room;
|
roomName = layoutInfo.room;
|
||||||
// deviceState is now the result of getDeviceState
|
|
||||||
deviceState = deviceData;
|
|
||||||
|
|
||||||
// Update header
|
// Update header
|
||||||
document.getElementById('device-icon').textContent = deviceIcons[deviceData.type] || '📱';
|
document.getElementById('device-icon').textContent = deviceIcons[deviceData.type] || '📱';
|
||||||
|
|||||||
Reference in New Issue
Block a user