Using windows 10 & Windows 11 (tested on Windows 11):
Click on start and type Windows features click on “Turn windows features on or off”
Make sure that both Hyper-V and Windows subsystem for linux are installed
Click on start and open “Windows Store” and search for wsl ubunty
Current version Ubuntu 20.04 would take few minutes to install
Once installed, click on start and type cmd to open command prompt
Once in command prompt type: bash to start WSL
System is ready, now Sonoff mini R2 needs to prepared
Turn off mobile data on your cell phone!!! (you might get an error if it is on and WiFi is on)
Put sonoff mini R2 into pairing mode (hold reset button for 5+ seconds) blue light should blink 3 times than pause, 3 times pause…..
Open eWeLink app on you phone and do Pairing. Once device is paired, try to switch it on and off. Device should click. Make sure that this works, then proceed
Delete device in eWeLink app, that will warn you that it will do factory reset (we need this)
Once device is deleted from eWeLink app, put it in ioT mode – press reset button for 5+ seconds, this time we need continues blink. If you get into pairing mode, just press reset for another 5 second for ioT.
Now there will be new WiFi SSID available Something like ITEPxxxxxx and some numbers
Connect to it, default password is 12345678
You should get 10.10.7.2 as IP address, device is on IP 10.10.7.1
Use web browser to connect to 10.10.7.1 and use prompt to change Wifi settings (use your regular home WiFi SSID and password)
Once changed there will be prompt that SSID configured successfully.
Find out wat is IP address of sonoff miniR2 on your LAN ( I used tool called AdvancedIPScanner, it is free)
Now back to WSL (see step 5.)
Thanks to Nicholas J Humfrey, we have script that would do this for us