As is, I have to be connected to that wifi in order to set Modes And Routines to automatically turn on do-not-disturb when I connect to that wifi. So I can't program my phone to turn on do-not-disturb when I connect to my gym's wifi unless I'm at the gym. Two things prevent me from doing this:
1) When I choose 'Wi-Fi network' as the condition, then choose 'Add', it only lists the one I'm currently connected to. When I click 'Add network,' I can't simply choose it off a list of saved networks, it wants me to type in the network name and password.
2) I don't remember the network name or password, and I can only find the name when I go into Settings/Connections/Wi-Fi/click the 3 dots in the top right/Advanced settings/Manage Networks. There I can see the gym's Wi-Fi SSID, but not the password I've long forgotten because I only needed it once.
So for now I'm stuck with putting a post-it note on my phone to set it up when I get to the gym Monday, or I'll be reminded when my phone disturbs my workout.
You might want a routine to turn a VPN on in that case as well when connected to it as it's a security risk.