Skip to content

Abort update when device goes offline #906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,11 @@ async def _node_offline(self, node_id: int) -> None:
node_logger.info("Node considered offline, shutdown subscription")
await self._chip_device_controller.shutdown_subscription(node_id)

# inform listeners for update callbacks that this subscription is now offline
if node_id in self._attribute_update_callbacks:
for callback in self._attribute_update_callbacks[node_id]:
self._loop.create_task(callback(None, None, None))

# mark node as unavailable (if it wasn't already)
self._node_unavailable(node_id)

Expand Down
6 changes: 6 additions & 0 deletions matter_server/server/ota/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ async def check_update_state(
) -> None:
"""Check the update state of a node and take appropriate action."""

if path is None:
self._ota_done.set_exception(
UpdateError("Device went offline during OTA update")
)
return

if str(path) != OTA_SOFTWARE_UPDATE_REQUESTOR_UPDATE_STATE_ATTRIBUTE_PATH:
return

Expand Down