예제 #1
0
    def setUp(self):

        #getting the host data
        host = ConfigUtil().getProperty(ConfigConst.COAP_DEVICE_SECTION,
                                        ConfigConst.HOST_KEY)

        #port number to connect
        port = int(ConfigUtil().getProperty(ConfigConst.COAP_DEVICE_SECTION,
                                            ConfigConst.PORT_KEY))

        #resource uri
        path = 'Temperature Resource'

        #connecting to my CoAp client connector
        self.coap_client = CoapClientConnector(host, port, path)
예제 #2
0
 def __init__(self):
     self.actuator = ActuatorData()
     self.sensorAdaptor = MultiSensorAdaptor()
     self.config = ConfigUtil()
     self.config.loadConfig("../../../config/ConnectedDevicesConfig.props")
     self.threshold = float(self.config.getValue("device", "nominalTemp"))
     self.actuatorOP = MultiActuatorAdaptor.getInstance()
 def __init__(self):
     """
     Class constructor which initializes all required parameters for connecting ubidots cloud service
     """
     logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s',
                         level=logging.INFO,
                         datefmt='%Y-%m-%d %H:%M:%S')
     threading.Thread.__init__(self)
     self.load_prop = ConfigUtil(
         r"/home/pi/workspace/iot-device/apps/labs/common/ConnectedDevicesConfig.props"
     )
     self.BROKER_ENDPOINT = self.load_prop.getValues(
         'ubidots.cloud', 'host')
     self.TLS_PORT = int(self.load_prop.getValues('ubidots.cloud', 'port'))
     self.MQTT_USERNAME = self.load_prop.getValues('ubidots.cloud',
                                                   'authToken')
     self.MQTT_PASSWORD = ""
     self.TOPIC = '/v1.6/devices/'
     self.DEVICE_LABEL = 'substation-gateway'
     self.TLS_CERT_PATH = self.load_prop.getValues('ubidots.cloud',
                                                   'certFile')
     logging.info("Configuring & Setting Up Cloud Connection Properties")
     mqtt_client.on_connect = on_connect
     self.connect(mqtt_client, self.MQTT_USERNAME, self.MQTT_PASSWORD,
                  self.BROKER_ENDPOINT, self.TLS_PORT)
 def __init__(self):
     '''
     Constructor
     '''
     self.config = ConfigUtil()
     self.connector = SmtpClientConnector()
     self.tempActuator = TempActuatorAdaptor()
예제 #5
0
 def __init__(self):
     config = ConfigUtil()
     config.loadConfig("../../../config/ConnectedDevicesConfig.props")
     self.host = config.getValue("coap.device", "host")
     self.port = int(config.getValue("coap.device", "port"))
     self.path = "Temp"
     self.client = HelperClient(server=(self.host, self.port))
예제 #6
0
 def __init__(self):
     self.config = ConfigUtil(
         r"/home/pi/workspace/iot-device/apps/labs/common/ConnectedDevicesConfig.props"
     )
     logging.info('Configuration data...\n' + '\n' +
                  str(self.config.config.sections())
                  )  # Constructor loading config properties from the file
예제 #7
0
class SensorDataManager():
    actData = ActuatorData()
    nomTemp = 0
    confP = ConfigUtil()
    '''
    this function takes sensorData as an argument and updates the ActuatorData object with the values and 
    returns the ActuatorData object.
    '''
    def handleSensorData(self, sensorData):
        self.actData.setName(sensorData.getName())
        self.actData.setValue(sensorData.getCurrentValue())
        self.nomTemp = float(self.confP.getValue("device", "nominalTemp"))
        if ((self.nomTemp - 5.0) < sensorData.getCurrentValue() <
            (self.nomTemp + 5.0)):
            self.actData.setCommand("NEUTRAL")
        elif (sensorData.getCurrentValue() < (self.nomTemp + 10.0)):
            self.actData.setCommand("TEMP DEC")
        elif (sensorData.getCurrentValue() > (self.nomTemp + 10.0)):
            self.actData.setCommand("TEMP INC")
    # print(self.actData.getCommand())
        return self.actData

    #return None

    def humidity(self, sensorData):
        self.actData.setName(sensorData.getName())
        self.actData.setValue(sensorData.getCurrentValue())
        self.actData.setCommand(str(round(sensorData.getCurrentValue(), 2)))
        return self.actData

    def pressure(self, sensorData):
        self.actData.setName(sensorData.getName())
        self.actData.setValue(sensorData.getCurrentValue())
        self.actData.setCommand(str(round(sensorData.getCurrentValue(), 2)))
        return self.actData
