espressif / esp-matter

Espressif's SDK for Matter
Apache License 2.0
614 stars 147 forks source link

Hard to reconnect back to HomePod when power cycle (CON-825) #679

Open law-ko opened 9 months ago

law-ko commented 9 months ago

After commissioning the device and perform a power cycle (power off/power on), sometimes ESP32 cannot automatically connect back to HomePod, with the following error:

I (49741) chip[DIS]: Checking node lookup status after 45000 ms
E (49741) chip[DIS]: OperationalSessionSetup[1:7024177ECA543B43]: operational discovery failed: 32
E (49751) chip[DMG]: Failed to establish CASE for subscription-resumption with error '32'

What is the issue with this?

Environment

jonsmirl commented 9 months ago

The error is earlier in the log. It is saying it can't find the Homepod after 45s. It will print the node id earlier, something like AF67F99EAFC7087E-34C96337C2457B88 then it should be visible on the network.

My MDNS knowledge is minimal, but I believe when it boots it sends out a message asking all of the MDNS devices to identify. It should be able to get the address of the node at that time.

Use an MDNS app on your phone or command line to make sure it is advertising.

jonsmirl@ares:~$ avahi-browse --all | grep matter
+ enp3s0f1 IPv4 _IC7944E937AA07DD5                            _sub._matter._tcp    local
+ enp3s0f1 IPv4 _matter                                       _tcp                 local
+ enp3s0f1 IPv4 _I950545243CFE2D15                            _sub._matter._tcp    local
+ enp3s0f1 IPv6 950545243cfe2d15-000000002e616b1f             _matter._tcp         local
+ enp3s0f1 IPv6 AF67F99EAFC7087E-34C96337C2457B88             _matter._tcp         local
+ enp3s0f1 IPv6 472DC37BCBB11443-AB0DE0000000001B             _matter._tcp         local
+ enp3s0f1 IPv6 9CC0373667C4F408-204B50A898A38F65             _matter._tcp         local
+ enp3s0f1 IPv4 C7944E937AA07DD5-00867AF748BEBA01             _matter._tcp         local
+ enp3s0f1 IPv4 472DC37BCBB11443-AB0DE0000000001C             _matter._tcp         local
+ enp3s0f1 IPv4 AF67F99EAFC7087E-1DADD5FF42FDA442             _matter._tcp         local
+ enp3s0f1 IPv4 C7944E937AA07DD5-008462EE7296AD71             _matter._tcp         local
+ enp3s0f1 IPv4 950545243CFE2D15-00000000CF374D47             _matter._tcp         local
+ enp3s0f1 IPv4 950545243cfe2d15-000000002e616b1f             _matter._tcp         local
+ enp3s0f1 IPv4 AF67F99EAFC7087E-34C96337C2457B88             _matter._tcp         local
+ enp3s0f1 IPv4 472DC37BCBB11443-AB0DE0000000001B             _matter._tcp         local
+ enp3s0f1 IPv4 9CC0373667C4F408-204B50A898A38F65             _matter._tcp         local
+ enp3s0f1 IPv6 _matter                                       _tcp                 local
+ enp3s0f1 IPv6 _IAF67F99EAFC7087E                            _sub._matter._tcp    local
+ enp3s0f1 IPv6 _I472DC37BCBB11443                            _sub._matter._tcp    local
+ enp3s0f1 IPv4 _matterc                                      _udp                 local
+ enp3s0f1 IPv6 _IC7944E937AA07DD5                            _sub._matter._tcp    local
+ enp3s0f1 IPv6 C7944E937AA07DD5-00867AF748BEBA01             _matter._tcp         local
+ enp3s0f1 IPv6 950545243CFE2D15-00000000CF374D47             _matter._tcp         local
+ enp3s0f1 IPv6 472DC37BCBB11443-AB0DE0000000001C             _matter._tcp         local
+ enp3s0f1 IPv6 AF67F99EAFC7087E-1DADD5FF42FDA442             _matter._tcp         local
+ enp3s0f1 IPv6 C7944E937AA07DD5-008462EE7296AD71             _matter._tcp         local
+ enp3s0f1 IPv6 _I950545243CFE2D15                            _sub._matter._tcp    local
wqx6 commented 9 months ago

Could you please check whether your HomePod has operational advertisement with this command avahi-browse -rt _matter._tcp ? If the HomePod does advertise operational node, could you please capture the mdns query response of the HomePod? In my test, the HomePod will establish CASE session before the device tries to resume the subscription.

law-ko commented 8 months ago

How do I know which device is HomePod?

pi@raspberrypi:~ $ avahi-browse --all | grep matter
+   eth0 IPv4 638C92F1B94D5355-0000000002D89C24             _matter._tcp         local
+   eth0 IPv4 0459C5EAC7ADA78D-00000000D23E9BC3             _matter._tcp         local
+   eth0 IPv4 638C92F1B94D5355-000000005C60513F             _matter._tcp         local
+   eth0 IPv4 0459C5EAC7ADA78D-000000006E6CD093             _matter._tcp         local
+   eth0 IPv4 0459C5EAC7ADA78D-000000008EB20A52             _matter._tcp         local
+   eth0 IPv4 638C92F1B94D5355-0000000011277D93             _matter._tcp         local
+   eth0 IPv4 5CD79DBEC2EA81E8-02020BEAF6978151             _matter._tcp         local
+   eth0 IPv6 5CD79DBEC2EA81E8-02020BEAF6978151             _matter._tcp         local
+   eth0 IPv4 0459C5EAC7ADA78D-00000000BDEB4D57             _matter._tcp         local
+   eth0 IPv4 638C92F1B94D5355-0000000074C39B2B             _matter._tcp         local
+   eth0 IPv6 0459C5EAC7ADA78D-00000000D23E9BC3             _matter._tcp         local
+   eth0 IPv6 638C92F1B94D5355-0000000002D89C24             _matter._tcp         local
+   eth0 IPv6 0459C5EAC7ADA78D-000000006E6CD093             _matter._tcp         local
+   eth0 IPv6 638C92F1B94D5355-000000005C60513F             _matter._tcp         local
+   eth0 IPv4 0459C5EAC7ADA78D-00000000D570B3B8             _matter._tcp         local
+   eth0 IPv4 638C92F1B94D5355-00000000955CE965             _matter._tcp         local
+   eth0 IPv4 0459C5EAC7ADA78D-00000000FC814AC9             _matter._tcp         local
+   eth0 IPv4 48980451AC2007BE-0000000059979E62             _matter._tcp         local
+   eth0 IPv4 638C92F1B94D5355-000000009000A37C             _matter._tcp         local
+   eth0 IPv4 638C92F1B94D5355-7024177ECA543B43             _matter._tcp         local
+   eth0 IPv4 0459C5EAC7ADA78D-00000000C8E99552             _matter._tcp         local
+   eth0 IPv4 638C92F1B94D5355-000000001381B26D             _matter._tcp         local
jonsmirl commented 8 months ago

avahi-browse -a -r

Will give you more info. Find the homepod IP address.

avahi-browse _matter._tcp --resolve

This is mine:

= enp3s0f1 IPv6 9CC0373667C4F408-204B50A898A38F65             _matter._tcp         local
   hostname = [52F2EEC6A9E7.local]
   address = [192.168.1.81]
   port = [49322]
   txt = ["T=1"]
law-ko commented 8 months ago

Further checking the mDNS service, HomePod is active in _matter._tcp:

image

ESP32 device can also be found:

image image

If HomePod and ESP32 can both be found in mDNS, is there any other reason why it would not automatically connect back to HomePod?