Be very careful with 220v AC. IT CAN KILL YOU.
Now that the disclaimer is out of the way:
Recently (just a few weeks before I started playing with arduinos and other microcontrollers) I had an air curtain (basically a big, wide fan) which was a little too smart for its own good. It had two speeds (off-low-high) but the only control was by infrared remote… and it did not remember its state. If it loses power, and you wanted to get it going again, you had to use the remote. I wanted it to be powered by a door switch, so that it would be on only when the door was open. So, I had to remove the IR circuitry and power it directly.
It’s exactly the opposite of what you want to do, but here’s where my experience may apply to you.
My fan coil physically has two windings.
Power one of the windings (220v) for low speed
Power the other winding (220v again) for high speed.
Power both windings at the same time, and it probably catches on fire.
The relay board had two relays, and it would close either one of two relays, or none. Never both.
Your fan motor MAY be similar. I would guess it’s not PWM in a simple fan like that, and it can’t be a voltage divider because that would get too hot. It’s probably two separate windings. I don’t think this fan would be happy on a dimmer. Even if it worked it’s going to buzz annoyingly.
By disconnecting the fan windings from the switch, you can measure the switch and see what it does. You cannot measure while it’s wired in, because the unpowered winding will act as a generator while the fan is spinning. I made this mistake, tripped me up for a while.
Anyway… because you mustn’t power both windings at the same time, Sonoff is NOT appropriate, because (if I understand correctly) they’re simple on/off switches. For something like this (when 220v and potential fire is involved) I prefer safety to be built into the circuit.
So, I would use two 2-way relays.
One for power on/off.
The other for high/low.
This way it’s physically impossible to power both at the same time.
Finally I would control these relays by an ESP8266, which can be programmed from the Arduino environment, and it it can connect to your WiFi. You may have heard of Arduino before. It’s the easiest possible microcontroller platform for beginners. ESP8266 is a bit more complicated (it does involve wifi after all) but nothing too bad.
Now, this involves soldering, and programming, and experimentation. Heck, you may even have to buy another fan if you kill your first one. It’s a heck of a project if you’ve never done anything like it before… but I promise it’s not impossible. Who cares if it takes you a month – it’s a great skill to have, and you have a problem to solve. That’s the best possible reason to learn something new… at least for me.
Edit: The SONOFF 4 Channels Pro R2 would work, if you’re not ready to get into microcontrollers yet. It has four relays (you only need two, really) and it exposes the NO and NC (normally open/normally closed) contacts.
Something like that.