예제 #8
0
class Module03Test(unittest.TestCase):
	confU=ConfigUtil();
	sensorD=SensorData()
	hasConf=confU.hasConfig()
	curVal=sensorD.getCurrentValue()
	avgVal=sensorD.getAverageValue()
	actD=ActuatorData()
	senDM=SensorDataManager()
	
	"""
	it checks for the datatype of hasConf to be boolean, If true test case is passed.
	"""

	def testConfigUtil(self):
		self.assertTrue(isinstance(self.hasConf,bool),"Boolean Value")
		
	"""
	it checks for the datatype of curVal to be float, If true test case is passed. 
	Second checks for the avgVal to be within the specified range.If true test case is passed. 
	"""	
	def testSensorData(self):
		self.assertTrue(isinstance(self.curVal,float),"Float Value")
		self.assertTrue(self.avgVal>=0.0 and self.avgVal<=30.0,"Average Temperature within the range")
	'''
	It checks for the datatype of the getCommand function to be String.
	'''	
	def testActuatorData(self):
		self.assertTrue(isinstance(self.actD.getCommand(),str), "String")
		
	'''
	It checks for the returntype of the function handleSensorData of class SensorDataManager to be of type actuator data. 
	'''	
	def testSensorDataManager(self):
		self.assertTrue(isinstance(self.senDM.handleSensorData(self.sensorD),ActuatorData), "Type Actuator Data")		
예제 #9
0
    def __init__(self, rateInSec=10):
        super(HI2CSensorAdaptorTask, self).__init__()

        self.rateInSec = rateInSec
        self.config = ConfigUtil()
        self.config.loadConfig(ConfigConst.DEFAULT_CONFIG_FILE_NAME)

        print('Configuration data...\n' +
              str(ConfigConst.DEFAULT_CONFIG_FILE_NAME))
예제 #10
0
 def setUp(self):
     self.config = ConfigUtil()
     self.config.loadConfig('../../../config/ConnectedDevicesConfig.props')
     self.tempsensor = TempSensorEmulatorTask()
     self.sensordata = SensorData()
     self.sensordata.addValue(10)
     self.sensordata.addValue(15)
     self.sensordata.addValue(20)
     self.sensordata.setName('Temperature')
예제 #11
0
 def __init__(self):  # Constructor
     threading.Thread.__init__(self)
     SensorDataManager.setDaemon(self, True)
     self.nominal_temp = ConfigUtil(
         r"/home/pi/workspace/iot-device/apps/labs/common/ConnectedDevicesConfig.props"
     )
     self.temp_set_point = self.nominal_temp.getValues(
         "device", "nominalTemp"
     )  # loading nominal temperature value from config file9
     self.message = ''
