Exemple #1
0
def getRecordingDetailsByIndex(index):
	logDictionary = logHelper.getLogDictionary()
	#data_string = ""		
	log = logDictionary["saved_logs"][int(index)]
	name = unicodeHelper.getAscii(log["log_name"])
	#data_string = "saved_log_details=" + name + "," + log["start_date"] + "," + log["duration"] 
	dataDict = {'name': name, 'start_date': log['start_date'], 'time': log['duration']}
	return unicodeHelper.getAscii(str(dataDict))
Exemple #2
0
def getRecordingDetailsByIndex(index):
    logDictionary = logHelper.getLogDictionary()
    #data_string = ""
    log = logDictionary["saved_logs"][int(index)]
    name = unicodeHelper.getAscii(log["log_name"])
    #data_string = "saved_log_details=" + name + "," + log["start_date"] + "," + log["duration"]
    dataDict = {
        'name': name,
        'start_date': log['start_date'],
        'time': log['duration']
    }
    return unicodeHelper.getAscii(str(dataDict))
Exemple #3
0
 def isValidFilename(self, name):
     isValid = True
     name = unicodeHelper.getAscii(name).lower()
     acceptableChars = ('abcdefghijklmnopqrstuvwxyz0123456789')
     for char in name:
         if char not in acceptableChars:
             isValid = False
             break
     return isValid
Exemple #4
0
	def isValidFilename(self, name):
		isValid = True
		name = unicodeHelper.getAscii(name).lower()
		acceptableChars = ('abcdefghijklmnopqrstuvwxyz0123456789')
		for char in name:
			if char not in acceptableChars:
				isValid = False
				break
		return isValid
Exemple #5
0
def getCurrentRecordingDetails():
	currentLog = logHelper.getCurrentLog()
	logList = []
	name = ""
	duration = ""
	startTime = ""
	if currentLog:
		name = unicodeHelper.getAscii(currentLog["log_name"])
		duration = getCurrentRecordingElapsedTime()
	dataDict = {'name': name, 'time': str(duration)}
	
	return str(dataDict)
Exemple #6
0
    def buildAndQueueReadingsMessage(self):

        data_string = ""

        temp_reading_num = 1
        inputList = []
        for inputNumber in configuration.Parameters.CurrentTempList:
            inputDict = {}

            name = configuration.InputList[inputNumber].Name
            value = 0
            value = CurrentIO.getInputState(name)

            if value != None:
                inputDict = {
                    'name': unicodeHelper.getAscii(name),
                    'value': value
                }

            inputList.append(inputDict)
            temp_reading_num += 1

        setPoint = str(configuration.Parameters.SetPoint)

        outputState = CurrentIO.getOutputState('controlOutput')
        stateString = ''

        if outputState:
            stateString = 'on'
        else:
            stateString = 'off'

        cookString = str(recorder.getCurrentRecordingElapsedTime())

        if CurrentIO.ShouldControl:
            controlStyle = 'Auto'
        else:
            controlStyle = 'Manual'

        dataDict = {
            'secret': 'badass',
            'target': 'periodic_update',
            'value': {
                'input': inputList,
                'set_point': setPoint,
                'cook_time': cookString,
                'output_state': stateString,
                'control_style': controlStyle
            }
        }
        #simpleServer.send(dataDict)
        self.sendQueue.put(str(dataDict))
        reactor.callFromThread(self.dispatch)
Exemple #7
0
def getCurrentRecordingDetails():
    currentLog = logHelper.getCurrentLog()
    logList = []
    name = ""
    duration = ""
    startTime = ""
    if currentLog:
        name = unicodeHelper.getAscii(currentLog["log_name"])
        duration = getCurrentRecordingElapsedTime()
    dataDict = {'name': name, 'time': str(duration)}

    return str(dataDict)
Exemple #8
0
   def buildAndQueueReadingsMessage(self):
      
      data_string = ""
      temp_reading_num = 1
      inputList = []
      for inputNumber in configuration.Parameters.CurrentTempList:
         inputDict = {}
         
         name = configuration.InputList[inputNumber].Name
         value = 0
         value = CurrentIO.getInputState(name)        
                  
         if value != None:
            inputDict = {
                        'name': unicodeHelper.getAscii(name), 
                        'value': value
                     } 

         inputList.append(inputDict)
         temp_reading_num += 1                                            
                           
      setPoint = str(configuration.Parameters.SetPoint)
      hysteresis = str(configuration.Parameters.Hysteresis)
      outputState = CurrentIO.getOutputState('controlOutput')
      stateString = ''
      
      if outputState:
         stateString = 'on'
      else :
         stateString = 'off'     
      
      cookString =  "0h00m" #str(recorder.getCurrentRecordingElapsedTime()) #phant TODO
      
      if CurrentIO.ShouldControl:
         controlStyle = 'Auto'
      else:
         controlStyle = 'Manual'
         
            
      dataDict = {
               'secret':'badass', 
               'target':'periodic_update', 
               'value': { 
                        'input':inputList, 
                        'set_point': setPoint,                       
                        'cook_time': cookString, 
                        'output_state': stateString,
                        'control_style': controlStyle,
                        'hysteresis': hysteresis                        
                       }
               }
      self.sock.send(str(dataDict))
