Skip to content

Instantly share code, notes, and snippets.

@koriwi
koriwi / README.md
Created December 23, 2023 20:35
Switch to port range from random port for udp

Home Assistant UDP port range

This is a "patch" (not really for ease of use) to allow UDP communication in non-host-mode docker.

Why?

When home assistant opens a UDP port for streaming (esphome voice_assistant, media_player, etc) it just asks for a random port from the OS. Not knowing which ports will be used makes it impossible to tell your container system which ports to forward/allow.

How does it fix this?

This just adds a simple loop which tries to open a port from always the same starting port and tries to find the next open one.

Ok, tell me the range pls!

8124-8156