예제 #12
0
class Module02Test(unittest.TestCase):
    """
	class scoped variables and objects are created
	"""
    confU = ConfigUtil()
    sensorD = SensorData()
    tempSensor = TempSensorEmulatorTask()
    curVal = 0.0
    avgVal = 0.0
    hasConf = ""
    data = None
    '''
	values are setup into the variables
	 '''
    def setUp(self):
        self.data = self.tempSensor.getSensorData()
        self.hasConf = self.confU.hasConfig()
        self.curVal = self.sensorD.getCurrentValue()
        self.avgVal = self.sensorD.getAverageValue()

    """
	All the resources are tear down here.
	"""

    def tearDown(self):
        del self.data
        del self.hasConf
        del self.curVal
        del self.avgVal

    """
	it checks for the datatype of hasConf to be boolean, If true test case is passed.
	"""

    def testConfigUtil(self):
        self.assertTrue(isinstance(self.hasConf, bool), "Boolean Value")

    """
	it checks for the datatype of curVal to be float, If true test case is passed. 
	Second checks for the avgVal to be within the specified range.If true test case is passed. 
	"""

    def testSensorData(self):
        self.assertTrue(isinstance(self.curVal, float), "Float Value")
        self.assertTrue(self.avgVal >= 0.0 and self.avgVal <= 30.0,
                        "Average Temperature within the range")

    '''
	It checks for the datatype of data to be of class type SensorData, If true test case is passed.
	'''

    def testTemperatureSensorEmulatorTask(self):
        self.assertTrue(isinstance(self.data, SensorData),
                        "Sensor Data Type Value")
    def __init__(self):
        '''
        Constructor
        '''
        self.config = ConfigUtil()
        self.config.loadConfig(
            'C:/Users/sk199/git/connected-devices-python/iot-device/config/ConnectedDevicesConfig.props'
        )

        logging.info('Configuration data...\n' +
                     str(ConfigConst.DEFAULT_CONFIG_FILE_NAME))
 def __init__(self):
     """
     Constructor function which loads all the essential propertied from disk for setting up SMTP Client using
     ConfigUtil Class Function
     """
     self.config = ConfigUtil(
         r"/home/pi/workspace/iot-device/apps/labs/common/ConnectedDevicesConfig.props"
     )
     logging.info('Configuration data...\n' + '\n' +
                  str(self.config.config.sections())
                  )  # Constructor loading config properties from the file
예제 #15
0
 def setUp(self):
     self.config = ConfigUtil()
     self.config.loadConfig('../../../config/ConnectedDevicesConfig.props')
     self.tempsensor = TempSensorAdaptorTask()
     self.sensordata = SensorData()
     self.actuatordata = ActuatorData()
     self.sensordata.addValue(10)
     self.sensordata.addValue(15)
     self.sensordata.addValue(20)
     self.sensordata.addValue(25)
     self.sensordata.setName('Temperature')
     self.actuatordata.setCommand('Increasing')
     self.actuatordata.setName('SenseHat')
     self.sdmanager = SensorDataManager()
예제 #16
0
 def __init__(self):
     Thread.__init__(self)
     self.highVal = 30
     self.lowVal = 0
     self.updateTime = 2
     self.senseHat = SenseHat()
     self.sensorData = SensorData()
     self.actuatorData = ActuatorData()
     self.connector = Connector()
     self.alertDiff = 10
     
     
     self.config = ConfigUtil('D:/git/repository/iot-device/apps/data/ConnectedDevicesConfig.props')
     self.config.loadConfig()
     print('Configuration data...\n' + str(self.config))
예제 #17
0
    def __init__(self):
        '''
        This is the default constructor.
        It takes the host and port values and set them as CoAP server
        It adds the resources to server
        '''

        self.config = ConfigUtil()
        self.config.loadConfig()
        self.coapHost = self.config.getProperty(
            ConfigConst.COAP_DEVICE_SECTION, ConfigConst.HOST_KEY)
        self.coapPort = int(
            self.config.getProperty(ConfigConst.COAP_DEVICE_SECTION,
                                    ConfigConst.PORT_KEY))
        CoAP.__init__(self, (self.coapHost, self.coapPort))
        print(self.coapHost)
        print(self.coapPort)
        self.add_resource('temperature/', TempResourceHandler())
