bugfix for rule fetch, feat: device info and trying to fix dimmer
Build Images and Deploy / Update-PROD-Stack (push) Successful in 18s
Build Images and Deploy / Update-PROD-Stack (push) Successful in 18s
This commit is contained in:
+14
-1
@@ -246,6 +246,19 @@ async function handleRequest(req, res) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Device Information ───────────────────────────────────────────────────
|
||||
|
||||
const deviceInfoMatch = url.match(/^\/api\/devices\/([^/]+)\/(\d+)\/info$/);
|
||||
if (deviceInfoMatch && method === 'GET') {
|
||||
const [, host, port] = deviceInfoMatch;
|
||||
try {
|
||||
const info = await wemo.getDeviceInfo(host, Number(port));
|
||||
return json(res, info);
|
||||
} catch (err) {
|
||||
return jsonErr(res, `Failed to get device info: ${err.message}`, 500);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Brightness control ───────────────────────────────────────────────────
|
||||
|
||||
const brightnessMatch = url.match(/^\/api\/devices\/([^/]+)\/(\d+)\/brightness$/);
|
||||
@@ -292,7 +305,7 @@ async function handleRequest(req, res) {
|
||||
const wemoRulesMatch = url.match(/^\/api\/devices\/([^/]+)\/(\d+)\/rules$/);
|
||||
if (wemoRulesMatch && method === 'GET') {
|
||||
const [, host, port] = wemoRulesMatch;
|
||||
return json(res, await wemo.getRules(host, Number(port)));
|
||||
return json(res, await wemo.fetchRules(host, Number(port)));
|
||||
}
|
||||
|
||||
const wemoRuleMatch = url.match(/^\/api\/devices\/([^/]+)\/(\d+)\/rules\/(\d+)$/);
|
||||
|
||||
Reference in New Issue
Block a user