Sonos - which ports do I need to open for auto-discovery?

You’ll likely need to open up UDP ports 32768-60999 from Sonos → HA for SSDP discovery responses. This is a side-effect of how SSDP discovery works where the response is sent back to the source port from the initial discovery message. That port is chosen from the ephemeral range. That’s also assuming that your outbound multicast packets are reaching the Sonos devices in the first place…