Sending infrared over mqtt error

Use sprintf(). You don't need to format the number to anything else because to the Arduino a number is just a number. Hex, octal or binary are just human readable representations.