def checkMachine(self, checkNetwork=True, checkLocation=True, checkWeather=True, checkTime=True): if checkNetwork: self.__diagNetwork() self.__diagInternet() if checkLocation: self.__diagLocation() if checkWeather: self.__diagWeather() if checkTime: self.__diagTime() self.__diagWifi() self.__diagCloud() self.__cpuUsage = RMCPUStats().getPercentage() self.__uptimeSeconds = self.getUptime() self.__uptimeString = str(timedelta(seconds=self.__uptimeSeconds)) self.__memoryUsage = RMMemoryUsageStats().getFromProc()['rss'] self.lastCheck = rmCurrentTimestamp() return self.__networkStatus, self.__locationStatus, self.__weatherStatus, self.__timeStatus
def __init__(self, id, timestamp=None, processed=False): self.id = id self.timestamp = timestamp self.processed = processed if self.timestamp is None: self.timestamp = rmCurrentTimestamp()
def checkMachine(self, checkNetwork = True, checkLocation = True, checkWeather = True, checkTime = True): if checkNetwork: self.__diagNetwork() self.__diagInternet() if checkLocation: self.__diagLocation() if checkWeather: self.__diagWeather() if checkTime: self.__diagTime() self.__diagWifi() self.__diagCloud() self.__cpuUsage = RMCPUStats().getPercentage() self.__uptimeSeconds = self.getUptime() self.__uptimeString = str(timedelta(seconds = self.__uptimeSeconds)) self.__memoryUsage = RMMemoryUsageStats().getFromProc()['rss'] self.lastCheck = rmCurrentTimestamp() return self.__networkStatus, self.__locationStatus, self.__weatherStatus, self.__timeStatus
def __init__(self, id, timestamp = None, processed = False): self.id = id self.timestamp = timestamp self.processed = processed if self.timestamp is None: self.timestamp = rmCurrentTimestamp()
def perform(self): URL = self.params.get("urlPath", None) d = self.openURL(URL) if d is None: return pwsContent = d.read() if pwsContent is None: return pwsContent = pwsContent.strip() pwsArray = pwsContent.split(" ") lat = float(pwsArray[160]) lon = -float(pwsArray[161]) distToPWS = self.distanceToStation(lat, lon) maxDist = self.params.get("maxAllowedDistance") if (distToPWS > maxDist): log.error("*** PWS Station too far from home!") return temperature = self.__toFloat(pwsArray[4]) mintemp = self.__toFloat(pwsArray[47]) maxtemp = self.__toFloat(pwsArray[46]) rh = self.__toFloat(pwsArray[5]) minrh = self.__toFloat(pwsArray[164]) maxrh = self.__toFloat(pwsArray[163]) wind = self.__toFloat(convertKnotsToMS( pwsArray[1])) # converted from knos to m/s solarradiation = self.__toFloat( pwsArray[127] ) # needs to be converted from watt/sqm*h to Joule/sqm if solarradiation is not None: solarradiation *= 0.0864 rain = self.__toFloat(pwsArray[7]) dewpoint = self.__toFloat(pwsArray[72]) pressure = self.__toFloat(pwsArray[50]) conditionIcon = self.conditionConvert(self.__toFloat(pwsArray[48])) #skycover ? timestamp = rmCurrentTimestamp() self.addValue(RMParser.dataType.TEMPERATURE, timestamp, temperature) self.addValue(RMParser.dataType.MINTEMP, timestamp, mintemp) self.addValue(RMParser.dataType.MAXTEMP, timestamp, maxtemp) self.addValue(RMParser.dataType.RH, timestamp, rh) self.addValue(RMParser.dataType.MINRH, timestamp, minrh) self.addValue(RMParser.dataType.MAXRH, timestamp, maxrh) self.addValue(RMParser.dataType.WIND, timestamp, wind) self.addValue(RMParser.dataType.RAIN, timestamp, rain) self.addValue(RMParser.dataType.DEWPOINT, timestamp, dewpoint) self.addValue(RMParser.dataType.PRESSURE, timestamp, pressure) self.addValue(RMParser.dataType.CONDITION, timestamp, conditionIcon) self.addValue(RMParser.dataType.SOLARRADIATION, timestamp, solarradiation) print self.result return
def __deleteExpiredTokens(self): timestamp = rmCurrentTimestamp() self.__tokensTable.deleteExpiredRecords(timestamp) if self.__tokens: for key, token in self.__tokens.iteritems(): if token.expiration < timestamp: self.__tokens.pop(key)
def perform(self): URL = self.params.get("urlPath", None) d = self.openURL(URL) if d is None: return pwsContent = d.read() if pwsContent is None: return pwsContent = pwsContent.strip() pwsArray = pwsContent.split(" ") lat = float(pwsArray[160]) lon = -float(pwsArray[161]) distToPWS = self.distanceToStation(lat, lon) maxDist = self.params.get("maxAllowedDistance") if(distToPWS > maxDist): log.error("*** PWS Station too far from home!") return temperature = self.__toFloat(pwsArray[4]) mintemp = self.__toFloat(pwsArray[47]) maxtemp = self.__toFloat(pwsArray[46]) rh = self.__toFloat(pwsArray[5]) minrh = self.__toFloat(pwsArray[164]) maxrh = self.__toFloat(pwsArray[163]) wind = self.__toFloat(convertKnotsToMS(pwsArray[1])) # converted from knos to m/s solarradiation = self.__toFloat(pwsArray[127]) # needs to be converted from watt/sqm*h to Joule/sqm if solarradiation is not None: solarradiation *= 0.0864 rain = self.__toFloat(pwsArray[7]) dewpoint = self.__toFloat(pwsArray[72]) pressure = self.__toFloat(pwsArray[50]) conditionIcon = self.conditionConvert(self.__toFloat(pwsArray[48])) #skycover ? timestamp = rmCurrentTimestamp() self.addValue(RMParser.dataType.TEMPERATURE, timestamp, temperature) self.addValue(RMParser.dataType.MINTEMP, timestamp, mintemp) self.addValue(RMParser.dataType.MAXTEMP, timestamp, maxtemp) self.addValue(RMParser.dataType.RH, timestamp, rh) self.addValue(RMParser.dataType.MINRH, timestamp, minrh) self.addValue(RMParser.dataType.MAXRH, timestamp, maxrh) self.addValue(RMParser.dataType.WIND, timestamp, wind) self.addValue(RMParser.dataType.RAIN, timestamp, rain) self.addValue(RMParser.dataType.DEWPOINT, timestamp, dewpoint) self.addValue(RMParser.dataType.PRESSURE, timestamp, pressure) self.addValue(RMParser.dataType.CONDITION, timestamp, conditionIcon) self.addValue(RMParser.dataType.SOLARRADIATION, timestamp, solarradiation) print self.result return
def perform(self): # downloading data from a URL convenience function since other python libraries can be used URL = "http://lab.zanek.net/mesonet/api/currentobservations" stationID = "ALTU" data = self.openURL(URL) if data is None: return stationsData = json.loads(data.read()) if stationsData is None: self.lastKnownError = "Error: Invalid response from server" return timestamp = rmCurrentTimestamp() for station in stationsData: if station['STID'] == stationID: try: rain = self.__toFloat(station.get("RAIN")) except: rain = None try: tmin = self.__toFloat(station.get("TMIN")) tmax = self.__toFloat(station.get("TMAX")) except: self.lastKnownError = "Error: No minimum or maximum temperature can be retrieved" return try: pressure = self.__toFloat(station.get("PRES")) except: pressure = None try: wind = self.__toFloat(station.get("WSPD")) except: wind = None try: dew = self.__toFloat(station.get("TDEW")) except: dew = None self.addValue(RMParser.dataType.MINTEMP, timestamp, tmin) self.addValue(RMParser.dataType.MAXTEMP, timestamp, tmax) self.addValue(RMParser.dataType.RAIN, timestamp, rain) self.addValue(RMParser.dataType.PRESSURE, timestamp, pressure) self.addValue(RMParser.dataType.WIND, timestamp, wind) self.addValue(RMParser.dataType.DEWPOINT, timestamp, dew) if self.parserDebug: log.debug(self.result)
def __refreshWIFI(self): timestamp = rmCurrentTimestamp() lastWIFICheckTimestamp = globalWIFI.wifiInterface.lastWIFICheckTimestamp oldIP = globalWIFI.wifiInterface.ipAddress if lastWIFICheckTimestamp is None or oldIP is None or ( timestamp - lastWIFICheckTimestamp) >= self.__wifiRefreshTimeout: try: globalWIFI.detect() if oldIP != globalWIFI.wifiInterface.ipAddress: log.info( "Refreshed WIFI Information. (old: %s new ip: %s)" % ( ` oldIP `, ` globalWIFI.wifiInterface.ipAddress `)) if RMOSPlatform().AUTODETECTED == RMOSPlatform.ANDROID: return # Handle None IP if globalWIFI.wifiInterface.ipAddress is None: if self.__lastNoneIpTimestamp is None or ( timestamp - self.__lastNoneIpTimestamp ) < self.__wifiNoneIpTimeout: # First occurrence of None IP OR we can wait some more time. if self.__lastNoneIpTimestamp is None: self.__lastNoneIpTimestamp = timestamp log.debug( "Refreshed WIFI Information - no IP detected. Give it some more time: %d seconds!" % (self.__wifiNoneIpTimeout - (timestamp - self.__lastNoneIpTimestamp), )) return else: globalWIFI.restart() log.warn( "Refreshed WIFI Information - WIFI quick reloaded because no IP detected. New IP is %s" % ` globalWIFI.wifiInterface.ipAddress `) self.__lastNoneIpTimestamp = None # Reset None IP timestamp. # Check if we never connected to this AP, set back AP mode and restart app if globalWIFI.wifiInterface.mode == "managed" and not globalWIFI.hasConnectedOnce( ): if globalWIFI.wifiInterface.hasClientLink: globalWIFI.saveHasConnectedOnce(True) else: log.warning( "WIFI Watcher Client IP (%s) configuration failed, restarting in AP mode." % oldIP) globalWIFI.setDefaultAP() globalWIFI.saveHasConnectedOnce(False) globalWIFI.restart() self.__mainManager.touchWakeMessage() except Exception, e: log.error(e)
def load(self): if not self.__isLoaded: password = self.__settingsTable.getPassword() if password: self.__password = password self.__tokensTable.deleteExpiredRecords(rmCurrentTimestamp()) self.__tokens = self.__tokensTable.getAllRecords(True) self.__isLoaded = True
def __generateToken(self, longLiveToken = False): expirationTimeout = self.__tokenShortExpirationTimeout if longLiveToken: expirationTimeout = self.__tokenLongExpirationTimeout token = RMAuthToken(hashlib.sha224(str(uuid.uuid4())).hexdigest(), rmCurrentTimestamp() + expirationTimeout) self.__tokens[token.token] = token self.__tokensTable.addRecord(token.token, token.expiration) return token
def __generateToken(self, longLiveToken=False): expirationTimeout = self.__tokenShortExpirationTimeout if longLiveToken: expirationTimeout = self.__tokenLongExpirationTimeout token = RMAuthToken( hashlib.sha224(str(uuid.uuid4())).hexdigest(), rmCurrentTimestamp() + expirationTimeout) self.__tokens[token.token] = token self.__tokensTable.addRecord(token.token, token.expiration) return token
def __checkThreads(self): timestamp = rmCurrentTimestamp() # Work around for a system date change resetWatcher = not self.__lastCheckTimestamp is None and \ abs(timestamp - self.__lastCheckTimestamp) >= self.__systemTimeChangeThreshold everythingOk = True if resetWatcher: fromTime = rmTimestampToDateAsString( self.__lastCheckTimestamp ) if self.__lastCheckTimestamp else None toTime = rmTimestampToDateAsString(timestamp) log.warning( "System time has changed (from %s, to %s)! Resetting thread watcher!" % (fromTime, toTime)) self.__lastWatchdogTimestamp = None for threadId in self.__data: details = self.__getThreadEntry(threadId) details[RMThreadWatcher.LastUpdateKey] = None if self.__mainManager: self.__mainManager.systemDateTimeChanged() else: for threadId in self.__data: details = self.__getThreadEntry(threadId) timeoutHint = details[RMThreadWatcher.TimeoutHintKey] lastUpdate = details[RMThreadWatcher.LastUpdateKey] if timeoutHint is None: log.debug("Thread %d (%s) has no timeout hint!" % (threadId, details[RMThreadWatcher.NameHintKey])) elif lastUpdate is None: log.debug("Thread %d (%s) is not started yet!" % (threadId, details[RMThreadWatcher.NameHintKey])) elif timeoutHint < (timestamp - lastUpdate): everythingOk = False log.debug("Thread %d (%s) didn't responde since [%s] (timeoutHint=%d, timeout=%d)!" % \ (threadId, details[RMThreadWatcher.NameHintKey], rmTimestampToDateAsString(lastUpdate), timeoutHint, (timestamp - lastUpdate))) self.__lastCheckTimestamp = timestamp return everythingOk
def __refreshWatchDog(self): timestamp = rmCurrentTimestamp() if self.__lastWatchdogTimestamp is None or (timestamp - self.__lastWatchdogTimestamp) >= self.__watchDogTimeout: if self.__watchDogDescriptor is None: try: self.__watchDogDescriptor = open(self.__watchDogFile, 'w') log.info("Opened system watchdog file %s with timeout %d" % (self.__watchDogFile, self.__watchDogTimeout)) except Exception, e: log.error(e) try: self.__watchDogDescriptor.write(`timestamp`) self.__watchDogDescriptor.flush() log.debug("PING Hardware Watchdog") except Exception, e: log.error(e)
def __refreshWatchDog(self): timestamp = rmCurrentTimestamp() if self.__lastWatchdogTimestamp is None or ( timestamp - self.__lastWatchdogTimestamp) >= self.__watchDogTimeout: if self.__watchDogDescriptor is None: try: self.__watchDogDescriptor = open(self.__watchDogFile, 'w') log.info("Opened system watchdog file %s with timeout %d" % (self.__watchDogFile, self.__watchDogTimeout)) except Exception, e: log.error(e) try: self.__watchDogDescriptor.write( ` timestamp `) self.__watchDogDescriptor.flush() log.debug("PING Hardware Watchdog") except Exception, e: log.error(e)
def __checkThreads(self): timestamp = rmCurrentTimestamp() # Work around for a system date change resetWatcher = not self.__lastCheckTimestamp is None and \ abs(timestamp - self.__lastCheckTimestamp) >= self.__systemTimeChangeThreshold everythingOk = True if resetWatcher: fromTime = rmTimestampToDateAsString(self.__lastCheckTimestamp) if self.__lastCheckTimestamp else None toTime = rmTimestampToDateAsString(timestamp) log.warning("System time has changed (from %s, to %s)! Resetting thread watcher!" % (fromTime, toTime)) self.__lastWatchdogTimestamp = None for threadId in self.__data: details = self.__getThreadEntry(threadId) details[RMThreadWatcher.LastUpdateKey] = None if self.__mainManager: self.__mainManager.systemDateTimeChanged() else: for threadId in self.__data: details = self.__getThreadEntry(threadId) timeoutHint = details[RMThreadWatcher.TimeoutHintKey] lastUpdate = details[RMThreadWatcher.LastUpdateKey] if timeoutHint is None: log.debug("Thread %d (%s) has no timeout hint!" % (threadId, details[RMThreadWatcher.NameHintKey])) elif lastUpdate is None: log.debug("Thread %d (%s) is not started yet!" % (threadId, details[RMThreadWatcher.NameHintKey])) elif timeoutHint < (timestamp - lastUpdate): everythingOk = False log.debug("Thread %d (%s) didn't responde since [%s] (timeoutHint=%d, timeout=%d)!" % \ (threadId, details[RMThreadWatcher.NameHintKey], rmTimestampToDateAsString(lastUpdate), timeoutHint, (timestamp - lastUpdate))) self.__lastCheckTimestamp = timestamp return everythingOk
def __refreshWIFI(self): timestamp = rmCurrentTimestamp() lastWIFICheckTimestamp = globalWIFI.wifiInterface.lastWIFICheckTimestamp oldIP = globalWIFI.wifiInterface.ipAddress if lastWIFICheckTimestamp is None or oldIP is None or (timestamp - lastWIFICheckTimestamp) >= self.__wifiRefreshTimeout: try: globalWIFI.detect() if oldIP != globalWIFI.wifiInterface.ipAddress: log.info("Refreshed WIFI Information. (old: %s new ip: %s)" % (`oldIP`, `globalWIFI.wifiInterface.ipAddress`)) if RMOSPlatform().AUTODETECTED == RMOSPlatform.ANDROID: return # Handle None IP if globalWIFI.wifiInterface.ipAddress is None: if self.__lastNoneIpTimestamp is None or (timestamp - self.__lastNoneIpTimestamp) < self.__wifiNoneIpTimeout: # First occurrence of None IP OR we can wait some more time. if self.__lastNoneIpTimestamp is None: self.__lastNoneIpTimestamp = timestamp log.debug("Refreshed WIFI Information - no IP detected. Give it some more time: %d seconds!" % (self.__wifiNoneIpTimeout - (timestamp - self.__lastNoneIpTimestamp), )) return else: globalWIFI.restart() log.warn("Refreshed WIFI Information - WIFI quick reloaded because no IP detected. New IP is %s" % `globalWIFI.wifiInterface.ipAddress`) self.__lastNoneIpTimestamp = None # Reset None IP timestamp. # Check if we never connected to this AP, set back AP mode and restart app if globalWIFI.wifiInterface.mode == "managed" and not globalWIFI.hasConnectedOnce(): if globalWIFI.wifiInterface.hasClientLink: globalWIFI.saveHasConnectedOnce(True) else: log.warning("WIFI Watcher Client IP (%s) configuration failed, restarting in AP mode." % oldIP) globalWIFI.setDefaultAP() globalWIFI.saveHasConnectedOnce(False) globalWIFI.restart() self.__mainManager.touchWakeMessage() except Exception, e: log.error(e)
def notifyCloud(code=None, action=None, parameter=None): if parameter is None: parameter = '' if action is None: action = '' if code == RMNotification.freezeTemperature: if RMNotification._freezeFlag is not action: RMNotification._freezeFlag = action string = code + "," + str( int(action)) + "," + str(parameter) + "\n" else: return elif code == RMNotification.rainDelay: isRainDelay = (globalSettings.restrictions.globalRestrictions.rainDelayDuration + globalSettings.restrictions.globalRestrictions.rainDelayStartTime) > rmCurrentTimestamp() \ and globalSettings.restrictions.globalRestrictions.rainDelayStartTime <= rmCurrentTimestamp() if RMNotification._rainDelayFlag != isRainDelay: RMNotification._rainDelayFlag = isRainDelay string = code + "," + str(int(isRainDelay)) + "\n" else: return elif code == RMNotification.rainSensor: if action != RMNotification._rainFlag: RMNotification._rainFlag = action string = code + "," + str(int(action)) + "\n" else: return elif code == RMNotification.cloudClient: string = code + "\n" else: if len(str(parameter)): string = str(code) + ',' + str(action) + "," + str( parameter) + "\n" else: string = str(code) + ',' + str(action) + "\n" RMNotification.__writeNotification(string)
def notifyCloud(code = None, action = None, parameter = None): if parameter is None: parameter = '' if action is None: action = '' if code == RMNotification.freezeTemperature: if RMNotification._freezeFlag is not action: RMNotification._freezeFlag = action string = code + "," + str(int(action)) + "," + str(parameter) + "\n" else: return elif code == RMNotification.rainDelay: isRainDelay = (globalSettings.restrictions.globalRestrictions.rainDelayDuration + globalSettings.restrictions.globalRestrictions.rainDelayStartTime) > rmCurrentTimestamp() \ and globalSettings.restrictions.globalRestrictions.rainDelayStartTime <= rmCurrentTimestamp() if RMNotification._rainDelayFlag != isRainDelay: RMNotification._rainDelayFlag = isRainDelay string = code + "," + str(int(isRainDelay)) + "\n" else: return elif code == RMNotification.rainSensor: if action != RMNotification._rainFlag: RMNotification._rainFlag = action string = code + "," + str(int(action)) + "\n" else: return elif code == RMNotification.cloudClient: string = code + "\n" else: if len(str(parameter)): string = str(code) + ',' + str(action) + "," + str(parameter) + "\n" else: string = str(code) + ',' + str(action) + "\n" RMNotification.__writeNotification(string)
def expiresIn(self): if self.expiration: return self.expiration - rmCurrentTimestamp() return None
def updateThread(self): ### Call this method from the thread you want to update. with self.__lock: entry = self.__getThreadEntry(thread.get_ident(), True) entry[RMThreadWatcher.LastUpdateKey] = rmCurrentTimestamp()
def perform( self): # The function that will be executed must have this name # Accessing system location settings #lat = self.settings.location.latitude log.info("Hello KMZ") # Other location settings #self.zip #self.name #self.state #self.latitude #self.longitude #self.address #self.elevation #self.gmtOffset #self.dstOffset #self.stationID #self.stationName #self.et0Average station = self.params.get("station", None) if station is None or station == "": station = "K4086" log.debug("No station set, using (%s)" % station) url = "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/" + str( station) + "/kml/MOSMIX_L_LATEST_" + str(station) + ".kmz" URLParams = [("User-Agent", "RainMachine v2")] try: req = urllib2.Request(url) response = urllib2.urlopen(req) raw = response.read() zipFile = ZipFile(StringIO.StringIO(raw)) kml = zipFile.read(zipFile.filelist[0]) rootNode = ET.fromstring(kml) nameSpaces = { 'dwd': "https://opendata.dwd.de/weather/lib/pointforecast_dwd_extension_V1_0.xsd", 'gx': "http://www.google.com/kml/ext/2.2", 'xal': "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0", 'kml': "http://www.opengis.net/kml/2.2", 'atom': "http://www.w3.org/2005/Atom" } timeStampsNode = rootNode.findall( "./kml:Document/kml:ExtendedData/dwd:ProductDefinition/dwd:ForecastTimeSteps/", nameSpaces) extendedDataNode = rootNode.findall( "./kml:Document/kml:Placemark/kml:ExtendedData/", nameSpaces) nowTimeStamp = rmCurrentTimestamp() skipColumens = 0 # Parse Timestamps timeStampList = [] for ts in timeStampsNode: compatibleString = re.sub(r"\.\d+Z$", '', ts.text) unix = rmTimestampFromDateAsString(compatibleString, "%Y-%m-%dT%H:%M:%S") #ts = datetime.datetime.strptime(compatibleString, "%Y-%m-%dT%H:%M:%S") if (unix < nowTimeStamp): skipColumens += 1 continue timeStampList.append(unix) dwdData = [] parsedData = DWDData() for data in extendedDataNode: currentCol = 0 for k, v in data.attrib.items(): if k.endswith("elementName"): valueNode = data.find("./dwd:value", nameSpaces) if valueNode == None: continue allValues = valueNode.text.split() if skipColumens > 0: rawValues = allValues[skipColumens:] else: rawValues = allValues if len(rawValues) != len(timeStampList): continue # Temperature if v.lower() == "TTT".lower(): parsedData.Temperature = parseFloats( rawValues, timeStampList, temperatureTransformation) continue # Min Temperature if v.lower() == "TN".lower(): parsedData.MinTemp = parseFloats( rawValues, timeStampList, temperatureTransformation) continue # Max Temperature if v.lower() == "TX".lower(): parsedData.MaxTemp = parseFloats( rawValues, timeStampList, temperatureTransformation) continue # Probability of precipitation > 0.0mm during the last hour if v.lower() == "wwP".lower(): parsedData.POP = parseFloats( rawValues, timeStampList) continue # Wind if v.lower() == "FF".lower(): parsedData.Wind = parseFloats( rawValues, timeStampList) continue # Solar Radiation if v.lower() == "Rad1h".lower(): parsedData.SolarRadiation = parseFloats( rawValues, timeStampList, pressureTransformation) continue # Cloud if v.lower() == "Neff".lower(): parsedData.SkyCover = parseFloats( rawValues, timeStampList, skyCoverTransform) continue # QPF if v.lower() == "RRdc".lower(): parsedData.QPF = parseFloats( rawValues, timeStampList, None, yesterday) continue # evapotranspiration if v.lower() == "PEvap".lower(): parsedData.ET0 = parseFloats( rawValues, timeStampList, None, yesterday) continue # Pressure if v.lower() == "PPPP".lower(): parsedData.Pressure = parseFloats( rawValues, timeStampList, pressureTransformation) continue # Dewpoint if v.lower() == "Td".lower(): parsedData.DewPoint = parseFloats( rawValues, timeStampList, temperatureTransformation) continue # Condition if v.lower() == "WPcd1".lower(): parsedData.Condition = parseFloats( rawValues, timeStampList, conditionParser, yesterday) continue log.info("Adding parsed values to database") if parsedData.Temperature != None: log.debug("Adding Temparatures values") self.addValues(RMParser.dataType.TEMPERATURE, parsedData.Temperature) if parsedData.MinTemp != None: log.debug("Adding Min-Temparatures values") self.addValues(RMParser.dataType.MINTEMP, parsedData.MinTemp) if parsedData.MaxTemp != None: log.debug("Adding Max-Temparatures values") self.addValues(RMParser.dataType.MAXTEMP, parsedData.MaxTemp) if parsedData.RH != None: log.debug("Adding RH values") self.addValues(RMParser.dataType.RH, parsedData.RH) if parsedData.Wind != None: log.debug("Adding Wind values") self.addValues(RMParser.dataType.WIND, parsedData.Wind) if parsedData.SolarRadiation != None: log.debug("Adding Solar Radiation values") self.addValues(RMParser.dataType.SOLARRADIATION, parsedData.SolarRadiation) if parsedData.SkyCover != None: log.debug("Adding SkyCover values") self.addValues(RMParser.dataType.SKYCOVER, parsedData.SkyCover) if parsedData.QPF != None: log.debug("Adding QPF values") self.addValues(RMParser.dataType.QPF, parsedData.QPF) if parsedData.ET0 != None: log.debug("Adding ET0 values") #self.addValues(RMParser.dataType.ET0, parsedData.ET0) if parsedData.POP != None: log.debug("Adding POP values") self.addValues(RMParser.dataType.POP, parsedData.POP) if parsedData.Pressure != None: log.debug("Adding Pressure values") self.addValues(RMParser.dataType.PRESSURE, parsedData.Pressure) if parsedData.DewPoint != None: log.debug("Adding DewPoint values") self.addValues(RMParser.dataType.DEWPOINT, parsedData.DewPoint) if parsedData.Condition != None: self.addValues(RMParser.dataType.CONDITION, parsedData.Condition) except Exception, e: log.error("*** Error running DWD parser") log.exception(e)
def __getUploadFolderName(self): return globalSettings.netName + "-SPK-" + str(globalSettings.hardwareVersion) + "-" \ + globalWIFI.wifiInterface.macAddress + "-" + str(rmCurrentTimestamp())