matter-python-client 1.3.3__py3-none-any.whl → 1.4.0a0.dev20260802__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matter-python-client
3
- Version: 1.3.3
3
+ Version: 1.4.0a0.dev20260802
4
4
  Summary: Python Client for the OHF Matter Server
5
5
  Author-email: Open Home Foundation <hello@openhomefoundation.io>
6
6
  License-Expression: Apache-2.0
@@ -155,7 +155,7 @@ chip/tlv/tlvlist.py,sha256=ZpT6Hr6t3qDHiUZWkY4WnioVP2icv5i5LIKNUIgOOps,2469
155
155
  matter_server/__init__.py,sha256=lJ6xyVLSMGtiHvq36VPSDb75ksxfNKYmKEEE-ZwJdhQ,47
156
156
  matter_server/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
157
157
  matter_server/client/__init__.py,sha256=pZzjJp-7C5BmYGZJjIo5SpyjGLU0FcqBa2nJ558y-Is,97
158
- matter_server/client/client.py,sha256=ACyJ0JjEiM7brGa18RBeF-6iJRzp1QKcGZuPEo3r5Ak,36917
158
+ matter_server/client/client.py,sha256=YMi7f6zBOjaU-nVsWnuyeulPr1h6rLAaDpOC6DJly5o,38113
159
159
  matter_server/client/connection.py,sha256=oMZ3Ia8Z5GxnYawBJDkBKJX-icTwd0vX1vgfvouFaTk,6246
160
160
  matter_server/client/exceptions.py,sha256=741JkGMBQFJYZ70zX80B-Dn_NtgHffb6jDHC83tCL2U,1901
161
161
  matter_server/client/models/__init__.py,sha256=pT16UC2evZVw2trjun2xJZpaOR55ky7i_8znlA3Mreo,63
@@ -165,12 +165,12 @@ matter_server/common/__init__.py,sha256=y4EeCH05sUYifS2b624oweA6omnY5k-rLNHHv4t4
165
165
  matter_server/common/const.py,sha256=hTu0siAgpQvAz6oYavTGuqgkXaQH2glQxUQuGyPnn1o,256
166
166
  matter_server/common/custom_clusters.py,sha256=Zr9zLdijaMbPGZ0879oB1NxwYj_oXNM6xKtZB_dcTug,1227
167
167
  matter_server/common/errors.py,sha256=idK30d48jZPm6zw9TJjHbBccz3oOgpB_W3SJaGNsj5g,3461
168
- matter_server/common/models.py,sha256=hpR30aXn8ON2rpCjsPCo6eicifImdEr3pSj0KcyluWg,9635
168
+ matter_server/common/models.py,sha256=cveUE4r_O7IbmojGV8sYHZeVnCbH1saw_Trv202M2SU,11869
169
169
  matter_server/common/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
170
170
  matter_server/common/helpers/api.py,sha256=9maToXRnef6SLGnecaTSBlWU7wDSG3elil-HtffQ2TA,1993
171
171
  matter_server/common/helpers/json.py,sha256=FktcqarAhmdI0AdiBwo7gCdJp6rA-uVdeNUglQv6HhA,1307
172
172
  matter_server/common/helpers/util.py,sha256=6vi945T2X14XQndhWW03Snj3yHbKALJHGU2qXCLvVFk,12948
