fix: BLE entities unavailable after deep-sleep wakeup; configurable upload queue expiry#33
Merged
Conversation
Copilot
AI
changed the title
fix: accept non-connectable BLE advertisements for entity availability
fix: BLE entities unavailable after deep-sleep wakeup; configurable upload queue expiry
May 27, 2026
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:
This PR fixes a real-world deep-sleep wakeup issue for BLE OpenDisplay tags and makes deep-sleep upload handling explicit and configurable.
The key user-visible problem was: when tags woke and advertised as non-connectable, entities could remain unavailable and sensor-driven automations would not reliably trigger.
Main functional changes:
OpenDisplayBLEEntity.available now checks presence with connectable=False.
This ensures tags are considered available when they wake and emit non-connectable advertisements.
Result: sensor entities come back reliably and automations can trigger on wakeup updates.
A dedicated DeepSleepUploadQueue is used for sleeping tags so uploads are not lost or sent at the wrong time.
How it works:
Replacement semantics (important)
Queue is intentionally single-slot per tag:
Expiration semantics
Added integration option for deep-sleep queue expiry hours.
Range is validated/clamped (1–24h).
Default remains 4h.
About the broader file diff
This branch includes a few small cleanup/refactor edits outside strict deep-sleep code paths (for example removing unused imports/unused locals in some files).
These are low-risk, no-behavior-change cleanups and are left in the PR intentionally to keep the branch history intact. The deep-sleep behavior changes are still concentrated in:
Test coverage
Deep-sleep queue tests
tests/test_deep_sleep_queue.py verifies:
Availability regression tests
tests/test_ble_entity_available.py verifies:
Why this should be merged