def testlibDbSensors(self): error = "" lib = libDbSensors.databaseSensors() id = lib.getSensorIdByAddress("Analog0") if(id == -1): error = "Can not find light sensor" id = lib.getSensorIdByAddress("28 39 E8 6D 6 0 0 5D") if(id == -1): error = "Can not find T1 sensor" id = lib.getSensorIdByAddress("28 35 2 70 6 0 0 E2") if(id == -1): error = "Can not find T2 sensor" id = lib.getSensorIdByAddress("28 AD E7 6E 6 0 0 D7") if(id == -1): error = "Can not find T3 sensor" id = lib.getSensorIdByAddress("28 83 99 6F 6 0 0 32") if(id == -1): error = "Can not find T4 sensor" id = lib.getSensorIdByAddress("28 A7 6A 6F 6 0 0 B0") if(id == -1): error = "Can not find T5 sensor" id = lib.getSensorIdByAddressSubAddress("Digital10", "Temperature") if(id == -1): error = "Can not find Digital10 Temperature sensor" id = lib.getSensorIdByAddressSubAddress("Digital10", "Humidity") if(id == -1): error = "Can not find Digital10 Humidity sensor" id = lib.getSensorIdByAddressSubAddress("Digital10", "HeatIndex") if(id == -1): error = "Can not find Digital10 Heat Index sensor" self.showResult(error)
def _logAllSensors(self): lookup = libDbSensors.databaseSensors() # Get sensor data from Arduino if(self.useTestApi): data = config.test['ArduinoJsonData'] else: lib = libArduinoSensors.arduinoSensors() data = lib.ArduinoData #log Temperatures for temps in data["Temperatures"]: self._logSensor( lookup.getSensorIdByAddress(temps["Address"]), temps["TempC"] ) #log DHT sensor self._logSensor( lookup.getSensorIdByAddressSubAddress("Digital10", "Temperature"), data["DHT"]["TempC"] ) self._logSensor( lookup.getSensorIdByAddressSubAddress("Digital10", "Humidity"), data["DHT"]["HumidityPercent"] ) self._logSensor( lookup.getSensorIdByAddressSubAddress("Digital10", "HeatIndex"), data["DHT"]["HeatIndexF"] ) #log Light sensor self._logSensor( lookup.getSensorIdByAddress( data["Light"]["Address"]), data["Light"]["Light"] )