예제 #18
0
    def connector(self, command):
        confUtil = ConfigUtil()
        if (command == "TEMP INC"):

            msg = "Current temperature value exceeds the nominal temperature value."
        elif (command == "TEMP DEC"):
            msg = "Current temperature value deceeds the nominal temperature value."
        else:
            msg = "Current temperature value neutral to the nominal temperature value."
        sub = "Temperature Alert"
        message = 'Subject: {}\n\n{}'.format(sub, msg)
        dictS = confUtil.dictSmtp()
        senderAddr = dictS['senderAddr']
        receiverAddr = dictS['receiverAddr']
        hostName = dictS['hostName']
        portNumber = dictS['portNumber']
        token = dictS['token']
        server = smtplib.SMTP(hostName, portNumber)
        server.starttls()
        server.login(senderAddr, token)
        server.ehlo()
        server.sendmail(senderAddr, receiverAddr, message)
예제 #19
0
    def __init__(self):
        self.config = ConfigUtil(
            '../../../config/ConnectedDevicesConfig.props')
        self.config.loadConfig()
        print('Configuration data...\n' + str(self.config))

        self.host = self.config.getProperty(ConfigConst.COAP_DEVICE_SECTION,
                                            ConfigConst.HOST_KEY)
        self.port = int(
            self.config.getProperty(ConfigConst.COAP_DEVICE_SECTION,
                                    ConfigConst.PORT_KEY))
        print('\tHost: ' + self.host)
        print('\tPort: ' + str(self.port))

        if not self.host or self.host.isspace():
            print("Using default host: " + self.host)

        self.serverAddr = (self.host, self.port)
        print('Server Address: ' + str(self.serverAddr))

        self.url = "coap://" + self.host + ":" + str(
            self.port) + "/Temperature"
'''
Created on Feb 6, 2020
@author: Naveen Rajendran
'''
from labs.common.SensorData import SensorData
from sense_hat import SenseHat
import threading
import time
from labs.common.ConfigUtil import ConfigUtil
from labs.module08.MqttClientConnector import MqttClientConnector
import logging

data_object = SensorData()  # class object
sense_hat = SenseHat()  # class object
load_property = ConfigUtil(
    r"C:\Users\Naveen Rajendran\Desktop\MS COURSE\CSYE-6530 CONNECTED DEVICES WORKSPACE\iot-device\apps\labs\common\ConnectedDevicesConfig.props"
)
'''
* This class polls temperature sensor data from sense hat via its API  
'''


class TempSensorAdaptorTask(threading.Thread):
    '''      
    * Constructor function which sets daemon of TempSensorAdaptorTask thread to true 
    '''
    data_object.set_sensor_name("Temperature Sensor")

    def __init__(self, max_sample):
        threading.Thread.__init__(self)  # Invoking Thread Function
        TempSensorAdaptorTask.setDaemon(self, True)
예제 #21
0
 def __init__(self):
     config = ConfigUtil()
     config.loadConfig("../../../config/ConnectedDevicesConfig.props")
     self.host = config.getValue("mqtt.cloud", "host")
     self.port = int(config.getValue("mqtt.gateway", "port"))
     self.client = paho.Client("SiddharthaIoTp")
