Skip to content

Running as a driver in standalone mode

Rich Bell edited this page Dec 3, 2023 · 4 revisions

Running MQTTSubscribeDriver "standalone"

Removed in version 3

The driver can be run in "standalone" mode. In this mode, the MQTT data is processed but not written to the database. This enables one to debug without corrupting the data in the database. Depending on one's comfort level with python and weewx, MQTTSubscribe could be run in this mode prior to installation to determine the correct configuration options.

Assuming that MQTTSubscribe has been installed as a driver, the typical invocation would be something like

PYTHONPATH=$BIN_ROOT python $BIN_ROOT/user/MQTTSubscribe.py <options> $CONFIG_ROOT/weewx.conf

where:
$BIN_ROOT - The directory where WeeWX executables are located.
$CONFIG_ROOT - The directory where the configuration (typically, weewx.conf) is located.
Because there are multiple methods to install WeeWX, location of files can vary. See where to find things in the WeeWX User's Guide for the definitive information.

and <options> might be:

--type=driver --binding=loop --records=2  

where:
--type=driver, says to run MQTTSubscribeDriver.
--binding=loop, says that MQTTSubscribeDriver is bound to loop and therefore loop packets will be generated.
--records=2, says to exit after 2 loop packets have been created.

Run MQTTSubscribe.py with --help to see all the command line options.

Getting Started

    Prerequisites
    Required MQTT information
    Required WeeWX information
    Installing MQTTSubscribe
    Configuring MQTTSubscribe
    Running MQTTSubscribe with WeeWX
    Debugging

Common Options

    Main section
    The [[topics]] section
    The [[[message]]] section
    The [[[topic-name]]] section
    The [[[[field-name]]]] section

Additional Options

    Main section
    The [[tls]] section
    The [[topics]] section
    The [[[topic-name]]] section
    The [[[[field-name]]]] section

Date/Time Processing Options

Experimental Options

Configurator Mode

    Environment setup
    Invocation
    Options

Simulator Mode

    Environment setup
    Invocation
    driver simulation options
    service simulation options

Parser Mode

    Environment setup
    Invocation
    Options

Example individual Configuration

Example json Configuration

    Simple json message
    'Nested' json message
    json message with array

Example keyword Configuration

Example Configuration with multiple types

Example unit and unit group customization

FAQ

Debugging
Understanding The log

    Initialization
    MQTT Initialization
    MQTTSubscribeDriver secondary thread processing
    MQTTSubscribeDriver primary thread processing
    MQTTSubscribeService secondary thread processing
    MQTTSubscribeService primary thread processing

Supporting Additional message types
Development Environment
Deprecated Documentation

     Configuring pre 1.6.0
     Options Removed In 2.0.0
     Using test_mqtt.py To Check MQTT
     Running As A driver In Standalone Mode
     Running As A service In Standalone Mode

Clone this wiki locally