repository to manage all files related to the makeathon farm bot project (Software + Documentation).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mqtt_subscriber.py 377B

123456789101112131415161718
  1. import paho.mqtt.client as mqtt
  2. import time
  3. def on_message(client, userdata, message):
  4. print("received message: " ,str(message.payload.decode("utf-8")))
  5. mqttBroker ="mqtt.eclipseprojects.io"
  6. client = mqtt.Client("Smartphone")
  7. client.connect(mqttBroker)
  8. client.loop_start()
  9. client.subscribe("TEMPERATURE")
  10. client.on_message=on_message
  11. time.sleep(30)
  12. client.loop_stop()