bugfix for rule fetch, feat: device info and trying to fix dimmer
Build Images and Deploy / Update-PROD-Stack (push) Successful in 18s

This commit is contained in:
2026-03-30 22:38:52 -04:00
parent 5bffb1064d
commit 7ea32cee8c
5 changed files with 129 additions and 107 deletions
+14 -1
View File
@@ -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+)$/);