Skip to content

Sync Module Snooze#1274

Open
austinc3030 wants to merge 4 commits into
fronzbot:devfrom
dynacylabs:feature/sync-module-snooze
Open

Sync Module Snooze#1274
austinc3030 wants to merge 4 commits into
fronzbot:devfrom
dynacylabs:feature/sync-module-snooze

Conversation

@austinc3030

Copy link
Copy Markdown
Contributor

Description:

Adds async_snooze() and a snoozed property to BlinkSyncModule for snoozing at the network level. Uses GET to read snooze state and POST to set it via a new request_sync_snooze() API function. The snoozed property checks the snooze_till timestamp against the current time so it correctly returns False once a snooze has expired.

Checklist:

  • Local tests with tox run successfully PR cannot be meged unless tests pass
  • Changes tested locally to ensure platform still works as intended
  • Tests added to verify new code works

- Add snoozed async property to BlinkSyncModule
- Add async_snooze() method to BlinkSyncModule
- Add request_sync_snooze() API function
- Tests
Copilot AI review requested due to automatic review settings July 20, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds network-level “snooze” support for Blink sync modules by introducing an API helper to get/set snooze state and exposing it on BlinkSyncModule via an async snoozed property and async_snooze() setter, with accompanying test coverage.

Changes:

  • Added request_sync_snooze() API helper (GET to read, POST to set).
  • Added BlinkSyncModule.snoozed (async property) and BlinkSyncModule.async_snooze() to read/set snooze state.
  • Added tests covering snoozed parsing and snooze set behavior, plus API request coverage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
blinkpy/sync_module.py Adds snooze read/set surface area on BlinkSyncModule and parses snooze_till into a boolean state.
blinkpy/api.py Introduces request_sync_snooze() endpoint wrapper used by sync modules and tests.
tests/test_sync_module.py Adds unit tests for snoozed and async_snooze() behavior.
tests/test_api.py Adds unit test for the new request_sync_snooze() API helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread blinkpy/sync_module.py Outdated
Comment on lines +138 to +141
snooze_till = res.get("snooze_till")
if not snooze_till:
return False
expiry = datetime.datetime.fromisoformat(snooze_till)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in commit 8daedf5 — normalized trailing Z to +00:00 before fromisoformat(), switched snooze payload to compact JSON via indent=None, and added test_snoozed_expired and test_snoozed_z_suffix tests covering the expiry and UTC-suffix cases.

Comment thread blinkpy/sync_module.py Outdated

async def async_snooze(self, snooze_time=240):
"""Set sync snooze status."""
data = json_dumps({"snooze_time": snooze_time})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in commit 8daedf5 — normalized trailing Z to +00:00 before fromisoformat(), switched snooze payload to compact JSON via indent=None, and added test_snoozed_expired and test_snoozed_z_suffix tests covering the expiry and UTC-suffix cases.

Comment thread tests/test_sync_module.py
"""Check that we get snoozed status."""
result = await self.blink.sync["test"].snoozed
self.assertTrue(result)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in commit 8daedf5 — normalized trailing Z to +00:00 before fromisoformat(), switched snooze payload to compact JSON via indent=None, and added test_snoozed_expired and test_snoozed_z_suffix tests covering the expiry and UTC-suffix cases.

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.

2 participants