Skip to content

individual example

Rich Bell edited this page Jan 30, 2024 · 4 revisions

individual examples

In this example there are 3 topics, topic/id, topic/temp1, and topic/outTemp.

  1. On topic/id, a single value is published in the message. It is desired to ignore this data. This is easily accomplished by not configuring this topic.

  2. On topic/temp1, a temperature is published in the message. This tempurature is measured in Celsius, but needs to stored as Farenheit. This value should be stored in the WeeWX field extraTemp1.

  3. On topic/outTemp, a temperature is published in the message. This temperature is measured in Fahrenheit, the unit of measurement it should be saved as. This value should be stored in the WeeWX field outTemp.

The configuration below accomplishes this. This example leverages MQTTSubscribe's default values. To see a more complete template see, https://github.com/bellrichm/WeeWX-MQTTSubscribe/blob/master/mqttsubscribe.example.conf.

Common options is a reference of the most common options.

[MQTTSubscribeService or MQTTSubscribeDriver]
    # The driver to use.
    # Only used by the driver.
    driver = user.MQTTSubscribe
    
    # Turn the service on and off.
    # Default is true.
    # Only used by the service.
    enable = true

    # The MQTT server.
    # Default is: localhost
    host = localhost

    # The port to connect to.
    # Default is: 1883
    port = 1883

    [[topics]]
        # Configuration for the message callback.
        [[[message]]]
            # The format of the MQTT payload.
            # Currently support: individual, json, keyword
            # Must be specified.
            type = individual

        [[[topic/temp1]]]
            # The WeeWX name.
            # Default is the name from MQTT.
            name = extraTemp1

            # The units of the incoming data.
            # Useful if this field's units differ from the topic's unit_system's units.
            # Valid values: see, http://www.weewx.com/docs/customizing.htm#units
            # Default is not set
            units = degree_C

        [[[topic/outTemp]]]
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 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