Skip to content

Installing paho‐mqtt package

Rich Bell edited this page Jan 29, 2024 · 2 revisions

Installing the paho-mqtt package

I am not an expert on packaging, corrections and clarifications welcome!

Outside any virtual environment

Performing pip install paho-mqtt or any of its variants, pip3, python3 -m pip, etc. performs a 'local install'. If WeeWX was installed via the OS package manager, sudo is required to install MQTTSubscribe. When sudo is used, the local installation of paho-mqtt will not be found.

One way to get around this is to use sudo pip install paho-mqtt. This is discouraged because installing python packages this way may break system dependencies.

The preferred way appears to be, installing paho-mqtt with the OS package manager. The package python3-paho-mqtt seems to be widely available. So for exampke on debian flavors of linux it would be sudo apt install python3-paho-mqtt.

Using a virtual environment

Because you are in a virtual environment, pip install paho-mqtt installs into that environment and the OS is protected.

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