Skip to content

Add MQTT screensaver command (#54)#77

Merged
starbrightlab merged 1 commit into
mainfrom
topic/mqtt-screensaver-command
Jun 24, 2026
Merged

Add MQTT screensaver command (#54)#77
starbrightlab merged 1 commit into
mainfrom
topic/mqtt-screensaver-command

Conversation

@starbrightlab

Copy link
Copy Markdown
Owner

Closes #54.

Home Assistant could already watch immortal/<id>/screen/state (off / interactive / dreaming) and wake/sleep via screen_power, but there was no way to command the screensaver to start. This adds a Screensaver button entity at immortal/<id>/screensaver/set that shows the photo frame on demand.

What it does

On press, the handler launches PhotoFramePreviewActivity — the exact same photo-frame surface the launcher's header screensaver button opens (HomeActivity.onStartScreensaver). It mirrors the existing go_home command branch and the button() discovery pattern.

Design notes

  • This shows the in-app photo frame as a foreground Activity, not the system dream — the same thing the header button does. So it's consistent with existing in-app behaviour: screen/state stays interactive while the frame is showing, and the existing go_home command dismisses it.
  • We deliberately don't try to start the literal system dream. There's no public API; the only routes are SystemUI's Somnambulator activity or IDreamManager.dream() via reflection, both device-fragile on the Portal's Android 9/10. The author of [Feature] MQTT command to trigger the screensaver/dream on demand #54 anticipated this ("no DreamManager/Somnambulator workaround needed") — reusing the photo-frame activity is exactly that clean internal path.

Scope

Start-only button (matches the issue's "ON starts the dream now"); stop is already covered by go_home. Image-fetch hardening and any "report dreaming state" wiring are out of scope here.

Builds clean; unit suite passes locally.

🤖 Generated with Claude Code

Resolves the request in #54 for a way to *command* the screensaver from
Home Assistant (previously HA could only observe screen/state, not start
the frame).

Adds a `Screensaver` button entity at `immortal/<id>/screensaver/set`.
On press it launches PhotoFramePreviewActivity — the exact same photo-frame
surface the launcher's header screensaver button opens
(HomeActivity.onStartScreensaver). Mirrors the go_home command and discovery
pattern.

This shows the in-app photo frame as a foreground Activity, not the system
dream, so it's consistent with the header button: screen/state stays
"interactive" while showing, and go_home dismisses it. We deliberately don't
attempt to start the system dream (no public API; Somnambulator/IDreamManager
reflection is device-fragile on the Portal's Android 9/10).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@starbrightlab starbrightlab merged commit 697b6de into main Jun 24, 2026
3 checks passed
@starbrightlab starbrightlab deleted the topic/mqtt-screensaver-command branch June 24, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] MQTT command to trigger the screensaver/dream on demand

1 participant