|
|
|
|
|
|
|
|
import json |
|
|
import json |
|
|
import threading |
|
|
import threading |
|
|
import os |
|
|
import os |
|
|
import raspy_sensors as RaspySensors |
|
|
|
|
|
|
|
|
import raspy_sensors as Sensors |
|
|
from defines import Topics |
|
|
from defines import Topics |
|
|
|
|
|
|
|
|
def measure_send_data(plantID, actionID, client: mqtt.Client): |
|
|
def measure_send_data(plantID, actionID, client: mqtt.Client): |
|
|
|
|
|
|
|
|
actionID (_type_): current ID of driving action |
|
|
actionID (_type_): current ID of driving action |
|
|
client (mqtt.Client): current mqtt client for publishing |
|
|
client (mqtt.Client): current mqtt client for publishing |
|
|
""" |
|
|
""" |
|
|
sensor = RaspySensors() |
|
|
|
|
|
|
|
|
sensor = Sensors.RaspySensors() |
|
|
sensorData = sensor.readSensors() |
|
|
sensorData = sensor.readSensors() |
|
|
sensorData["PlantID"] = plantID |
|
|
sensorData["PlantID"] = plantID |
|
|
sensorData["ActionID"] = actionID |
|
|
sensorData["ActionID"] = actionID |
|
|
|
|
|
|
|
|
plantID = dictMessage["PlantID"] |
|
|
plantID = dictMessage["PlantID"] |
|
|
actionID = dictMessage["ActionID"] |
|
|
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 = threading.Thread(target= drive_plant_thread, args=(plantID, actionID, clients), daemon=True) |
|
|
thread.start() |
|
|
thread.start() |