@alzaho - Not sure what you mean by “first, you need to name the STA configure in wireless as “sta” in /etc/config/wireless”
Using the default firmware on the router and connecting through an existing wifi network should create the ‘wireless.sta’ entries.
As for timing I never had any issue with it because 5 seconds is a pretty long time really but it’s easy enough to change to personal preference. I didn’t want to take away any functions and you’re pretty limited when it comes to buttons / switches so I went with this. I agree it’s not perfect more of a starting point that in a pinch gets you out of an annoying situation.
@gjames - If you’ve got client mode and AP set-up and working from the command line ‘uci show wireless’ should tell you more about what your interfaces are called. I’ve only used the firmware supplied on my router so if it differs to yours there could be naming differences that I’m unaware of but it should be easy enough to edit the script to make it do what you need. If you post any output from that command be careful as it may contain data you don’t want to post without obscuring first.