|
|
@@ -2,7 +2,7 @@ import paho.mqtt.client as mqtt |
|
|
|
import json |
|
|
|
import threading |
|
|
|
import os |
|
|
|
import raspy_sensors as RaspySensors |
|
|
|
import raspy_sensors as Sensors |
|
|
|
from defines import Topics |
|
|
|
|
|
|
|
def measure_send_data(plantID, actionID, client: mqtt.Client): |
|
|
@@ -14,7 +14,7 @@ def measure_send_data(plantID, actionID, client: mqtt.Client): |
|
|
|
actionID (_type_): current ID of driving action |
|
|
|
client (mqtt.Client): current mqtt client for publishing |
|
|
|
""" |
|
|
|
sensor = RaspySensors() |
|
|
|
sensor = Sensors.RaspySensors() |
|
|
|
sensorData = sensor.readSensors() |
|
|
|
sensorData["PlantID"] = plantID |
|
|
|
sensorData["ActionID"] = actionID |
|
|
@@ -74,7 +74,7 @@ def drive_plant(clients: mqtt.Client, userdata, message: mqtt.MQTTMessage): |
|
|
|
plantID = dictMessage["PlantID"] |
|
|
|
actionID = dictMessage["ActionID"] |
|
|
|
|
|
|
|
print(f"received drive to plant {plantID}") |
|
|
|
print(f"Received Drive-request to plant {plantID}, ActionID: {actionID}") |
|
|
|
|
|
|
|
thread = threading.Thread(target= drive_plant_thread, args=(plantID, actionID, clients), daemon=True) |
|
|
|
thread.start() |