mrene / esphome-openthread-poc

15 stars 1 forks source link

Can't connect to ESP. Please make sure your YAML file contains an 'api:' line. #1

Closed lboue closed 1 month ago

lboue commented 1 month ago

Hi,

I have built the firmware for the ESP32-C6 board. The connection to my Thread network works fine. Discovery works fine, however I can't add the ESPHome node running on Thread in IPv6.

image

I am getting this error: Can't connect to ESP. Please make sure your YAML file contains an 'api:' line.

image

Does it work for you?

Regards

mrene commented 1 month ago

Yes this worked fine for me. Either by using the ipv6 address or the devicename.local hostname, which should get answered by your border router.

Are you sure that you're using the off-mesh routable address?

It should be printed in the logs when you boot.

[18:50:20][W][OT SRP:102][ot_srp_main]: USING omr prefix fd31:4cc8:e352:1::/64 [18:50:20][W][OT SRP:109][ot_srp_main]: USING fd31:4cc8:e352:1:323e:278b:432d:c704 for SRP address

Can you connect to the API port with netcat? Ping the ip? Can you resolve the .local hostname?

Make sure you apply the patch to esphome too, because by default it terminates the API connection immediately because it thinks its not connected to any network.

The current implementation is also missing a few TXT records, including the one telling it to use noise for encryption, I'm not sure if this has an impact when adding the device or not, but this shouldn't affect the ability to connect from the UI.

lboue commented 1 month ago

Yes, I can see omr prefix when it boots:

23:30:42][D][esp-idf:000][ot_cli_main]: I (541) OT_STATE: Set dns server address: FD15:72B:A075:FFFF::808:808
[23:30:42]
[23:30:42][W][OT SRP:102][ot_srp_main]: USING omr prefix fdac:925b:5d83:1::/64
[23:30:42][W][OT SRP:109][ot_srp_main]: USING fdac:925b:5d83:1:b50d:7dd9:b3c1:3c25 for SRP address
[23:30:43][D][esp-idf:000][ot_cli_main]: W(929) OPENTHREAD:
[23:30:43][D][esp-idf:000][ot_cli_main]: [W] Mle-----------: Failed to process UDP: Duplicated
[23:30:43][D][esp-idf:000][ot_cli_main]: 
[23:30:43]
[23:30:43]> [D][esp-idf:000][ot_cli_main]: W(1675) OPENTHREAD:
[23:30:43][D][esp-idf:000][ot_cli_main]: [W] Mle-----------: Failed to process UDP: Duplicated
[23:30:43][D][esp-idf:000][ot_cli_main]: 
[23:30:43]
[23:30:43][D][esp-idf:000][ot_cli_main]: W(1680) OPENTHREAD:
[23:30:43][D][esp-idf:000][ot_cli_main]: [W] Mle-----------: Failed to process UDP: Duplicated
[23:30:43][D][esp-idf:000][ot_cli_main]: 
[23:30:43]
[23:30:44][D][esp-idf:000][ot_cli_main]: I(2825) OPENTHREAD:
[23:30:45][D][esp-idf:000][ot_cli_main]: [N] MeshForwarder-: Dropping (reassembly queue) IPv6 UDP msg, len:218, chksum:fcf9, ecn:no, sec:yes, error:ReassemblyTimeout, prio:net, rss:-91.0
[23:30:45][D][esp-idf:000][ot_cli_main]: 
[23:30:45]
[23:30:45][D][esp-idf:000][ot_cli_main]: I(2826) OPENTHREAD:
[23:30:45][D][esp-idf:000][ot_cli_main]: [N] MeshForwarder-:     src:[fe80:0:0:0:280c:21f9:9937:5ce9]:19788
[23:30:45][D][esp-idf:000][ot_cli_main]: 
[23:30:45]
[23:30:45][D][esp-idf:000][ot_cli_main]: I(2827) OPENTHREAD:
[23:30:45][D][esp-idf:000][ot_cli_main]: [N] MeshForwarder-:     dst:[ff02:0:0:0:0:0:0:1]:19788
[23:30:45][D][esp-idf:000][ot_cli_main]: 
[23:30:45]
[23:30:45][D][esp-idf:000][ot_cli_main]: W(2829) OPENTHREAD:
[23:30:45][D][esp-idf:000][ot_cli_main]: [W] DuaManager----: Failed to perform next registration: NotFound
[23:30:45][D][esp-idf:000][ot_cli_main]: 
[23:30:45]

