diff options
| author | Luke Hoersten <[email protected]> | 2026-06-20 10:11:57 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-20 10:11:57 -0500 |
| commit | 521de7ef844a4b5c1eb660ff54382b958fb62bd7 (patch) | |
| tree | 510379eca4d301017f0a7f5d5902a2da2fe10ae0 /main/state_machine.c | |
| parent | f93179d9d1cd9e2f2b3977cd7020e13f133588b2 (diff) | |
scrypted: show Wake triggers on new-device dialog + stop leaking re-register interval
#1 — Wake triggers in the new-device dialog
The "+ Add Device" form was missing the Wake triggers multi-select,
so a new viewport defaulted to the per-getter fallback of all three
(doorbell + motion + person) silently and the user only saw the
field after first edit. Now the dialog includes it up front with
all three pre-selected, and createDevice persists whatever the user
ticked into storage in the same JSON shape Viewport.putSetting uses
for subsequent edits.
#2 — Stop leaking the periodic re-register interval
Why the user was seeing the "registered ..." log line repeat 14
times in steady-state with nothing happening: Scrypted's Scripts
sandbox does NOT garbage-collect setInterval handles when a script
is re-pasted/reloaded. Every re-paste left an orphan interval
running against the previous Provider instance, accumulating one
extra timer per reload. Every 5 minutes (REREGISTER_INTERVAL_MS),
all N timers fired at once, producing N "registered ..." log lines
in rapid succession.
Fix: keep the timer handle on globalThis under a well-known key. At
script start, clearInterval the previous one (if any) before
arming the new one. Idempotent across reloads.
Diffstat (limited to 'main/state_machine.c')
0 files changed, 0 insertions, 0 deletions
