How to use the mqttwarn.configuration.load_configuration function in mqttwarn

To help you get started, we’ve selected a few mqttwarn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jpmens / mqttwarn / tests / util.py View on Github external
def core_bootstrap(configfile=None):
    """
    Bootstrap the core machinery without MQTT
    """

    # Load configuration file
    config = load_configuration(configfile)

    # Bootstrap mqttwarn.core
    bootstrap(config=config, scriptname='testdrive')

    # Load services
    services = config.getlist('defaults', 'launch')
    load_services(services)

    # Launch worker threads to operate on queue
    start_workers()
github jpmens / mqttwarn / mqttwarn / commands.py View on Github external
def launch_plugin_standalone(plugin, data):
    # Load configuration file
    scriptname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
    config = load_configuration(name=scriptname)

    # Setup logging
    setup_logging(config)
    logger.info('Running service plugin "{}" with data "{}"'.format(plugin, data))

    # Launch service plugin
    run_plugin(config=config, name=plugin, data=data)
github jpmens / mqttwarn / mqttwarn / commands.py View on Github external
def run_mqttwarn():

    # Script name (without extension) used as last resort fallback for config/logfile names
    scriptname = os.path.splitext(os.path.basename(sys.argv[0]))[0]

    # Load configuration file
    config = load_configuration(name=scriptname)

    # Setup logging
    setup_logging(config)
    logger.info("Starting {}".format(scriptname))
    logger.info("Log level is %s" % logging.getLevelName(logger.getEffectiveLevel()))

    # Handle signals
    signal.signal(signal.SIGTERM, cleanup)
    signal.signal(signal.SIGINT, cleanup)

    # Bootstrap mqttwarn.core
    bootstrap(config=config, scriptname=scriptname)

    # Connect to broker and start listening
    connect()