Skip to content

Installing and updating version 3.x with WeeWX 4.x

Rich Bell edited this page Jan 28, 2024 · 11 revisions

Installing version 3.x withh WeeWX version 4.x

Note:, without workarounds WeeWX 4.x does not support python 3.12 and higher. See this discussion for additional information.

Note:, in 4.6.1 WeeWX fixed 737. This resulted in different test results and therefore technically MQTTSubscribe only supports WeeWX 4.6.1+.

Prerequisites

Because there are multiple methods to install WeeWX V5, location of files can vary. See for the definitive information. The following symbolic names are used to define the various locations:

  • $BIN_ROOT - Executables
  • $USER_ROOT - User directory
  • $CONFIG_FILE - The WeeWX configuration file (This is not typically in the WEEWX documentation)

The notation vX.Y.Z designates the version of MQTTSubscribe being installed.

Prior to making any updates/changes, always make a backup.

Set the mode that MQTTSubscribe will be running in

If running as a driver,

RUN_MODE=driver

If running as a service,

RUN_MODE=service

Set the file locations

For package installs

BIN_ROOT=/usr/share/weewx
USER_ROOT=/usr/share/weewx/user
CONFIG_FILE=/etc/weewx/weewx.conf
DOWNLOAD_DIR=/tmp

For setup.py installs

BIN_ROOT=/home/weewx/bin
USER_ROOT=/home/weewx/bin/user
CONFIG_FILE=/home/weewx/weewx.conf
DOWNLOAD_DIR=/tmp

Install MQTTSubscribe

$BIN_ROOT/wee_extension --install=$DOWNLOAD_DIR/vX.Y.Z.tar.gz

Note: For package installs, the above command needs to be prefixed with sudo (sudo $BIN_ROOT/wee_extension ...)

Create an example configuration

PYTHONPATH=$BIN_ROOT python3 $USER_ROOT/MQTTSubscribe.py configure --create-example mqttsubscribe.template.conf

Configure MQTTSubscribe

Note, MQTTSubscribeDriver can also be configured and weewx.conf updated interactively via weectl station. This method has the following disadvantages:

  • The options that can be configured are limited.
  • The configuration options can not be validated and tested before restarting WeeWX.
  1. Edit the mqttsubscribe.template.conf file

    For example,

    nano mqttsubscribe.template.conf
    
  2. Validate and test the mqttsubscribe.template.conf file

    PYTHONPATH=$BIN_ROOT python3 $USER_ROOT/MQTTSubscribe.py configure $RUN_MODE --validate --conf mqttsubscribe.template.conf
    
    PYTHONPATH=$BIN_ROOT python3 $USER_ROOT/MQTTSubscribe.py simulate $RUN_MODE --conf mqttsubscribe.template.conf
    

Additional information on running MQTTSubscribe in configuration mode can be found at this wiki page.

Additional information on running MQTTSubscribe in simulation mode can be found at this wiki page.

If running as a driver, set driver to MQTTSubcribe

$BIN_ROOT/wee_config --reconfigure --driver=user.MQTTSubscribe --no-prompt

Note: For package installs, the above command needs to be prefixed with sudo (sudo $BIN_ROOT/wee_config ...)

Update WeeWX with MQTTSubscribe's configuration

PYTHONPATH=$BIN_ROOT python3 $USER_ROOT/MQTTSubscribe.py configure $RUN_MODE --replace-with mqttsubscribe.template.conf --conf $CONFIG_FILE

Note: For package installs, the above command needs to be prefixed with sudo (sudo PYTHONPATH=$BIN_ROOT python3 ...)

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