Skip to content

Support for weewx mqtt

David Baetge edited this page Jul 6, 2023 · 9 revisions

The skin supports live updates for the gauge charts, stat tiles of the alternative layout and the table of the classic layout on the front page. This is done via MQTT, a machine to machine protocoal used by your WeeWX installation to send LOOP data to a broker (eg. Mosquitto). The website will connect to that Message Broker (via a protocal called WebSockets) and will wait for new messages (LOOP data) to arrive.

To enable this on the website, modify the [[WdcReport]] section of the weewx.conf or the [[mqtt]] section of the skin.conf to match your brokers data:

weewx.conf:

[[WdcReport]]
    skin = weewx-wdc
    enable = true
    lang = en
    [[[Extras]]]
        [[[[mqtt]]]]
            mqtt_websockets_enabled = 1
            mqtt_websockets_host = example.host.lan
            mqtt_websockets_port = 9001
            mqtt_websockets_ssl = 0
            mqtt_websockets_topic = weather/loop

skin.conf:

[[mqtt]]
    mqtt_websockets_enabled = 1
    mqtt_websockets_host = example.host.lan
    mqtt_websockets_port = 9001
    mqtt_websockets_ssl = 0
    mqtt_websockets_topic = weather/loop

For topic, you should choose the topic where your loop data get published to, defaults to weather/loop.

For weewx-mqtt, Iam using this configuration override:

[[MQTT]]
    server_url = mqtt:https://...
    topic = weather
    unit_system = METRIC
    binding = loop
    [[[inputs]]]
        [[[[windSpeed]]]]
            format = %.0f
        [[[[windGust]]]]
            format = %.0f
MQTT

Once connected, you should see this success message.

Requirements

append_units_label must be the default value TRUE. If you set this to FALSE, it won't work (https://github.com/weewx/weewx/wiki/mqtt#options).

Units

MQTT needs to publish the records with the same unit, you configure for the skin. E.g. if you are using mm instead of cm for rain or rainRate, you need to also tell weewx-mqtt to publish the rain values in mm:

[StdRESTful]
    [[MQTT]]
        ...
        [[[inputs]]]
            [[[[dayRain]]]]
                units = mm
            [[[[rainRate]]]]
                units = mm_per_hour

Useful resources