Sensor Bug Fixes
This commit is contained in:
parent
ae1e67f204
commit
1e4fb4c4b4
@ -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()
|
||||
|
@ -12,7 +12,7 @@ class RaspySensors:
|
||||
_type_: _description_
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
def __init__(self):
|
||||
"""
|
||||
Init all Sensors
|
||||
"""
|
||||
@ -55,7 +55,10 @@ class RaspySensors:
|
||||
break
|
||||
|
||||
#read TSL2561
|
||||
self.sensorData["Brightness"] = round(self.tsl2561.lux, 2)
|
||||
if type(self.tsl2561.lux) == type(None): #Max Value 40.000 -> above error
|
||||
self.sensorData["Brightness"] = 40000
|
||||
else:
|
||||
self.sensorData["Brightness"] = int(self.tsl2561.lux)
|
||||
|
||||
#TODO SoilMoisture Sensor
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user