Skip volume/source poll for off zones; lower poll frequency#2
Merged
Conversation
Crestron only responds to VOLUME/SOURCE queries when a zone is powered on. Previously we queried all three for every zone every poll, so each off zone burned COMMAND_TIMEOUT_SECONDS waiting for a response that never comes — three off zones = ~15s per poll. Now we query POWER first and only follow up with VOLUME/SOURCE when the zone is on. Also bumps POLL_INTERVAL_SECONDS 15 → 30 and tightens COMMAND_TIMEOUT_SECONDS 5 → 2 so any unexpected silence stalls less. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
cdheiser
commented
Apr 18, 2026
| source_line = await self.request(f"{zone} SOURCE") | ||
| if source_line: | ||
| zone_state["source"] = source_line.split()[-1] | ||
| # Crestron only responds to VOLUME/SOURCE when the zone is on, |
Owner
Author
There was a problem hiding this comment.
I think this is incorrect. I believe setting the source will turn the zone on. I think the logic is correct but this comment is misleading.
Owner
Author
There was a problem hiding this comment.
Good catch — dropped the misleading comment in 42249ff.
Per review: the statement that Crestron only responds to VOLUME/SOURCE when on is wrong in general — setting SOURCE as a command turns the zone on. Only the *query* behavior is what this branch exploits, and the code is self-explanatory. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
VOLUME/SOURCEqueries when a zone is powered on. Previously we queried all three every poll, so each off zone burned the full command timeout waiting for a silent reply. With 3 off zones, one poll cycle was ~15 s.POWERfirst, and only follow up withVOLUME/SOURCEwhen the zone is on. Off zones report justpower.POLL_INTERVAL_SECONDS15 → 30 (polling half as often).COMMAND_TIMEOUT_SECONDS5 → 2 so any unexpected silence stalls less.Initial refresh on startup still does the full check — if a zone is on at boot it'll pick up volume/source immediately. On transition OFF → ON, the next poll or a command-triggered
async_request_refreshwill pull volume/source.Test plan
pytest— updatedtest_poll_collects_state_for_all_zonesto assert DECK (off) emits onlyPOWERand skipsVOLUME/SOURCEwrites.ZONE POWERround-trip per poll, not three.🤖 Generated with Claude Code