Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nodrix",
"private": true,
"version": "1.0.0",
"version": "1.0.1",
"type": "module",
"workspaces": [
"worker",
Expand Down
8 changes: 7 additions & 1 deletion shared/widgets/iot-toggle/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions worker/src/platform/durable-objects/project-do.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ export class ProjectDO extends DurableObject<Env> {
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<Array<{ id: string; variable: string; value: unknown }>> {
Expand Down