Help needed: turning wifi radio on and off with script

I know this is a ‘late’ answer, but I better leave this here:
For anyone who is not familiar with SSH connection from HA to a router, here’s a good walkthrough: