def set_percentage(self, percentage: int):
        """Set the speed of the fan, as a percentage."""
        if percentage == 0:
            return self.turn_off()
        return self.turn_on(percentage=percentage)
Set the speed of the fan, as a percentage.
custom_components/xiaomi_miot/fan.py