This is exposed and the fan is some sort of selector switch? The selector switch can be removed and replaced with a relay. Question is what is the hp or power draw of the fan? You’ll need a relay that is designed for an inductive load.
That would be what I would use because it’s built to work with inductive fans and that is an important distinction. In fact, I’m going to end up with a spare of those very soon as I’m replacing my Sonoff fan controller with an Inovelli Zigbee - so if you want one cheap you could buy mine, it’s already flashed with ESPHome.