Skip to content

feat(ws-controller): network topology service + get_network_topology API (schema 13)#832

Draft
MindFreeze wants to merge 1 commit into
matter-js:mainfrom
MindFreeze:matter-network-topology-service
Draft

feat(ws-controller): network topology service + get_network_topology API (schema 13)#832
MindFreeze wants to merge 1 commit into
matter-js:mainfrom
MindFreeze:matter-network-topology-service

Conversation

@MindFreeze

@MindFreeze MindFreeze commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Part of the Matter network visualization work for OpenHomeFoundation roadmap #210. Follows #829 (the shared topology-derivation extraction), which this builds on.

Derives the full Matter network graph (Thread mesh + Wi-Fi star) server-side and exposes it over the WebSocket API, so downstream consumers (Home Assistant core / frontend) can relay a ready-made topology instead of each re-deriving it from raw cluster attributes and lacking the server-only mDNS Border Router data.

What's here

  • NetworkTopologyService — builds the graph from the shared ws-client derivation pipeline plus the passively-discovered Border Router registry. Conventions mirror ThreadDiagnosticsService (injected Pick<> deps, an Observable event, testable without a controller). Hybrid update model: debounced change-driven rebuilds, emit-only-when-changed (hash compare excluding the timestamp), and a slow periodic rebuild for sleepy-device drift. refresh() re-reads Thread neighbor/route tables (and Wi-Fi diagnostics) from online nodes, concurrency-capped under an overall deadline.
  • get_network_topology { refresh? } command + network_topology_updated event, bumping SCHEMA_VERSION to 13 (min supported stays 11). The event is delivered only to connections that have issued the command, mirroring the schema-12 thread_diagnostics_updated opt-in so pre-13 clients never receive an event type they didn't subscribe to.
  • Wire types (NetworkTopology / node / connection, snake_case): both observed Thread link directions are preserved, with a strongest-direction summary strength for simple renderers.

Scope

This first iteration derives Thread links from the nodes' own ThreadNetworkDiagnostics (neighbor + route tables) and classifies externals against the BR registry. The richer MeshCoP diagnostic enrichment (route64 / childTable → router-to-router links and diagnostic-only mesh nodes) is a planned follow-up; the wire model already accommodates it.

@MindFreeze

Copy link
Copy Markdown
Contributor Author

I'll keep this in draft until I have tested the whole stack. May need to tweak the API

@MindFreeze
MindFreeze force-pushed the matter-network-topology-service branch 2 times, most recently from 8399375 to 8e3ec33 Compare July 9, 2026 14:24
…ogy API (schema 13)

Derive the full Matter network graph (Thread mesh + Wi-Fi star) server-side and
expose it over the WebSocket API.

- NetworkTopologyService builds the graph from the shared ws-client derivation
  pipeline plus the mDNS Border Router registry. Hybrid update model: debounced
  change-driven rebuilds, emit-only-when-changed (hash excluding collected_at),
  and a slow periodic rebuild for sleepy-device drift. refresh() re-reads Thread
  neighbor/route tables (and Wi-Fi diagnostics) from online nodes, concurrency-
  capped under an overall deadline.
- get_network_topology {refresh?} command and network_topology_updated event,
  bumping SCHEMA_VERSION to 13 (min stays 11). The event is delivered only to
  connections that have issued the command, mirroring the schema-12
  thread_diagnostics_updated opt-in so pre-13 clients never see a new event type.
- NetworkTopology / node / connection wire types (snake_case), with both observed
  Thread link directions preserved and a strongest-direction summary strength.

This first iteration derives Thread links from the nodes' own diagnostics and
classifies externals against the BR registry; the richer MeshCoP enrichment
(route64 / childTable) is a planned follow-up the wire model already accommodates.
@MindFreeze
MindFreeze force-pushed the matter-network-topology-service branch from 8e3ec33 to d46276f Compare July 9, 2026 14:32
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.

1 participant