Receiving UDP

hi,
I’m using Home Assistant core, with docker development (also tried on RPI 4).
To add a simple UDP echo server using https://docs.python.org/3.5/library/asyncio-protocol.html#udp-echo-server-protocol
Whatever every I do I cannot seems to get UDP packets in, only out.

using a TCP echo server works fine, after i used “forwardPorts”: [8888, 9999] inside devcontainer.json
i read the thread Receiving UDP traffic and try to use the sensor and it seems it is not working as well.

Can anyone help

Lior

Hi,

(Did you intend to send the message to the community or only to me privately, as it appears to be?)

I can just say that, as suggested in one of my comments in that thread, you have to make sure that UDP traffic can be forwarded to the container. I’m not sure how you’re configuring your docker environment (I don’t know about this devcontainer.json file), but definitely it is possible to get UDP traffic delivered to the HA container.

Hope this helps,
Giuseppe

was intended for the entire community.
I found that it is docker config issue because using RPI is working.

I took from github the homeassistant/core version which comes with .devcontainer folder
inside that folder there is a devcontainer.json which is a setting for VSCode IDE.

any idea how to config docker to work?
my system is windows 10 + WSL2 + Docker with ha/core

Thanks

OK, probably worth posting a message in the forum, especially as you’re seeking advice for specifically running HA in WSL2 + docker.

I’d personally use the docker command line, at least it’s guaranteed to be standard (and e.g. the --net=host argument is supposed to work), not any other “uncontrolled” configuration file. My arguments look like (among others):

docker run -d -p 8123:8123/tcp -p 3200:3200/udp --name="homeassistant" --net=host <thedockerimage>

where I explicitly map the UDP port 3200 on top of the TCP port 8123 for the web server.

yes, but how do attach VSCode after with debugger.
after I use the standard running command, if I will open the VSCode it will autorun a different container

the devcotainer.json is Microsoft

ok, finally solved it.
u must add the UDP port you need to the app port like this.
“appPort”: [8123, “9999:9999/udp”]

you must rebuild the container after this.
than everything works