예제 #22
0
class TempSensorAdaptorTask(Thread):
    '''
    Variables are defined and objects of required classes are created with the class scope.
    '''
    sensorData = SensorData()  #constructor of sensorData is created.
    sensorDataM = SensorDataManager(
    )  #constructor of SensorDataManager is created.
    smtpCCObject = SmtpClientConnector.SmtpClientConnector(
    )  ##constructor of SmtpClientConnector is created.
    confP = ConfigUtil()  #constructor of ConfigUtil is created.
    avgValue = 0.0
    count = 0.0
    total = 0.0
    currentValue = 0.0
    maxValue = 0.0
    minValue = 0.0
    timestamp = None
    sh = SenseHat()  #constructor of SenseHat is created.
    du = DataUtil()
    '''
    nominal temperature is fetched from configuration file using object of ConfigParser.
    '''
    nominal = confP.getValue("device", "nominalTemp")
    '''
    constructor of class TempSensorAdaptorTask
    '''
    def __init__(self, name):
        # self.generateTemp()

        Thread.__init__(self)
        self.name = name
        self.temp = pu.getSensorDataFromDbms()

        self.act = pu.getActuatorDataFromDbms()
        # self.act=None
        if (self.temp == None):

            self.run()

    #  print(self.temp)
    '''
    this run function overrides the run function of Thread and calls the sense hat function to generate the temperature values,addValue fnctn of sensorData is called
    handleSensorData of class sensorDataManager is called and sensorData object is passed as a parameter.
    This function will return the actuator data. notification fucn will be called to check the condition of sending the email
    '''

    def run(self):
        #for i in range(0,10):
        while True:
            self.val = self.sh.get_temperature(
            )  #calling get_temperature function
            j = {}
            #curVal=pu.getActuatorDataFromDbms()
            jj = pu.getActuatorDataFromDbms()
            if (len(self.act) < 20):
                pu.writeActuatorDataToDbms()
        #   print(jj)
            adl = ActuatorDataListener()
            c = adl.onActuatorMessage(self.temp)
            if (c != self.temp):
                self.temp = c
            self.sensorData.addValue(
                self.val)  #calling addValue function of sensorData
            # self.act_data=self.sensorDataM.handleSensorData(self.sensorData)
            self.getSensorData()
            sdj = self.du.toJsonFromSensorData(self.sensorData)
            print("**************")

            print(sdj)
            st = pu.writeSensorDataToDbms(self.sensorData)

            time.sleep(2)

    '''
    values of sensor data is fetched to store in local variables.
    '''

    def getSensorData(self):
        self.avgValue = self.sensorData.getAverageValue()
        self.count = self.sensorData.getCount()
        self.total = self.sensorData.getTotal()
        self.currentValue = self.sensorData.getCurrentValue()
        self.maxValue = self.sensorData.getMaxValue()
        self.minValue = self.sensorData.getMinValue()
        self.timestamp = self.sensorData.getTimestamp()

    '''
    notification regarding email alert and logging information is handled by sendNotification function, it takes 3 arguments
    namely command which is set to actuator data, current Temperature value and the nominal value
    '''

    def sendNotification(self, command, current, nominal):
        logging.basicConfig(level=logging.INFO, format='%(message)s')
        #    logging.basicConfig(level=logging.INFO)
        data = "Temperature:\nTime:    " + str(
            self.timestamp) + "\nCurrent:    " + str(
                self.currentValue) + "\nAverage:    " + str(
                    self.avgValue) + "\nSamples:    " + str(
                        self.count) + "\nMin:    " + str(
                            self.minValue) + "\nMax:    " + str(self.maxValue)
        logging.info(data)
        print("\n")
예제 #23
0
'''

import logging

from random     import uniform
from datetime   import datetime

from labs.common            import ConfigConst
from labs.common.ConfigUtil import ConfigUtil
from labs.common.DataUtil   import DataUtil
from labs.common.SensorData import SensorData
from labs.module06.MqttClientConnector  import MqttClientConnector

topic   = "Temperature Sensor"

config  = ConfigUtil('../../../config/ConnectedDevicesConfig.props');
host    = config.getProperty(ConfigConst.ConfigConst.MQTT_CLOUD_SECTION, ConfigConst.ConfigConst.HOST_KEY)

'''
Creating the Sensor Data
'''
sensor              = SensorData(topic,0,30)
sensor.curValue     = uniform(float(sensor.getMinValue()), float(sensor.getMaxValue())); 
sensor.addValue(sensor.curValue);
sensor.diffValue    = sensor.curValue - sensor.avgVal;
sensor.timestamp    = datetime.now();
logging.info('SensorData to be sent:')
print("Sensor data before converting to Json: " + str(sensor));

'''
Converting the Sensor Data to the JSON format
예제 #24
0
 def setUp(self):
     self.configobj = ConfigUtil(
         r"C:\Users\Naveen Rajendran\Desktop\MS COURSE\CSYE-6530 CONNECTED DEVICES WORKSPACE\iot-device\apps\labs\common\ConnectedDevicesConfig.props"
     )
