Custom UI with Buttons - Fan Control

hey buddy, is there a way to ‘intercept’ the speeds, and have them turn on a switch. not great on the code side.

i have fan power running through a z-wave in wall microcontroller
and the fan speeds i used this RF Ceiling Fan Remote Hack

so on off is one switch, and the speeds translate to turning on a different switch for each speed.

thanks in advance