The custom driver linked above is a good suggestion. My post on that thread links to the code for my version I use on several ceiling fans. We only use the top 3 speeds out of the 4 the device supports (because the lowest speed is garbage on our fans)…and my version supports doing that which also lets Alexa/HomeKit integration as a 3-speed fan work properly (nobody in this house wants to ask for “medium-high” speed on the fan
).
If you really only want to use the top two, I could add support for that scenario in my version.