예제 #25
0
 def __init__(self):
     self.config = ConfigUtil()
예제 #26
0
 def __init__(self):
     self.config = ConfigUtil(
         'D:/git/repository/iot-device/data/ConnectedDevicesConfig.props')
     self.config.loadConfig()
     print('Configuration data...\n' + str(self.config))
예제 #27
0
	def setUp(self):
		self.configUtil = ConfigUtil()
		self.configUtil.loadConfig("../../../config/ConnectedDevicesConfig.props")
		pass
예제 #28
0
class TempSensorAdaptorTask(Thread):
    '''
    Variables are defined and objects of required classes are created with the class scope.
    '''
    
    sensorData=SensorData()         #constructor of sensorData is created.
    tempAct=TempActuatorAdaptor()   #constructor of TempActuatorAdaptor is created.
    sensorDataM=SensorDataManager() #constructor of SensorDataManager is created.
    smtpCCObject=SmtpClientConnector.SmtpClientConnector()  ##constructor of SmtpClientConnector is created.
    confP=ConfigUtil()  #constructor of ConfigUtil is created.
    avgValue=0.0
    count=0.0
    total=0.0
    currentValue=0.0
    maxValue=0.0
    minValue=0.0
    timestamp=None
    sh=SenseHat()       #constructor of SenseHat is created.
    '''
    nominal temperature is fetched from configuration file using object of ConfigParser.
    '''
    nominal=confP.getValue("device", "nominalTemp")
    
    '''
    constructor of class TempSensorAdaptorTask
    '''
    def __init__(self,name):
       # self.generateTemp()
        Thread.__init__(self);
        self.name=name
    '''
    this run function overrides the run function of Thread and calls the sense hat function to generate the temperature values,addValue fnctn of sensorData is called
    handleSensorData of class sensorDataManager is called and sensorData object is passed as a parameter.
    This function will return the actuator data. notification fucn will be called to check the condition of sending the email
    '''
    
    def run(self):
        #for i in range(0,10):
       # while True:
        
        mqtt_client = mqttClient.Client()
        while True:
            self.val=self.sh.get_temperature()      #calling get_temperature function
            
            self.sensorData.addValue(self.val)  #calling addValue function of sensorData
            self.act_data=self.sensorDataM.handleSensorData(self.sensorData)
            self.getSensorData()
            
           #commented out for mod8# self.sendNotification(self.act_data.getCommand(), self.act_data.getValue(),self.nominal)
            
            ubidots(mqtt_client,self.currentValue,"temperature")
            time.sleep(2)
          #mod8#  if(self.act_data!=None):
            #mod8#    self.tempAct.updateActuator(self.act_data)      #calling of updateActuator
            #mod8# time.sleep(2)    
     #   return None    
    '''
    values of sensor data is fetched to store in local variables.
    '''        
    def getSensorData(self):
        self.avgValue= self.sensorData.getAverageValue();
        self.count=self.sensorData.getCount();
        self.total=self.sensorData.getTotal();
        self.currentValue=self.sensorData.getCurrentValue();
        self.maxValue=self.sensorData.getMaxValue();
        self.minValue=self.sensorData.getMinValue();
        self.timestamp=self.sensorData.getTimestamp();
                
    '''
    notification regarding email alert and logging information is handled by sendNotification function, it takes 3 arguments
    namely command which is set to actuator data, current Temperature value and the nominal value
    '''            
    def sendNotification(self,command,current,nominal): 
        logging.basicConfig(level=logging.INFO,format='%(asctime)s:%(levelname)s:%(message)s')
        nominal=float(nominal)     
        if(command=="TEMP INC"):
            logging.info('\n Current temperature exceeds Nominal Temperature by ' + str(round(abs(current-nominal),2)) + '. Triggering alert...')
        elif(command=="TEMP DEC"):
            logging.info('\n Current temperature deceeds Nominal Temperature by ' + str(round(abs(current-nominal),2)) + '. Triggering alert...')    
        else:
            logging.info('\n Current temperature is neutral to Nominal Temperature')    
        
      #  self.smtpCCObject.connector(command)
        logging.basicConfig(level=logging.INFO)
        data="Temperature:\nTime:    "+str(self.timestamp)+"\nCurrent:    "+str(self.currentValue)+"\nAverage:    "+str(self.avgValue)+"\nSamples:    "+str(self.count)+"\nMin:    "+str(self.minValue)+"\nMax:    "+str(self.maxValue)    
        logging.info(data)
        print("\n")