173
- matter_python_client-1.3.3.dist-info/METADATA,sha256=EnflUtVjs6GPQPw7fOZAIGIXfbHGwGqThZ80Sx7Yje4,4398
174
- matter_python_client-1.3.3.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
175
- matter_python_client-1.3.3.dist-info/top_level.txt,sha256=qqEVT8dTHhSn15gf6otxpB5dYM48Sqsucdx9W2Lq-So,19
176
- matter_python_client-1.3.3.dist-info/RECORD,,
173
+ matter_python_client-1.4.0a0.dev20260802.dist-info/METADATA,sha256=DJT1ru3zU8NKSpyM-ohbeUC4DwTZPzhhgz54KG7Y8z4,4412
174
+ matter_python_client-1.4.0a0.dev20260802.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
175
+ matter_python_client-1.4.0a0.dev20260802.dist-info/top_level.txt,sha256=qqEVT8dTHhSn15gf6otxpB5dYM48Sqsucdx9W2Lq-So,19
176
+ matter_python_client-1.4.0a0.dev20260802.dist-info/RECORD,,
@@ -30,6 +30,7 @@ from matter_server.common.models import (
30
30
  MatterNodeEvent,
31
31
  MatterSoftwareVersion,
32
32
  MessageType,
33
+ NetworkTopology,
33
34
  NodePingResult,
34
35
  ResultMessageBase,
35
36
  ServerDiagnostics,
@@ -308,6 +309,26 @@ class MatterClient:
308
309
  """
309
310
  await self.send_command(APICommand.RESYNC_ICD, require_schema=12, node_id=node_id)
310
311
 
312
+ async def get_network_topology(self, refresh: bool = False) -> NetworkTopology:
313
+ """Return the derived network topology graph (Thread mesh + Wi-Fi).
314
+
315
+ Issuing this command also subscribes the connection to
316
+ EventType.NETWORK_TOPOLOGY_UPDATED pushes. With refresh=True the server
317
+ re-reads the Thread/Wi-Fi diagnostics from every online node before
318
+ building the snapshot (slower - seconds); otherwise it builds from the
319
+ current attribute cache.
320
+
321
+ refresh=True costs real radio traffic on every online node, so it is a
322
+ user-initiated action - never poll it. The push event is the intended
323
+ source for keeping a graph current.
324
+
325
+ Requires schema 13 (OHF Matter Server).
326
+ """
327
+ data = await self.send_command(
328
+ APICommand.GET_NETWORK_TOPOLOGY, require_schema=13, refresh=refresh
329
+ )
330
+ return dataclass_from_dict(NetworkTopology, data)
331
+
311
332
  async def open_commissioning_window(
312
333
  self,
313
334
  node_id: int,
@@ -869,6 +890,10 @@ class MatterClient:
869
890
  node_id=node_event.node_id,
870
891
  )
871
892
  return
893
+ if msg.event == EventType.NETWORK_TOPOLOGY_UPDATED:
894
+ topology = dataclass_from_dict(NetworkTopology, msg.data)
895
+ self._signal_event(EventType.NETWORK_TOPOLOGY_UPDATED, data=topology)
896
+ return
872
897
  # An event type unknown to this (older) client is passed through by parse_value as a raw
873
898
  # string; forwarding it would crash on `event.value` in _signal_event. Drop it instead so a
874
899
  # newer server emitting a new event type can never disconnect the client.
@@ -25,6 +25,7 @@ class EventType(Enum):
25
25
  ENDPOINT_REMOVED = "endpoint_removed"
26
26
  WEBRTC_CALLBACK = "webrtc_callback"
27
27
  THREAD_DIAGNOSTICS_UPDATED = "thread_diagnostics_updated" # schema 12+
28
+ NETWORK_TOPOLOGY_UPDATED = "network_topology_updated" # schema 13+
28
29
 
29
30
 
30
31
  class APICommand(str, Enum):
@@ -66,6 +67,7 @@ class APICommand(str, Enum):
66
67
  REGISTER_ICD = "register_icd"
67
68
  RESYNC_ICD = "resync_icd"
68
69
  UNREGISTER_ICD = "unregister_icd"
70
+ GET_NETWORK_TOPOLOGY = "get_network_topology"
69
71
 
70
72
 
71
73
  EventCallBackType = Callable[[EventType, Any], None]
@@ -270,6 +272,78 @@ class IcdStateData:
270
272
  next_expected_checkin: int | None
271
273
 
272
274
 
275
+ @dataclass
276
+ class TopologyDirectionInfo:
277
+ """One direction's observed link quality on a topology connection.
278
+
279
+ Note: Only available with OHF Matter Server (schema 13+).
280
+ """
281
+
282
+ strength: str
283
+ lqi: int | None = None
284
+ rssi: int | None = None
285
+
286
+
287
+ @dataclass
288
+ class NetworkTopologyNode:
289
+ """A node in the network topology graph.
290
+
291
+ `kind`/`role` values are open string sets so a newer server can
292
+ introduce values without breaking older clients.
293
+ Note: Only available with OHF Matter Server (schema 13+).
294
+ """
295
+
296
+ # pylint: disable=too-many-instance-attributes
297
+
298
+ id: str
299
+ kind: str # matter | border_router | thread_unknown | wifi_ap
300
+ network_type: str # thread | wifi | ethernet | unknown
301
+ node_id: int | None = None
302
+ role: str | None = None
303
+ available: bool | None = None
304
+ is_bridge: bool | None = None
305
+ ext_address: str | None = None
306
+ rloc16: int | None = None
307
+ ext_pan_id: str | None = None
308
+ network_name: str | None = None
309
+ vendor_name: str | None = None
310
+ model_name: str | None = None
311
+ last_seen: int | None = None
312
+
313
+
314
+ @dataclass
315
+ class NetworkTopologyConnection:
316
+ """An edge between two topology nodes.
317
+
318
+ Thread links may be asymmetric: `source_to_target`/`target_to_source` carry
319
+ each observed direction; the top-level `strength` is the strongest of them.
320
+ Note: Only available with OHF Matter Server (schema 13+).
321
+ """
322
+
323
+ source: str
324
+ target: str
325
+ network: str # thread | wifi
326
+ strength: str # strong | medium | weak | none
327
+ source_to_target: TopologyDirectionInfo | None = None
328
+ target_to_source: TopologyDirectionInfo | None = None
329
+ via_route_table: bool | None = None
330
+ path_cost: int | None = None
331
+
332
+
333
+ @dataclass
334
+ class NetworkTopology:
335
+ """Snapshot of the Matter network topology (Thread mesh + Wi-Fi).
336
+
337
+ Returned by the 'get_network_topology' command and pushed via the
338
+ 'network_topology_updated' event.
339
+ Note: Only available with OHF Matter Server (schema 13+).
340
+ """
341
+
342
+ collected_at: int
343
+ nodes: list[NetworkTopologyNode]
344
+ connections: list[NetworkTopologyConnection]
345
+
346
+
273
347
  class UpdateSource(Enum):
274
348
  """Enum with possible sources for a software update."""
275
349