project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.33k stars 1.97k forks source link

chip-tool requires Ethernet/WiFi #27167

Open venlx opened 1 year ago

venlx commented 1 year ago

I have a Raspberry Pi configured as a Thread Border Router and I have an Eve Smartplug (Thread over Matter). I can only connect the Smartplug to my Thread Network via chip-tool when there is a connected Ethernet cable to the Raspberry Pi otherwise it fails. Is this a restriction of the chip-tool or do I generally require an Ethernet/WiFi connection to be able to connect devices even though I'm only using Thread devices?

bzbarsky-apple commented 1 year ago

I can only connect the Smartplug to my Thread Network via chip-tool

@venlx Which device is chip-tool running on? And what is the exact chip-tool command being used?

Please also attach (ideally not paste) a log from the failure.

venlx commented 1 year ago

@bzbarsky-apple It is on the Raspberry Pi.

bzbarsky-apple commented 1 year ago

@venlx Please answer all the questions I asked.

venlx commented 1 year ago

I used the following command: sudo ./out/debug/standalone/chip-tool pairing code-thread 12 hex:0e080000000000010000000300001535060004001fffe00208088bf37a4a632ccc0708fdb466b36a9f5892051011223344556677889900aabbccddeeff030f4f70656e5468726561642d333439640102349d041090db5bc5927feeeaac3449f306170c050c0402a0f7f8 MT:-AM142O614LC.17NQ00 --paa-trust-store-path credentials/production/paa-root-certs/ (from the directory: /home/user/connectedhomeip)

log.txt

bzbarsky-apple commented 1 year ago

OK, so the key part is this:

[1686662644.061056][25144:25147] CHIP:DIS: OperationalSessionSetup[1:000000000000000C]: operational discovery failed: src/lib/address_resolve/AddressResolve_DefaultImpl.cpp:114: CHIP Error 0x00000032: Timeout

Are you using minimal mdns or platform mdns for chip-tool? Do you have avahi installed on this raspberry pi? Does avahi see the operational advertisements in the condition when commissioning fails?

venlx commented 1 year ago

How can I check if I'm using minimal mdns or platform mdns? I have avahi installed. I tried to use avahi-browse --all --resolve but it didn't see anything. Is that the right command to use or should I use something else?

bzbarsky-apple commented 1 year ago

How can I check if I'm using minimal mdns or platform mdns

How did you compile chip-tool?

As far as avahi goes... I am not sure what the right commands are to get this information, unfortunately.

venlx commented 1 year ago

How did you compile chip-tool? I just used ./gn_build.sh

bzbarsky-apple commented 1 year ago

OK, so you are using minimal mdns, I believe. @andy31415 can you confirm that's what happens on Linux by default? Also, any idea why operational discovery is failing in this case?

andy31415 commented 1 year ago

You could try to see what wireshard shows in terms of advertisemens for dnssd.

My guess is that since you have no wifi/ethernet interfaces, there are no packets going on the dnssd multicast addresses, so nothing will reply back.

You need chip-tool (which is not a thread-aware application) to be able to figure out dnssd data from thread devices (which goes over SRP I believe). This is generally done by the thread border router replying to DNSSD queries ... but it seems you are unable to query because you have no network interfaces to work with.

Maybe you could get it to work by setting up some local-only loopback networks or something. This is the first time I hear about such a setup though.

andy31415 commented 1 year ago

You can also try with platform dns configuration to see if avahi somehow manages to see these services (e.g. I am not sure how the thread border router does mdns ... if it uses avahi, maybe it just works because it would have avahi as a central shared registration and query source)

andy31415 commented 1 year ago

I would also recommend not using gn_build.sh, use scripts/buid/build_examples.py.

Examples for building chip-tool:

./scripts/build/build_examples.py --target linux-arm64-chip-tool build

With platform mdns:

./scripts/build/build_examples.py --target linux-arm64-chip-tool-platform-mdns build
bzbarsky-apple commented 1 year ago

If you do use gn_build.sh, you can do gn_build.sh 'chip_mdns="platform"' to test.