Skip to content

Commit

Permalink
Raise update error if the node moves from querying to idle
Browse files Browse the repository at this point in the history
When the node's UpdateStateEnum changes from Querying to Idle it
means the update file did not get processed. This could be due to
temporary network issues or the update file not being honored by the
target node.
  • Loading branch information
agners committed Jun 5, 2024
1 parent bb700de commit b649d5a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions matter_server/server/ota/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,21 @@ async def check_update_state(
Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum, new_value
)

old_update_state = cast(
Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum, old_value
)

# Update state of target node changed, check if update is done.
if (
update_state
== Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kIdle
):
if (
old_update_state
== Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kQuerying
):
raise UpdateError("Target node did not process the update file")

LOGGER.info(
"Node %d update state idle, assuming done.", self._ota_target_node_id
)
Expand Down

0 comments on commit b649d5a

Please sign in to comment.