Пример #1
0
def stopLogging():
    global config
    logMessage("Stopped data logging, as requested in web interface. " +
               "BrewPi will continue to control temperatures, but will not log any data.")
    config = util.configSet(configFile, dbConfig, 'beerName', None)
    config = util.configSet(configFile, dbConfig, 'dataLogging', 'stopped')
    return {'status': 0, 'statusMessage': "Successfully stopped logging"}
Пример #2
0
def startNewBrew(newName):
    global config
    if len(newName) > 1:     # shorter names are probably invalid
        config = util.configSet(configFile, dbConfig, 'beerName', newName)
        config = util.configSet(configFile, dbConfig, 'dataLogging', 'active')
        logMessage("Notification: Restarted logging for beer '%s'." % newName)
        return {'status': 0, 'statusMessage': "Successfully switched to new brew '%s'. " % urllib.unquote(newName) +
                                              "Please reload the page."}
    else:
        return {'status': 1, 'statusMessage': "Invalid new brew name '%s', "
                                              "please enter a name with at least 2 characters" % urllib.unquote(newName)}
Пример #3
0
def resumeLogging():
    global config
    logMessage("Continued logging data, as requested in web interface.")
    if config['dataLogging'] == 'paused':
        config = util.configSet(configFile, dbConfig, 'dataLogging', 'active')
        return {'status': 0, 'statusMessage': "Successfully continued logging."}
    elif config['dataLogging'] == 'stopped':
        if dbConfig.active_beer is not None:
            config = util.configSet(configFile, dbConfig, 'dataLogging', 'active')
            return {'status': 0, 'statusMessage': "Successfully continued logging."}
    # If we didn't return a success status above, we'll return an error
    return {'status': 1, 'statusMessage': "Logging was not resumed."}
Пример #4
0
def pauseLogging():
    global config
    logMessage("Paused logging data, as requested in web interface. " +
               "BrewPi will continue to control temperatures, but will not log any data until resumed.")
    if config['dataLogging'] == 'active':
        config = util.configSet(configFile, dbConfig, 'dataLogging', 'paused')
        return {'status': 0, 'statusMessage': "Successfully paused logging."}
    else:
        return {'status': 1, 'statusMessage': "Logging already paused or stopped."}
Пример #5
0
     cs['mode'] = 'o'
     bg_ser.writeln("j{mode:o}")
     models.BrewPiDevice.objects.get(
         device_name=a
     )  # Reload dbConfig from the database (in case we were using profiles)
     logMessage("Notification: Temperature control disabled")
     raise socket.timeout
 elif messageType == "setParameters":
     # receive JSON key:value pairs to set parameters on the controller
     try:
         decoded = json.loads(value)
         bg_ser.writeln("j" + json.dumps(decoded))
         if 'tempFormat' in decoded:
             if decoded['tempFormat'] != config.get('temp_format', 'C'):
                 # For database configured installs, we save this in the device definition
                 util.configSet(configFile, dbConfig, 'temp_format',
                                decoded['tempFormat'])
             dbConfig = models.BrewPiDevice.objects.get(
                 id=dbConfig.id)  # Reload dbConfig from the database
     except ValueError:
         logMessage("Error: invalid JSON parameter string received: " +
                    value)
     raise socket.timeout
 elif messageType == "stopScript":  # exit instruction received. Stop script.
     # voluntary shutdown.
     log_message = "stopScript message received on socket. "
     run = 0
     log_message += "dbConfig in use - assuming device status was already properly updated "
     log_message += "to prevent automatic restart"
     logMessage(log_message)
     continue
 elif messageType == "quit":  # quit instruction received. Probably sent by another brewpi script instance