garaga page 6
This commit is contained in:
@@ -102,12 +102,14 @@ class HomeAutomationClient {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async setDeviceState(deviceId, type, payload) {
|
async setDeviceState(deviceId, type, payload) {
|
||||||
|
const requestBody = { type, payload };
|
||||||
|
console.log('API setDeviceState request:', requestBody);
|
||||||
await fetch(this.api(`/devices/${deviceId}/set`), {
|
await fetch(this.api(`/devices/${deviceId}/set`), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ type, payload })
|
body: JSON.stringify(requestBody)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user