diff options
| author | Luke Hoersten <[email protected]> | 2026-06-21 11:28:04 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-21 11:28:04 -0500 |
| commit | 101fb3e28ab56361a613b7b25adab1f1f4a03483 (patch) | |
| tree | 57da45f9120d1945487e0637d1889e0bbd13fd30 /main/ota.h | |
| parent | 344843f3a3db50a8ea9f762979ae7fb780e5ad90 (diff) | |
scrypted: add OnOff alongside StartStop + lifecycle logging to identify panel binding
The 'Status and Controls' panel in @scrypted/core 0.3.147 was rendering
Unknown despite the previous commit adding StartStop. Reading the
SDK (sdk/src/index.ts:195 + plugins/core/src/script.ts:47) confirmed
how it should work:
- ScryptedDeviceBase installs Object.defineProperty getters/setters
for every interface property at runtime, so this.running = true
propagates through _lazyLoadDeviceState → getDeviceState proxy →
system state.
- Scripts plugin's mergeHandler auto-detects interfaces by mapping
method names: start/stop → StartStop, turnOn/turnOff → OnOff,
putSetting/getSettings → Settings, etc.
In theory the previous commit was sufficient. To pin down whether the
panel is calling something different (older Scrypted UIs lean toward
OnOff), this commit:
- Implements OnOff alongside StartStop. Both pairs are bound to the
same drain/bootstrap logic; whichever the panel calls, the user's
intent succeeds.
- Initialises this.running = false and this.on = false synchronously
in the constructor so the device state record carries a defined
value at registration time, instead of Scrypted defaulting to
Unknown on undefined.
- Logs 'lifecycle: X() called (...)' on every method entry. After
the user reloads + clicks STOP / START, the console will reveal
exactly which method Scrypted is invoking — or whether neither is.
If one of the methods fires, the other is dead code we can drop. If
neither fires on the panel's STOP/START button, the panel is a
Scripts-runtime control unrelated to device interfaces and we need
to look for a different lifecycle hook.
Diffstat (limited to 'main/ota.h')
0 files changed, 0 insertions, 0 deletions
