All imports are done internally so it"s done on a as needed basis only
as in many cases the DHT sensor is not connected.
"""
def __init__(self, port="SERIAL",gpg=None, sensor_type=0):
try:
Sensor.__init__(self,port,"INPUT",gpg)
except:
raise
try:
import threading
self.sensor_type = sensor_type
// here we keep the temperature values after removing outliers
self.filtered_temperature = []
// here we keep the filtered humidity values after removing the outliers
self.filtered_humidity = []
// we are using an event so we can close the thread as soon as KeyboardInterrupt is raised
self.event = threading.Event()
if self.sensor_type == 0:
self.set_descriptor("Blue DHT Sensor")
else:
self.set_descriptor("White DHT Sensor")