home-assistant-libs / python-matter-server

Python server to interact with Matter
Apache License 2.0
469 stars 73 forks source link

Getting OpenThread Border Router and Matter #449

Closed olavt closed 10 months ago

olavt commented 10 months ago

I'm struggling to get OpenThread Border Router and Matter Server working on Raspberry pi 4 with Raspberry Pi OS running in Docker containers.

I have followed the OpenThread Border Router instructions here:

https://openthread.io/guides/border-router/docker

I'm using a Silicon Labs xG24-DK2601B EFR32xG24 Dev Kit as the Radio Co-Processor for OpenThread Border Router.

and the Python Matter Server instructions found here:

https://github.com/home-assistant-libs/python-matter-server

I'm able to run the OopenThread Border Router Web GUI from another computer on http::8080

I used the web interface to Form a new Thread network.

When I try to commission a Matter device using the Python Matter Server, I get the following:

{
  "fabric_id": 1,
  "compressed_fabric_id": 16427651141017523241,
  "schema_version": 5,
  "min_supported_schema_version": 5,
  "sdk_version": "2023.10.2",
  "wifi_credentials_set": false,
  "thread_credentials_set": true
}

{"message_id":"1","command":"set_thread_dataset","args":{"dataset":"0e08000000000001000035060004001fffe00708fd18324b0cd2b80f0c0402a0f7f8051000112233445566778899aabbccddeeff030e4f70656e54687265616444656d6f0410445f2b5ca6f2a93a55ce570a70efeecb000300000f0208111111112222222201021234"}}

{"message_id":"2","command":"get_nodes"}

{"message_id":"4","command":"commission_with_code","args":{"code":"34970112332"}}

{
  "message_id": "2",
  "result": []
}

{
  "message_id": "1",
  "result": null
}

{
  "message_id": "4",
  "error_code": 1,
  "details": "Commission with code failed for node 2"
}

The Matter Server log file contains:

2023-12-04 15:57:14 matter-server matter_server.server.stack[1] INFO Initializing CHIP/Matter Controller Stack...
2023-12-04 15:57:14 matter-server PersistentStorage[1] WARNING Initializing persistent storage from file: /data/chip.json
2023-12-04 15:57:14 matter-server root[1] ERROR [Errno 2] No such file or directory: '/data/chip.json'
2023-12-04 15:57:14 matter-server root[1] CRITICAL Could not load configuration from /data/chip.json - resetting configuration...
2023-12-04 15:57:14 matter-server root[1] WARNING No valid SDK configuration present - clearing out configuration
2023-12-04 15:57:14 matter-server root[1] WARNING No valid REPL configuration present - clearing out configuration
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO SetSdkKey: g/lkgt = b'\x15&\x00\x80\xa8\xbc,\x18'
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO SetSdkKey: g/gcc = b'\xcc\xda\x92\x0c'
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO SetSdkKey: g/gdc = b'\xc6<\xc1\n'
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:14 matter-server chip.DL[1] ERROR MDNS failed to join multicast group on wlan0 for address type IPv4: src/inet/UDPEndPointImplSockets.cpp:777: Inet Error 0x00000110: Address not found
2023-12-04 15:57:14 matter-server chip.DL[1] ERROR MDNS failed to join multicast group on veth0483bde for address type IPv4: src/inet/UDPEndPointImplSockets.cpp:777: Inet Error 0x00000110: Address not found
2023-12-04 15:57:14 matter-server CertificateAuthorityManager[1] WARNING Loading certificate authorities from storage...
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO SetReplKey: caList = {'1': []}
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:14 matter-server CertificateAuthority[1] WARNING New CertificateAuthority at index 1
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO SetSdkKey: ExampleOpCredsCAKey1 = b'\x04\x82\x8e\xbfo@\xe2\xd6#\xf3e&\x9d\xe3\x8d\x01\x9d\xbf\xdc\t\x93\xf7\x96gI\xa7\xf3\x8d\x15gkP\xff)\n\x8be\xca\x95#Dc\xeb\x1b\x15r\xf6UxF\xd9\xa2\x88|\xca\x1d\xb4\xe7\xbc\xa5\xd7YN\x01\xb8\x07fn\xde\xa1\x7f\x032O\xe0\x8a\xe6x\xec\x83]\xcd\xd4\x00\x00A\xc85\xe0\xd87\x8f?$dJ{'
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO SetSdkKey: ExampleOpCredsICAKey1 = b'\x04\xbd\xc4\xacaQ\xf9\xd2|\xde\x8d\x92N\xddw\xe6\xd3ryn\xc7\x83\xecIm\xda\xb5p;+\xb6Bkh\xcb\x8fX\xc6\x06\xf7!\x13\xd0tO&\xa6r\xa5\xcb\x98\xe3J\xb5\x94\x17\xe2\\\x1c\xba\xf0%\x9fe\xb1W\x15\x86&pz\x0b\x934\xce\x9e\xbf\xa1b_,#\xf0"\xda\x94\xdf\x19\xfd\xc8ATYG_/\\'
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:14 matter-server FabricAdmin[1] WARNING New FabricAdmin: FabricId: 0x0000000000000001, VendorId = 0xFFF1
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO SetReplKey: caList = {'1': [{'fabricId': 1, 'vendorId': 65521}]}
2023-12-04 15:57:14 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:14 matter-server matter_server.server.stack[1] INFO CHIP Controller Stack initialized.
2023-12-04 15:57:14 matter-server matter_server.server.server[1] INFO Starting the Matter Server...
2023-12-04 15:57:14 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetching the latest PAA root certificates from DCL.
/usr/local/lib/python3.11/site-packages/matter_server/server/helpers/paa_certificates.py:46: CryptographyDeprecationWarning: The parsed certificate contains a NULL parameter value in its signature algorithm parameters. This is invalid and will be rejected in a future version of cryptography. If this certificate was created via Java, please upgrade to JDK16+ or the latest JDK11 once a fix is issued. If this certificate was created in some other fashion please report the issue to the cryptography issue tracker. See https://github.com/pyca/cryptography/issues/8996 for more details.
  pem_certificate = x509.load_pem_x509_certificate(certificate.encode())
