Skip to content

Commit b649d5a

Browse files
committed
Raise update error if the node moves from querying to idle
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.
1 parent bb700de commit b649d5a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

matter_server/server/ota/provider.py

+10
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,21 @@ async def check_update_state(
353353
Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum, new_value
354354
)
355355

356+
old_update_state = cast(
357+
Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum, old_value
358+
)
359+
356360
# Update state of target node changed, check if update is done.
357361
if (
358362
update_state
359363
== Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kIdle
360364
):
365+
if (
366+
old_update_state
367+
== Clusters.OtaSoftwareUpdateRequestor.Enums.UpdateStateEnum.kQuerying
368+
):
369+
raise UpdateError("Target node did not process the update file")
370+
361371
LOGGER.info(
362372
"Node %d update state idle, assuming done.", self._ota_target_node_id
363373
)

0 commit comments

Comments
 (0)