Simple MQTT question

66 views
Skip to first unread message

cric...@pobox.com

unread,
Feb 18, 2023, 1:26:47 PM2/18/23
to weewx-user
In the process of debugging a non-weewx problem, I realized that weewx is publishing all observations, even those there's a list to be published defined in weewx.conf:
[StdRESTful]
    [[StationRegistry]]
        register_this_station = false
    [[MQTT]]
        server_url = mqtt://router1.csrhome.home:1883
        topic = weather
        unit_system = US
        qos = 2        # options are 0, 1, 2
        retain = true  # options are true or false
        aggregation = individual
        binding = archive
        [[[inputs]]]
            [[[[dateTime]]]]
                name   = weewx_time
                format = %d
                units  = unix_epoch
            [[[[inTemp]]]]
                name   = inside_temperature
                format = %.2f
                units  = degree_F
            [[[[outTemp]]]]
                name   = outside_temperature
                format = %.2f
                units  = degree_F
            [[[[windchill]]]]
                name   = outside_wc_temp
                format = %.2f
                units  = degree_F
            [[[[windGust]]]]
                name   = windGust
                format = %.1f
                units  = mile_per_hour

Reading the mqtt,py code (class MQTT), I found the description for obs_to_upload.  To  publish just the items in the input list, just add 'obs_to_upload = None' under [[MQTT]],
say after the aggregation = individual?
Thx, Chris

vince

unread,
Feb 18, 2023, 2:13:07 PM2/18/23
to weewx-user
From the comments in the top of the code:
       "Use the inputs map to customize name, format, or unit for any observation."
So it's not defining what is published.  It's customizing 'some' of what is published.

And also in the comments:
    obs_to_upload: Which observations to upload. Possible values are
    none or all. When none is specified, only items in the inputs list
    will be uploaded. When all is specified, all observations will be
    uploaded, subject to overrides in the inputs list.
    Default is all

So yes. Set debug=1 in weewx.conf and try it.  You can't break anything.

cric...@pobox.com

unread,
Feb 18, 2023, 4:16:44 PM2/18/23
to weewx-user
I skipped setting debug=1, but the config change does seem to work.  The original issue was that my thermostat, which
displays setpoint and current inside temp, as well as outside temp and wild chill when there is one, was 'stuck' with an outdated
outside temp, which it gets over mqtt from weewx.  The fault was on the thermostat end, a restart of that code cleared the issue, and
I'm testing some changes there to see what's up.  Wifey thinks I'm a bit nutty, but it keeps me out of the bars.  :^)

Thx, Chris

Reply all
Reply to author
Forward
0 new messages