2023-12-04 15:57:26 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetched 115 PAA root certificates from DCL.
2023-12-04 15:57:26 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetching the latest PAA root certificates from Git.
2023-12-04 15:57:26 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetched 2 PAA root certificates from Git.
2023-12-04 15:57:26 matter-server FabricAdmin[1] WARNING Allocating new controller with CaIndex: 1, FabricId: 0x0000000000000001, NodeId: 0x000000000001B669, CatTags: []
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: ExampleCARootCert1 = b'0\x82\x01\x960\x82\x01<\xa0\x03\x02\x01\x02\x02\x01\x010\n\x06\x08*\x86H\xce=\x04\x03\x020"1 0\x1e\x06\n+\x06\x01\x04\x01\x82\xa2|\x01\x04\x0c\x1000000000000000010\x1e\x17\r210101000000Z\x17\r301230000000Z0"1 0\x1e\x06\n+\x06\x01\x04\x01\x82\xa2|\x01\x04\x0c\x1000000000000000010Y0\x13\x06\x07*\x86H\xce=\x02\x01\x06\x08*\x86H\xce=\x03\x01\x07\x03B\x00\x04\x82\x8e\xbfo@\xe2\xd6#\xf3e&\x9d\xe3\x8d\x01\x9d\xbf\xdc\t\x93\xf7\x96gI\xa7\xf3\x8d\x15gkP\xff)\n\x8be\xca\x95#Dc\xeb\x1b\x15r\xf6UxF\xd9\xa2\x88|\xca\x1d\xb4\xe7\xbc\xa5\xd7YN\x01\xb8\xa3c0a0\x0f\x06\x03U\x1d\x13\x01\x01\xff\x04\x050\x03\x01\x01\xff0\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x01\x060\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14\xf8\xf07X\x83\x0b\xa5A\xf74\xe8\xfb\xbc)\xcf;Fm\x85\xe90\x1f\x06\x03U\x1d#\x04\x180\x16\x80\x14\xf8\xf07X\x83\x0b\xa5A\xf74\xe8\xfb\xbc)\xcf;Fm\x85\xe90\n\x06\x08*\x86H\xce=\x04\x03\x02\x03H\x000E\x02 d>\xf6\\R=\x0fO\x97 \x07\xe9Z\xd2\xba\x007u\x11nz\xec\x9f\xcd\xb1m\x1e\xee>\xcd\xf1\x1a\x02!\x00\xe7\xbb\xfb\x0e)N/\xef^\xc0\xbb\x06\x18l\xc8`9\x0f\xa0\xb9\xc1\xec\xb9\xbe\xec\xa4K\xa9Ft\x88\t'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: ExampleCAIntermediateCert1 = b'0\x82\x01\x970\x82\x01<\xa0\x03\x02\x01\x02\x02\x01\x010\n\x06\x08*\x86H\xce=\x04\x03\x020"1 0\x1e\x06\n+\x06\x01\x04\x01\x82\xa2|\x01\x04\x0c\x1000000000000000010\x1e\x17\r210101000000Z\x17\r301230000000Z0"1 0\x1e\x06\n+\x06\x01\x04\x01\x82\xa2|\x01\x03\x0c\x1000000000000000020Y0\x13\x06\x07*\x86H\xce=\x02\x01\x06\x08*\x86H\xce=\x03\x01\x07\x03B\x00\x04\xbd\xc4\xacaQ\xf9\xd2|\xde\x8d\x92N\xddw\xe6\xd3ryn\xc7\x83\xecIm\xda\xb5p;+\xb6Bkh\xcb\x8fX\xc6\x06\xf7!\x13\xd0tO&\xa6r\xa5\xcb\x98\xe3J\xb5\x94\x17\xe2\\\x1c\xba\xf0%\x9fe\xb1\xa3c0a0\x0f\x06\x03U\x1d\x13\x01\x01\xff\x04\x050\x03\x01\x01\xff0\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x01\x060\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14\xdc\x1f\xb4\x17&M\xead\x97\x97=i=\'m\x91\xd1\x186\x100\x1f\x06\x03U\x1d#\x04\x180\x16\x80\x14\xf8\xf07X\x83\x0b\xa5A\xf74\xe8\xfb\xbc)\xcf;Fm\x85\xe90\n\x06\x08*\x86H\xce=\x04\x03\x02\x03I\x000F\x02!\x00\xe6E\x08\x8c\xad\xda\x0e\xc5vG\x05\x84\xac\x98i\xb7\x943\x95\x8b\x1dHh\xea \xea\xff\x8d\xf4:\xd7\x97\x02!\x00\xfekkH\x03\xc1\x80t\xfe\rU\xde\xb7\x99\xf51{T\xb62\x9dE\xe3\x9ey\x96\x01+\x0b\x0f.\x06'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: g/fs/c = b'\x15$\x00\x01)\x01\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: f/1/m = b'\x15%\x00\xf1\xff,\x01\x00\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: f/1/n = b'\x150\x01\x01\x01$\x02\x017\x03$\x13\x02\x18&\x04\x80"\x81\'&\x05\x80%M:7\x06$\x15\x01&\x11i\xb6\x01\x00\x18$\x07\x01$\x08\x010\tA\x04\xde\xa0\'\x9b#\xc9e\x14\x05DW1l\x8d\xdc@\xfbt\xf9\xea\xd7\xef \xe0\xe1\x1e_\xf5\x0b\xb2\xeb \xa4!26/\x01\xee\xe4\x8b\x17\x88\x9e/\xa1\x96\x91\xb9\xd4~e<~\x7f\x14\xad~=\xad\x939\x87\xeb7\n5\x01(\x01\x18$\x02\x016\x03\x04\x02\x04\x01\x180\x04\x14\x91\x9es\x92L\xa4Qjd\xd0\x15O9\xa9t+\x1f\x01\xad;0\x05\x14\xdc\x1f\xb4\x17&M\xead\x97\x97=i=\'m\x91\xd1\x186\x10\x180\x0b@\xe8\xfc>\xc0\x1b\xa6\xec\xe1\xf1!\x9d&+Kw/\x17\x8dl\xa0\x9b\x91(\x9c\xfa\x9f\xc7\xb3\x8b\x1f2w6\xa8\x1c\xc6i\x03\x8b\xdc\x01ik\xa3\x10\xf80\x8b<\x80$\xccE]\x83h\xffT\xf8=\x86\xa7\'\xd7\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: f/1/i = b'\x150\x01\x01\x01$\x02\x017\x03$\x14\x01\x18&\x04\x80"\x81\'&\x05\x80%M:7\x06$\x13\x02\x18$\x07\x01$\x08\x010\tA\x04\xbd\xc4\xacaQ\xf9\xd2|\xde\x8d\x92N\xddw\xe6\xd3ryn\xc7\x83\xecIm\xda\xb5p;+\xb6Bkh\xcb\x8fX\xc6\x06\xf7!\x13\xd0tO&\xa6r\xa5\xcb\x98\xe3J\xb5\x94\x17\xe2\\\x1c\xba\xf0%\x9fe\xb17\n5\x01)\x01\x18$\x02`0\x04\x14\xdc\x1f\xb4\x17&M\xead\x97\x97=i=\'m\x91\xd1\x186\x100\x05\x14\xf8\xf07X\x83\x0b\xa5A\xf74\xe8\xfb\xbc)\xcf;Fm\x85\xe9\x180\x0b@\xe6E\x08\x8c\xad\xda\x0e\xc5vG\x05\x84\xac\x98i\xb7\x943\x95\x8b\x1dHh\xea \xea\xff\x8d\xf4:\xd7\x97\xfekkH\x03\xc1\x80t\xfe\rU\xde\xb7\x99\xf51{T\xb62\x9dE\xe3\x9ey\x96\x01+\x0b\x0f.\x06\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: f/1/r = b'\x150\x01\x01\x01$\x02\x017\x03$\x14\x01\x18&\x04\x80"\x81\'&\x05\x80%M:7\x06$\x14\x01\x18$\x07\x01$\x08\x010\tA\x04\x82\x8e\xbfo@\xe2\xd6#\xf3e&\x9d\xe3\x8d\x01\x9d\xbf\xdc\t\x93\xf7\x96gI\xa7\xf3\x8d\x15gkP\xff)\n\x8be\xca\x95#Dc\xeb\x1b\x15r\xf6UxF\xd9\xa2\x88|\xca\x1d\xb4\xe7\xbc\xa5\xd7YN\x01\xb87\n5\x01)\x01\x18$\x02`0\x04\x14\xf8\xf07X\x83\x0b\xa5A\xf74\xe8\xfb\xbc)\xcf;Fm\x85\xe90\x05\x14\xf8\xf07X\x83\x0b\xa5A\xf74\xe8\xfb\xbc)\xcf;Fm\x85\xe9\x180\x0b@d>\xf6\\R=\x0fO\x97 \x07\xe9Z\xd2\xba\x007u\x11nz\xec\x9f\xcd\xb1m\x1e\xee>\xcd\xf1\x1a\xe7\xbb\xfb\x0e)N/\xef^\xc0\xbb\x06\x18l\xc8`9\x0f\xa0\xb9\xc1\xec\xb9\xbe\xec\xa4K\xa9Ft\x88\t\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: g/lkgt = b'\x15&\x00\x80\xa8\xbc,\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: g/fidx = b'\x15$\x00\x026\x01\x04\x01\x18\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO DeleteSdkKey: g/fs/c
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: f/1/k/0 = b'\x15$\x01\x00$\x02\x016\x03\x15$\x04\x00%\x05FB0\x06\x10N&\x06\x11\xc0\xc8\xaf\tk\x10\xd7{tQ\xf8\x8a\x18\x15$\x04\x00$\x05\x000\x06\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x15$\x04\x00$\x05\x000\x06\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x18%\x07\xff\xff\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: g/gfl = b'\x15$\x01\x01$\x02\x01\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO SetSdkKey: f/1/g = b'\x15$\x01\x00$\x02\x00$\x03\x00$\x04\x00$\x05\x00$\x06\x01$\x07\x00\x18'
2023-12-04 15:57:26 matter-server PersistentStorage[1] INFO Committing...
2023-12-04 15:57:26 matter-server matter_server.server.vendor_info[1] INFO Loading vendor info from storage.
2023-12-04 15:57:26 matter-server matter_server.server.vendor_info[1] INFO Loaded 0 vendors from storage.
2023-12-04 15:57:26 matter-server matter_server.server.vendor_info[1] INFO Fetching the latest vendor info from DCL.
2023-12-04 15:57:26 matter-server matter_server.server.vendor_info[1] INFO Fetched 100 vendors from DCL.
2023-12-04 15:57:26 matter-server matter_server.server.vendor_info[1] INFO Saving vendor info to storage.
2023-12-04 16:03:26 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetching the latest PAA root certificates from DCL.
2023-12-04 16:03:27 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetched 0 PAA root certificates from DCL.
2023-12-04 16:03:27 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetching the latest PAA root certificates from Git.
2023-12-04 16:03:27 matter-server matter_server.server.helpers.paa_certificates[1] INFO Fetched 0 PAA root certificates from Git.
2023-12-04 16:03:35 matter-server chip.-[1] ERROR src/inet/UDPEndPointImplSockets.cpp:417: OS Error 0x02000065: Network is unreachable at src/app/OperationalSessionSetup.cpp:226
2023-12-04 16:03:35 matter-server chip.CTL[1] ERROR Failed to perform commissioning step 26
2023-12-04 16:03:35 matter-server matter_server.server.client_handler[1] ERROR [547544360656] Error handling message: CommandMessage(message_id='4', command='commission_with_code', args={'code': '34970112332'})
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/matter_server/server/client_handler.py", line 188, in _run_handler
    result = await result
             ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/matter_server/server/device_controller.py", line 167, in commission_with_code
    raise NodeCommissionFailed(
matter_server.common.errors.NodeCommissionFailed: Commission with code failed for node 1
2023-12-04 16:03:37 matter-server chip.CTL[1] ERROR Commissioning discovery over BLE failed: src/platform/Linux/bluez/ChipDeviceScanner.cpp:173: CHIP Error 0x00000032: Timeout
2023-12-04 16:03:37 matter-server chip.-[1] ERROR src/platform/Linux/bluez/ChipDeviceScanner.cpp:173: CHIP Error 0x00000032: Timeout at src/controller/SetUpCodePairer.cpp:324
2023-12-04 16:03:37 matter-server chip.BLE[1] ERROR BLE scan error: src/platform/Linux/bluez/ChipDeviceScanner.cpp:173: CHIP Error 0x00000032: Timeout
marcelveldt commented 10 months ago

No user support here. For support for your (officially unsupported) configuration, use the discord server of Home Assistant to get help.