I wanted to document an issue I discovered with Ubiquiti Toughswitches and Sonos that appears to be a Ubiquiti bug that as of April 2018 has not been fixed by Ubiquiti. I've been fighting this issue for well over a year, including working with Sonos support trying to track this down.
Short version; it appears that the Ubiquiti Toughswitch (just renamed EdgeSwitch XP) line does not properly cascade STP/RSTP in a tiered network. The Toughswitch DOES properly work with other Ubiquiti switches like the Edgeswitch line (not the XP which is just a marketing rename of the Toughswitch)
In my network there are 3 levels. A Edgeswitch 48 is the root, tier one is a combination of Toughswitch5/8s and tier 2 is more ToughSwitch5/8s.
Sonos devices plugged into the root switch or to any switch on tier 1 properly see the root as the STP root device. However any Sonos devices plugged into tier 2 do NOT see any Ubiquiti as the root device and instead promote one of the Sonos devices plugged into that level. This causes network loops since there are two distinct STP networks running at the same time.
I've reported this to Ubiquiti, but no response yet. I'm posting this here just to document the issue in case someone else runs into this.