hex or rgb from a MQTT message - Conversion or a better way

Initially, your thinking was wrong because you did not understand how .substring() and .toInt() work. But then you figured that out I think. In the end you must have been almost there. You said you added the +1, but I can't see where you did that.