Skip to content

Commit

Permalink
Process Shutdown events
Browse files Browse the repository at this point in the history
Mark the node as offline when we receive a explicit Shutdown event
from the node.

This avoids that the node remains appearing online after an update for
the full subscription report interval before realizing that the node
disappeared and subscriptions get setup again.

Most likely this helps in other cases too.
  • Loading branch information
agners committed Jun 5, 2024
1 parent e3b5f23 commit bb700de
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,9 @@ def event_callback(
)
self.event_history.append(node_event)

if isinstance(data.Data, Clusters.BasicInformation.Events.ShutDown):
asyncio.run_coroutine_threadsafe(self._node_offline(node_id), loop)

loop.call_soon_threadsafe(
self.server.signal_event, EventType.NODE_EVENT, node_event
)
Expand Down

0 comments on commit bb700de

Please sign in to comment.