I tried that. I am using Mosquitto 3.1 as a broker and confirmed it will support QoS levels because I have sent some messages and seen in the diagnostic output that the QoS flag is set correctly. I used mqtt-spy to Publish the message. I am not seeing any messages from the device I used the test code on or my own code. If I remove the QoS reference then it works fine, just no QoS setting.