Exemple #9
0
	def GetMenuData(self):
		choiceList = []
		probeNamesString = ""
		for input in configuration.InputList:
			choiceList.append(unicodeHelper.getAscii(input.Name)) 
		'''
		resultList.append("control_menu_input_names=" + probeNamesString)
		resultList.append("control_menu_hysteresis=" + str(configuration.Parameters.Hysteresis))
		resultList.append("control_menu_selected_input=" + str(configuration.InputList[configuration.Parameters.ControlInput].Name))
		'''
		dataDict = {'choices':choiceList, 'hysteresis':str(configuration.Parameters.Hysteresis), 'selected':str(configuration.InputList[configuration.Parameters.ControlInput].Name)}
		
		return placeResponseInMessage(str(dataDict), 'control_menu')
Exemple #10
0
def getDataset(log):
    dataDict = {}
    fs = filesystem.filesystem()

    if fs.file_exists(log):

        data = fs.read_from_file(log)

        for index in range(len(data)):
            data[index][2] = data[index][2].replace(" ", "T")

        dataDict = {"title": unicodeHelper.getAscii(log), "graphData": data}

    return str(dataDict)
Exemple #11
0
def getDataset(log):
	dataDict = {}
	fs = filesystem.filesystem()

	if fs.file_exists(log):

		data = fs.read_from_file(log)

		for index in range(len(data)):
			data[index][2] = data[index][2].replace(" ", "T")
			
		dataDict = {"title": unicodeHelper.getAscii(log), "graphData": data}

	return str(dataDict)
Exemple #12
0
def listAllRecordings():
	logDictionary = logHelper.getLogDictionary()
	logIndex = 0
	dataList = []
	for savedLog in logDictionary["saved_logs"]:
		nameListString = savedLog["log_name"] + '_' + savedLog["start_date"] + '_' + str(logIndex)
		nameListString = unicodeHelper.getAscii(nameListString)
		dataDict = {'name': nameListString}
		dataList.append(dataDict)
		logIndex += 1
	
	if len(dataList) == 0:
		dataList.append('empty')
			
	return str(dataList)
Exemple #13
0
def listAllRecordings():
    logDictionary = logHelper.getLogDictionary()
    logIndex = 0
    dataList = []
    for savedLog in logDictionary["saved_logs"]:
        nameListString = savedLog["log_name"] + '_' + savedLog[
            "start_date"] + '_' + str(logIndex)
        nameListString = unicodeHelper.getAscii(nameListString)
        dataDict = {'name': nameListString}
        dataList.append(dataDict)
        logIndex += 1

    if len(dataList) == 0:
        dataList.append('empty')

    return str(dataList)
Exemple #14
0
    def GetMenuData(self):
        choiceList = []
        probeNamesString = ""
        for input in configuration.InputList:
            choiceList.append(unicodeHelper.getAscii(input.Name))
        '''
		resultList.append("control_menu_input_names=" + probeNamesString)
		resultList.append("control_menu_hysteresis=" + str(configuration.Parameters.Hysteresis))
		resultList.append("control_menu_selected_input=" + str(configuration.InputList[configuration.Parameters.ControlInput].Name))
		'''
        dataDict = {
            'choices':
            choiceList,
            'hysteresis':
            str(configuration.Parameters.Hysteresis),
            'selected':
            str(configuration.InputList[
                configuration.Parameters.ControlInput].Name)
        }

        return placeResponseInMessage(str(dataDict), 'control_menu')
Exemple #15
0
def updateGUI():
	fan_control = ''
	hysteresis = configuration.Parameters.Hysteresis
	setPoint = configuration.Parameters.SetPoint
	goal_temp = configuration.Parameters.MeatTemperatureGoal
	if CurrentIO.ShouldControl:
		fan_control = 'auto'
	else:
		if CurrentIO.getOutputState('controlOutput'):
			fan_control = 'on'
		else:
			fan_control = 'off'


	temp_units = configuration.Parameters.Units;
	controlInput = configuration.Parameters.ControlInput
	controlInputName = configuration.InputList[controlInput].Name
	currentTempList = configuration.Parameters.CurrentTempList
	currentTempName1 = str(configuration.InputList[currentTempList[0]].Name)
	currentTempName2 = str(configuration.InputList[currentTempList[1]].Name)
	dataListDict = {	
						'secret': 'badass', 
						'target': 'initial_update', 
						'value': {
							'set_point_input_name':str(controlInputName),
							'set_point_value':setPoint,
							'current_temp_1_name':currentTempName1,
							'current_temp_2_name':currentTempName2,
							'fan_control':fan_control,
							'hysteresis':hysteresis,
							'meat_temperature_goal': goal_temp,
							'temperature_units': unicodeHelper.getAscii(temp_units)
							}
					}
	
	return str(dataListDict)
Exemple #16
0
def getAllReadingsFromCurrentRecording(readingType):
	currentLog = logHelper.getCurrentLog()	
	dbName = currentLog["log_name"] + currentLog["start_date"]
	dbName = unicodeHelper.getAscii(dbName)
	return db.readSavedDatabaseValues(dbName, readingType)
Exemple #17
0
def getAllReadingsFromCurrentRecording(readingType):
    currentLog = logHelper.getCurrentLog()
    dbName = currentLog["log_name"] + currentLog["start_date"]
    dbName = unicodeHelper.getAscii(dbName)
    return db.readSavedDatabaseValues(dbName, readingType)