Open ghost58400 opened 3 months ago
The socket library doesn't support UDP on ESP8266 or pico.
Thank you for your insight, if it is normal, why is there no error message? The official components using UDP should not be marked compatible with esp8266 Ans also using the sockets library should trigger an error log if used with a custom component The documentation of cookbook sending UDP packet should also precise that esp8266 is not working with this code, users can loose a lot of time by trying this code since it doesn't work and gives no error message
I am certain that the sockets library was working on UDP esp8266 some time ago, I think that it is a regression and this explains why there is no documentation and error messages.
UDP was never working in the sockets library on 8266. There's also the WifiUDP class, but it only works on Arduino.
Hello, since esp8266 platform always uses Arduino, would it be possible to use WifiUDP inside Sockets on esp8266 platform ?
The problem
Network sockets (at least UDP) does not work anymore on esp8266 platform, but works perfectly on esp32 arduino and libretiny, it may be linked to the introduction of IPv6 recently.
Which version of ESPHome has the issue?
2024.3.0
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP8266
Board
nodemcuv2, esp8285
Component causing the issue
All components using UDP sockets (at least)
Example YAML snippet
Anything in the logs that might be useful for us?
No error during compilation and no error in logs at runtime. When using the above YAML on esp8266, nothing appears in the logs when sending a packet from an other machine :
When flashing the same code on esp32 (uncommented esp32), the logs appears with the same command, indicating that esphome receives the UDP packet :
Additional information
Tested on multiple devices including nodemcuv2, esp8285, esp32, libretiny. Esp32, both arduino and esp-idf, and libretiny works perfectly, but esp8266 (and esp8285) does not work.
Also, the code provided in https://esphome.io/cookbook/lambda_magic.html#send-udp-commands has the same behaviour as e131 UDP listener, it works on esp32 and libretiny but not on esp8266. This means that sockets (at least UDP) does not work on esp8266 platform, both in listening and sending packets.
I also tried to use the Arduino's WifiUDP library, it works well on esp8266 inside esphome, so the problem comes from socket implementation in esphome.