Ping is OK too:

ping fd4f:21ef:e564:0:8789:7000:dccc:ff7b -c4
PING fd4f:21ef:e564:0:8789:7000:dccc:ff7b (fd4f:21ef:e564:0:8789:7000:dccc:ff7b): 56 data bytes
64 bytes from fd4f:21ef:e564:0:8789:7000:dccc:ff7b: seq=0 ttl=255 time=19.949 ms
64 bytes from fd4f:21ef:e564:0:8789:7000:dccc:ff7b: seq=1 ttl=255 time=27.754 ms
64 bytes from fd4f:21ef:e564:0:8789:7000:dccc:ff7b: seq=2 ttl=255 time=75.650 ms
64 bytes from fd4f:21ef:e564:0:8789:7000:dccc:ff7b: seq=3 ttl=255 time=37.012 ms

--- fd4f:21ef:e564:0:8789:7000:dccc:ff7b ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 19.949/40.091/75.650 ms

logs_OT_C6.txt

lboue commented 1 month ago

When I try to connect from HA UI I am getting this:

[01:14:03][D][api:102]: Accepted FD4F:21EF:E564:0:21ED:86DB:49B5:B32
[01:14:03][W][api.connection:078]: : Network unavailable, disconnecting
[01:14:03][W][component:170]: Component api cleared Warning flag
[01:14:03][W][component:157]: Component api set Warning flag: unspecified
[01:14:06][D][api:102]: Accepted FD4F:21EF:E564:0:21ED:86DB:49B5:B32
[01:14:06][W][api.connection:078]: : Network unavailable, disconnecting
[01:14:06][W][component:170]: Component api cleared Warning flag
[01:14:06][W][component:157]: Component api set Warning flag: unspecified
[01:14:14][D][api:102]: Accepted FD4F:21EF:E564:0:21ED:86DB:49B5:B32
[01:14:14][W][api.connection:078]: : Network unavailable, disconnecting
[01:14:14][W][component:170]: Component api cleared Warning flag
[01:14:14][W][component:157]: Component api set Warning flag: unspecified

What's the easiest way to apply this patch?

mrene commented 1 month ago

When I try to connect from HA UI I am getting this:


[01:14:03][D][api:102]: Accepted FD4F:21EF:E564:0:21ED:86DB:49B5:B32

[01:14:03][W][api.connection:078]: : Network unavailable, disconnecting

[01:14:03][W][component:170]: Component api cleared Warning flag

[01:14:03][W][component:157]: Component api set Warning flag: unspecified

[01:14:06][D][api:102]: Accepted FD4F:21EF:E564:0:21ED:86DB:49B5:B32

[01:14:06][W][api.connection:078]: : Network unavailable, disconnecting

[01:14:06][W][component:170]: Component api cleared Warning flag

[01:14:06][W][component:157]: Component api set Warning flag: unspecified

[01:14:14][D][api:102]: Accepted FD4F:21EF:E564:0:21ED:86DB:49B5:B32

[01:14:14][W][api.connection:078]: : Network unavailable, disconnecting

[01:14:14][W][component:170]: Component api cleared Warning flag

[01:14:14][W][component:157]: Component api set Warning flag: unspecified

What's the easiest way to apply this patch?

Follow the instructions as if you were setting up to dev on esphome and apply it with patch -p1 -I file.diff (or change the single line it changes manually)

lboue commented 1 month ago

Thanks. It works now:

image