new backend files added: main created and plantdatabase files from Makeathon extracted
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
|
||||
import paho.mqtt.client as mqtt
|
||||
from random import randrange, uniform
|
||||
import time
|
||||
|
||||
mqttBroker ="mqtt.eclipseprojects.io"
|
||||
|
||||
client = mqtt.Client("Temperature_Inside")
|
||||
client.connect(mqttBroker)
|
||||
|
||||
while True:
|
||||
randNumber = uniform(20.0, 21.0)
|
||||
client.publish("planttest", randNumber)
|
||||
print("Just published " + str(randNumber) + " to topic TEMPERATURE")
|
||||
time.sleep(0.5)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import paho.mqtt.client as mqtt
|
||||
import time
|
||||
|
||||
def on_message(client, userdata, message):
|
||||
print("received message: " ,str(message.payload.decode("utf-8")))
|
||||
|
||||
mqttBroker ="mqtt.eclipseprojects.io"
|
||||
|
||||
client = mqtt.Client("Smartphone")
|
||||
client.connect(mqttBroker)
|
||||
|
||||
client.loop_start()
|
||||
|
||||
client.subscribe("TEMPERATURE")
|
||||
client.on_message=on_message
|
||||
|
||||
time.sleep(30)
|
||||
client.loop_stop()
|
||||
Reference in New Issue
Block a user