Code for using mqtt with python
dont forget to install mosquitto for the broker
sudo apt-get install mosquitto mosquitto-clients
and pip for the paho-mqtt
sudo apt-get install python3-pip # for those who haven't install pip in their system
sudo pip3 install paho-mqtt
Jangan lupa mengganti id dari client ("device0" dan "device1") agar tidak terkick dari broker