def sendNotification(self): if (abs(SensorData.getValue() - SensorData.getAvgValue()) >= self.alertDiff): # print(SensorData.curValue) # print(SensorData.sampleCount) logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', level=logging.DEBUG) logging.info('\n Current temp exceeds average by > ' + str(self.alertDiff) + '.Triggering alert...') data = SensorData.__str__() connector = SmtpClientConnector() connector.publishMessage('Excessive Temp', data)
def testAddValue(self): testValue = 10.0 sensordata = SensorData() sensordata.addValue(testValue) sampleCount = sensordata.getSampleCount() assert sampleCount == 1 curValue = sensordata.getValue() assert curValue == testValue avgValue = sensordata.getAvgValue() assert avgValue == testValue minValue = sensordata.getMinValue() assert minValue == testValue maxValue = sensordata.getMaxValue() assert maxValue == testValue totValue = sensordata.getTotValue() assert totValue == testValue