From 9a97213907134025ed793f744cfedc425f5379a3 Mon Sep 17 00:00:00 2001 From: Arjun Krishna Date: Sun, 5 Jul 2026 23:18:50 +0530 Subject: [PATCH 1/3] fix(widgets): coerce iot-toggle state so a boolean echo doesn't revert it Compared String(current) to the configured on-value, so a device echoing a JSON boolean read as off and flipped the switch back. Honor the on/off value, then coerce boolean/number/string forms like the device's asBool(). Refs #3 --- shared/widgets/iot-toggle/widget.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/widgets/iot-toggle/widget.ts b/shared/widgets/iot-toggle/widget.ts index 0e82f03..3800262 100644 --- a/shared/widgets/iot-toggle/widget.ts +++ b/shared/widgets/iot-toggle/widget.ts @@ -136,7 +136,13 @@ export class IotToggleElement extends HTMLElement { private offValue(): string { return this.getAttribute('data-off-value') ?? 'off'; } private isOn(): boolean { - return String(this.#current) === this.onValue(); + const c = this.#current; + if (String(c) === this.onValue()) return true; + if (String(c) === this.offValue()) return false; + if (typeof c === 'boolean') return c; + if (typeof c === 'number') return c !== 0; + const s = String(c).trim().toLowerCase(); + return s === 'on' || s === '1' || s === 'true' || s === 'yes'; } private toggle() { From 1d022b7582b27266c22c759140448fb4d79a016d Mon Sep 17 00:00:00 2001 From: Arjun Krishna Date: Sun, 5 Jul 2026 23:18:50 +0530 Subject: [PATCH 2/3] fix(worker): reflect control writes on open dashboards immediately addControl only pushed to connected hardware, so other open dashboards updated only when the device echoed telemetry. Fan the commanded value out via notifyDashboards. Refs #3 --- worker/src/platform/durable-objects/project-do.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/worker/src/platform/durable-objects/project-do.ts b/worker/src/platform/durable-objects/project-do.ts index 47e4d0c..e44eeee 100644 --- a/worker/src/platform/durable-objects/project-do.ts +++ b/worker/src/platform/durable-objects/project-do.ts @@ -374,6 +374,8 @@ export class ProjectDO extends DurableObject { for (const ws of this.ctx.getWebSockets()) { try { ws.send(payload); } catch { /* dead socket; ignore */ } } + + this.notifyDashboards([{ variable, value: value as IngestPoint['value'] }], now); } async listPendingControl(): Promise> { From 0407dcf73b1acef2b7160b67d611e0d9791ee2fc Mon Sep 17 00:00:00 2001 From: Arjun Krishna Date: Sun, 5 Jul 2026 23:22:27 +0530 Subject: [PATCH 3/3] chore: bump version to 1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4c5baf9..2f6dc64 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nodrix", "private": true, - "version": "1.0.0", + "version": "1.0.1", "type": "module", "workspaces": [ "worker",