예제 #29
0
 def __init__(self):
     self.mqttc = mqtt.Client()
     self.config = ConfigUtil()
     self.config.loadConfig("../../config/ConnectedDevicesConfig.props")
예제 #30
0
class SensorDataManager(object):
    '''
    classdocs
    '''

    #instantiate TempActuatorAdaptor
    multiActuatorAdaptor = MultiActuatorAdaptor()

    #instantiate ConfigUtil
    configUtil = ConfigUtil()

    #instantiate smtp client connector
    smtpClientConnector = SmtpClientConnector()

    def __init__(self):
        '''
        Constructor
        '''

    #this method takes in sensorData as a parameter and checks it against the type of readings and takes appropriate action
    def handleSensorData(self, sensorDatas):

        #initialize the list for actuatorData
        actuatorDataList = []

        #iterate through the sensorDatas list
        for sensorData in sensorDatas:

            #if the reading is directly from i2c bus
            if sensorData.getName() == "i2c humidity":

                #get the current sensor value
                sensorVal = sensorData.getCurrentValue()

                #instantiate ActuatorData
                actuatorData = ActuatorData()

                #the actuator should display the current humidity
                actuatorData.setCommand("DISPLAY I2C Humidity")

                #set the name of the actuator
                actuatorData.setName("I2C Humidity")

                #set the value to the current humidity value
                actuatorData.setValue(sensorVal)

                #send email notification consisting of the reading
                self.sendNotification(sensorData.loggingData,
                                      "Humidity Reading from I2C Bus")

                #append the actuator data to the list
                actuatorDataList.append(actuatorData)

            #if the reading is directly from sensehat api
            elif sensorData.getName() == "sense_hat API humidity":

                #get the current sensor value
                sensorVal = sensorData.getCurrentValue()

                #instantiate ActuatorData
                actuatorData = ActuatorData()

                #the actuator should display the current humidity
                actuatorData.setCommand("DISPLAY SENSE HAT API Humidity")

                #set the name of the actuator
                actuatorData.setName("SENSE HAT API Humidity")

                #set the value to the current humidity value
                actuatorData.setValue(sensorVal)

                #send email notification consisting of the reading
                self.sendNotification(sensorData.loggingData,
                                      "Humidity Reading from SenseHAT API")

                #append the actuator data to the list
                actuatorDataList.append(actuatorData)

        #if no valid sensor data reading
        if len(actuatorDataList) == 0:

            #return none
            return None

        #send the list to the updateActuator method of the multiActuatorAdaptor
        self.multiActuatorAdaptor.updateActuator(actuatorDataList)

        #return the list of actuatorData
        return actuatorDataList

    #method for sending the notification via e-mail
    def sendNotification(self, data, topic):

        #send email with topic indicating excessive temperature
        self.smtpClientConnector.publishMessage(data, topic)

        #create a delay for email to be sent
        sleep(2)

        #return true for running successfully
        return True