It was quite tricky to make the backend working. The dbus / network manager object model was a bit hard to understand.
The resulting stand-alone script is here
https://github.com/vikjon0/qfpynm
(the same script is used in the add-on)
EDIT: The script in the add-on was newer. I updated by copy/paste in the github edit function. If it was corrupted look for the script in the add-on instead.
That was also the fun part. I don't like to spend time on the GUI stuff.
To make a add-on in python is easy but you have to learn the GUI model. Not sure how much it has changed since this was working.
It never worked to 100% in other skins since I didn't manage to root out all dependencies to confluence. (introduced by the add-on I copied as a base)
If you dont want to spend time on the GUI you can use the above script to do the wifi from ssh.
You can also install wicd
https://wiki.archlinux.org/index.php/wicd
which has a command line interface wicd-curses
However, it is not compatible with network-manager.
So if you like python and don't want to learn kodi gui then play around with my script and skip the add-on.