コード例 #1
0
ファイル: brewpi.py プロジェクト: zacharybussey/fermentrack
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
ファイル: brewpi.py プロジェクト: zacharybussey/fermentrack
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
ファイル: brewpi.py プロジェクト: zacharybussey/fermentrack
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
ファイル: brewpi.py プロジェクト: zacharybussey/fermentrack
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
ファイル: brewpi.py プロジェクト: ServerFarm3r/fermentrack
    if o in ('-d', '--dontrunfile'):
        checkDontRunFile = True
    if o in ('--checkstartuponly'):
        checkStartupOnly = True

# Alright. We're modifying how we load the configuration file to allow for loading both from a database, and from the
# actual file-based config.

# If dbConfig wasn't set, we can't proceed (as we have no controller to manage)
if dbConfig is None:
    raise NotImplementedError(
        'Only dbconfig installations are supported in this version of brewpi-script'
    )

if dbConfig.status == models.BrewPiDevice.STATUS_ACTIVE or dbConfig.status == models.BrewPiDevice.STATUS_UNMANAGED:
    config = util.read_config_from_database_without_defaults(dbConfig)
else:
    logMessage(
        "This instance of BrewPi is currently disabled in the web interface. Reenable it and relaunch "
        "this script. This instance will now exit.")
    exit(0)

# check for other running instances of BrewPi that will cause conflicts with this instance
pidFile = pid.PidFile(piddir=pidFileDir, pidname=brewpiName)
try:
    pidFile.create()
except pid.PidFileAlreadyLockedError:
    if not checkDontRunFile:  # Even for database configurations, we don't want to log this if the gatekeeper launched me
        logMessage(
            "Another instance of BrewPi is already running, which will conflict with this instance. "
            "This instance will exit")