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_publisher.py 381B

12345678910111213141516
  1. import paho.mqtt.client as mqtt
  2. from random import randrange, uniform
  3. import time
  4. mqttBroker ="mqtt.eclipseprojects.io"
  5. client = mqtt.Client("Temperature_Inside")
  6. client.connect(mqttBroker)
  7. while True:
  8. randNumber = uniform(20.0, 21.0)
  9. client.publish("planttest", randNumber)
  10. print("Just published " + str(randNumber) + " to topic TEMPERATURE")
  11. time.sleep(0.5)