Repository navigation
HomeKit: require fresh snapshots by default to prevent misleading preview ages - #2171
Closed
dougasimpson wants to merge 1 commit into
Closed
dougasimpson wants to merge 1 commit into
dougasimpson wants to merge 1 commit into
Conversation
Author
|
Would you prefer this is submitted as a discussion? Submitted here: #2172 |
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.
This change adds a global Require Fresh HomeKit Snapshots setting, enabled by default. When enabled, failed snapshot acquisition is reported as a request error, allowing Home to control its preview and age counter in order to present accurate information to the user.
The Snapshot plugin can supply HomeKit with a cached image up to one hour old for an ordinary camera. In testing, when a camera went offline, Home repeatedly displayed that cached image with a counter progressing from “Now” to approximately 11 seconds. Each successful refresh returned the same old image and reset the counter. A camera that had been offline for 45 minutes therefore appeared to have a preview only 0–11 seconds old, rather than showing its actual age.
Caching can also make the displayed age inaccurate while a camera is online: Home receives an older image successfully and treats that response as a new preview. The desired behavior is for Home's preview counter to reflect the age of its last successfully acquired image, without stale cache responses continually resetting it. The observed 11-second refresh cycle is client behavior, not a guaranteed HomeKit interval.
Fresh requests reject acquisition failures instead of returning stale images or generated “Snapshot Failed” JPEGs. Home controls whether it retains the previous preview, clears it, or displays an error.
RequestPictureOptions.requireFreshand its generated Python type.Validation:
node --test plugins/snapshot/test/fresh-snapshots.test.cjs). Host and media boundaries are mocked; actual Snapshot and HomeKit snapshot-handler sources are exercised.--forceExitoption to complete after output generation on Node 24.Live-view startup latency was not benchmarked; this change does not modify the live-stream handler.
Both HomeKit and Snapshot must include this change. Other camera providers must honor
requireFresh; the setting cannot establish the exposure time of imagery supplied by a camera or an unsupported provider.