I setup Tasker to do it before there was any other options but now there are apps that will handle this. I’ve not tried them because my Tasker script works perfectly but I’ve noticed this one browsing f-droid and it looks appealing: WG Auto Connect - https://f-droid.org/en/packages/de.marionoll.wgautoconnect/
deleted by creator