How to get fan speed or direction for use in a conditional card?

I was hoping to change the available buttons in my UI based on fan speed and direction, but the fan entity doesn’t share numeric state or direction, just on-off.
Is there a trick to extract that data?

Create a template sensor based on an attribute of the fan entity.