Upgrading an old fan with Sonoffs

I’m new to Smartthings. I want to take an old fan that has multiple speeds and automate it for a few purposes. I would like to be able to turn it on its lowest setting with out having to get up out of bed. The one problem I have is that the speed is controlled by a momentary button( 1 click the fan turns on high, 2nd click med, 3rd click low, 4th off).

My initial thought for the solution would be to just use sonoff SV for the momentary button to toggle thru the different speeds. After thinking about what use cases I have I want to be able to have a scene that turns the lights off and turns the fan to the lowest setting.

So my next thought was to incorporate a sonoff Basic to control the main power. This way I can ensure its lowest setting by turning the power of the fan off then on then use the SV to cycle thru multiple phases.

I am new to writing code in within SmartThings and have used the ESPeasy frimware on a Sonoff SV for a past project but am a little unsure of the best way to approach this coding for this project.

If you only have 3 speeds, couldn’t you use GE’s zwave plus fan controller (assuming you have the space for it)? You’d still be able to manually control the device, as well as through SmartThings. That way you can use the device with ST’s built-in automations and Scenes (or Routines if using Classic), or the more powerful webCore smartapp. You won’t have to develop any custom code, and the only thing you’d have to fiddle with is webCore if you went that route.

BTW - Welcome to ST and the Community!

It doesn’t matter how many speeds your fan has to start with; if you use the GE controller, it will give you three speeds, and if you use the Home Depot Wink controller it will give you four. Each independently controls the voltage supplied to the motor (which you would typically set to the highest speed using the internal controls).
Since you mentioned clicks and getting out of bed, it sounds like you may have an existing fan controller with a wall control. If it’s also from Home Decorators, there’s a good chance you could swap the Wink controller into the canopy and keep using the same wall controller in addition to the included handheld remote by setting the DIP switches to match. Just a thought…