I am having problem in setting up mqtt fan. When change the fan speed from the UI, I notice HA will publish 2 topics simultaneously; the on command and speed command. Is there anyway to change that? I just need it to publish the speed command without the on command when I change speed.

This is not true. For a given command from the front end, HA will still publish whatever commands it is set up to publish, in this case speed and on. Optimistic mode true tells HA not to wait for an update on a state topic before changing the state in the system - eg you give the command speed 40, HA will assume the speed is 40 and the fan is on.

All the fans in my home are dumb fans with IR remote control. Right now, I use the Broadlink RM Switch component to control them. The issue is each buttons on the remote control are consider as a switch entity in HA. For example, one of the fans has 5 switches; 1 switch for on/off, 3 switches for speed (low, medium and high) and 1 switch for oscillation. It would cleaner if I can streamline it so that one fan has only one entity.

Also this should provide better control for Alexa. Right now, to change the fan speed, I have to say “Alexa, turn on low fan”. Better command should be “Alexa, set fan speed to low”.

That is why I am thinking of changing the control of my fans using the MQTT fan component.