From 9acb99ba3f23aebf48c8c82f148f6cd3441d4efa Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Mon, 15 Jun 2026 08:52:10 -0500 Subject: scrypted: render wake/sleep as boolean toggles instead of unrendered buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit type:"button" Settings get silently dropped by Scrypted's renderer — they were in the model but never appeared in the UI. Switch both to type:"boolean" so they show as toggles. The toggle acts as a one-shot trigger: flipping it on fires the wake/sleep action and the next getSettings() call returns value:false so it's armed again. --- scrypted/scrypted-viewport.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'scrypted') diff --git a/scrypted/scrypted-viewport.ts b/scrypted/scrypted-viewport.ts index 693a2a6..8473c31 100644 --- a/scrypted/scrypted-viewport.ts +++ b/scrypted/scrypted-viewport.ts @@ -190,15 +190,17 @@ class Viewport extends ScryptedDeviceBase implements Settings { group: "Actions", key: "action_wake", title: "Wake now", - description: "POST /state {wake} to the device — turns the panel on and starts streaming the bound camera. Bypasses camera-event triggers.", - type: "button", + description: "Toggle on to POST /state {wake} and start streaming the bound camera. Resets automatically after firing.", + type: "boolean", + value: false, } as any, { group: "Actions", key: "action_sleep", title: "Sleep now", - description: "POST /state {sleep} and stop the active stream.", - type: "button", + description: "Toggle on to POST /state {sleep} and stop the active stream. Resets automatically after firing.", + type: "boolean", + value: false, } as any, ]; @@ -244,6 +246,11 @@ class Viewport extends ScryptedDeviceBase implements Settings { // Manual override from the Scrypted UI. Wake also starts a // stream so the user sees the camera immediately; Sleep // tears down the live ffmpeg and POSTs sleep. + // Boolean acts as a one-shot trigger — fire on truthy then + // re-render with the toggle cleared so it's ready to fire + // again next time. + const truthy = value === true || value === "true"; + if (!truthy) return; if (!this.host) return; if (key === "action_wake") { if (!this.provider.streams.has(this.name) && -- cgit v1.2.3