Repository navigation
fix: wake-on-input probes real TV power state; Steam Controller can wake the TV - #15
Merged
Merged
Conversation
raise of an unnarrowed Future.exception() and a list/set variable redefinition — both pre-existing on main, tripped by the newer mypy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 4228129)
…e TV The wake gate was a bare TCP probe of the API port. QuickStart+ TVs (e.g. 2025 OLEDs) keep port 3001 accepting in Active Standby, so after a remote power-off the daemon read 'reachable => on' and never woke the TV. - DeviceSession.probe_power_state() replaces is_reachable(): a live getPowerState on the existing session, or a short-lived throwaway client (single attempt, no WoL, 3s budget, always closed). The standby register rejection (close 1008, normalized to ConnectionError) and TCP refuse/timeout both read as Unreachable => wakeable. - WakeOnInput is now a pure debouncer (cooldown + single-flight); the decision lives in Daemon._wake_if_tv_off: probe all non-busy sessions concurrently, power on only those not Active — per-session, so a TV showing another input/app is never touched, even in multi-TV setups. - KeyRejected never wakes (a WoL+connect would loop on the rejected key and every register pops an on-screen pairing prompt); it logs a re-pair hint instead. - New steam_controller.wake (default ON): controller input is reported as a key press so it may power on a fully-off TV. lgtvc setup steam-controller --wake on|off + tray checkbox; wake=off restores the old unblank-only behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With the box on and the TV powered off by its remote, no input (keyboard or controller) ever powered the TV back on.
Root causes
wake.py) was a bare TCP connect to port 3001. QuickStart+ TVs (e.g. the 2025 B4) keep that port accepting in Active Standby, so the daemon always concluded "reachable ⇒ on" and returned without waking. (In standby the TV accepts TCP but rejects the SSAP register with close 1008 "Try Again Later".)key: false(unblank-only), so the controller could never wake an off TV even with the gate fixed.Fix
DeviceSession.probe_power_state()replacesis_reachable(): livegetPowerStatewhen the session is connected, else a short-lived throwaway client (single attempt, no WoL, 3 s budget, closed infinally). Standby register-rejection and TCP refuse/timeout both map to"Unreachable"⇒ wakeable.WakeOnInputis now a pure debouncer (cooldown + single-flight). The decision moved toDaemon._wake_if_tv_off: probe all non-busy sessions concurrently, wake only those notActive— per-session, so a TV showing another input/app is never touched (a blanket power-on would have runset_hdmi_inputon Active TVs in multi-TV setups).KeyRejectednever wakes — waking would loop on the rejected key, and each register attempt pops an on-screen pairing prompt. It logs are-pair with lgtvc setup pairhint instead.steam_controller.wake(default on): controller input is reported as a key press so it can power on a fully-off TV. Caveat documented: the hidraw detector can't tell buttons from stick movement, so any genuine controller input wakes an off TV. Opt out vialgtvc setup steam-controller --wake offor the tray checkbox.Notes
persistent_connection: "off", a key press while the TV is on now opens a brief probe session at most once per cooldown window (15 s default).Tests
Daemon: Active → no wake; Active Standby → wakes (the QuickStart+ regression); Screen Off → wakes; KeyRejected → no wake; per-session (tv1 Active untouched, tv2 unreachable woken); busy skip; failure logged. DeviceSession vs FakeTv: connected live-state; connected error → closed + Unreachable; disconnected standby; close-on-register (the 1008 signature) → Unreachable; dead port; stale key → KeyRejected; throwaway never leaves the session connected. Agent: wake on/off → key true/false. CLI
--wake+ tray checkbox. 526 passed, ruff + mypy clean.🤖 Generated with Claude Code