weewx MQTTSubscribe ValueError: [[topics]]

146 views
Skip to first unread message

David Salinas

unread,
Apr 15, 2025, 7:07:57 AM4/15/25
to weewx-user

Hi, I'm quite new and I've been struggling with Weewx and MQTT for almost a month. I've made a lot of progress but I'm stuck. I can't find the same problem online.
I have a weather station far from my house connected to an MQTT server that I used for home assistant, since I have the data I wanted to upload it to weewx .

Error:
root@my-vps:~# sudo systemctl status weewx
× weewx.service - WeeWX
     Loaded: loaded (/lib/systemd/system/weewx.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2025-04-15 09:55:03 UTC; 1h 9min ago
   Duration: 1.203s
       Docs: https://weewx.com/docs
    Process: 2391087 ExecStart=weewxd /etc/weewx/weewx.conf (code=exited, status=1/FAILURE)
   Main PID: 2391087 (code=exited, status=1/FAILURE)
        CPU: 168ms

Apr 15 09:55:03 my-vps weewxd[2391087]:   File "/etc/weewx/bin/user/MQTTSubscribe.py", line 1832, in get_subscriber
Apr 15 09:55:03 my-vps weewxd[2391087]:     return MQTTSubscriberV1(service_dict, logger)
Apr 15 09:55:03 my-vps weewxd[2391087]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 15 09:55:03 my-vps weewxd[2391087]:   File "/etc/weewx/bin/user/MQTTSubscribe.py", line 2011, in __init__
Apr 15 09:55:03 my-vps weewxd[2391087]:     super().__init__(service_dict, logger)
Apr 15 09:55:03 my-vps weewxd[2391087]:   File "/etc/weewx/bin/user/MQTTSubscribe.py", line 1751, in __init__
Apr 15 09:55:03 my-vps weewxd[2391087]:     raise ValueError("[[topics]] is required.")
Apr 15 09:55:03 my-vps weewxd[2391087]: ValueError: [[topics]] is required.
Apr 15 09:55:03 my-vps systemd[1]: weewx.service: Main process exited, code=exited, status=1/FAILURE
Apr 15 09:55:03 my-vps systemd[1]: weewx.service: Failed with result 'exit-code'.

Data mqtt home/OMG_lilygo_rtl_433_ESP_OOK/RTL_433toMQTT/Bresser-6in1/0/336595588
 {"model":"Bresser-6in1","id":336595588,"channel":0,"sensor_type":1,"wind_max_m_s":6.6,"wind_avg_m_s":5.8,"wind_dir_deg":202,"rain_mm":714.4,"startup":1,"flags":1,"mic":"CRC","protocol":"Bresser Weather Center 6-in-1, 7-in-1 indoor, soil, new 5-in-1, 3-in-1 wind gauge, Froggit WH6000, Ventus C8488A","rssi":-62,"duration":33000}


thanks, I'm stuck and even though I'm learning a lot it's frustrating.

weewx.confNO PASSWORD.txt

Mike B.

unread,
Apr 15, 2025, 8:26:56 AM4/15/25
to weewx-user
Hi David,

I compared your config to mine. Looks like your [[topics]] is incorrectly indented. It needs to be indented in at the indentation of "username". Below is my config that is working.

Mike

[MQTTSubscribeService]
    enable = True
    stop_on_validation_errors = true
    binding = loop

    host = host
    log = true
    password = pwd
    port = 1111
    username = xxx

    [[tls]]
        enable = false
        ca_certs = ""
        certfile = None
        certs_required = required
        ciphers = None
        keyfile = None
        tls_version = tlsv12

    [[message_callback]]
        type = json

    [[topics]]
        unit_system = METRIC

        [[[home/rtl_433/temperature/name/pool]]]
            [[[[temperature]]]]
                # The WeeWX name.
                # Default is the name from MQTT.
                name = extraTemp2
                conversion_type = float

            [[[[battery]]]]
                ignore = true

            [[[[time]]]]
                ignore = true

bell...@gmail.com

unread,
Apr 15, 2025, 11:24:03 AM4/15/25
to weewx-user
Unfortunately using ‘sudo systemctl status weewx’ does not display enough of the log. Please see, https://github.com/weewx/weewx/wiki/view-logs  for information on getting the log information and post/attach it.
Thanks. rich

David Salinas

unread,
Apr 22, 2025, 2:52:28 PM4/22/25
to weewx-user
I've tried indentation in several ways. Sometimes it starts without errors, but after a few seconds, the error returns.

I'm starting to think I'm messing with mqttdriver or mqttservice. weewx is installed from a DEB package.


● weewx.service - WeeWX

     Loaded: loaded (/lib/systemd/system/weewx.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-04-22 18:51:50 UTC; 731ms ago
       Docs: https://weewx.com/docs
   Main PID: 2998158 (weewxd)
      Tasks: 2 (limit: 1022)
     Memory: 15.0M
        CPU: 91ms
     CGroup: /system.slice/weewx.service
             └─2998158 /usr/bin/python3 /usr/local/bin/weewxd /etc/weewx/weewx.conf

Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) username is casa
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) min_delay is 1
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) max_delay is 120
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) password is set
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) Wait before retry is 2
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) Waiting for MQTT connection.
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) Connected with result code 0
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) Connected flags {'session present': 0}
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) Subscribing to home/OMG_lilygo_rtl_433_ESP_OOK/RTL_433toMQTT/Bresser-6in1/0/336595588 has a mid 1 and rc 0
Apr 22 18:51:50 my-vps weewxd[2998158]: INFO user.MQTTSubscribe: (Driver) Subscribed to mid: 1 is size 1 has a QOS of 0

vince

unread,
Apr 22, 2025, 5:52:25 PM4/22/25
to weewx-user
Indentation (ie. the number of leading spaces) is never needed in .conf files in my experience. What does matter is how many [ ] is used. (having items defined as [[[ abc ]]] in a [[ xyz ]] section for example.)

Is the problem that you are seeing no data, is weewx aborting, or something else? Your posts are a bit too minimal to understand.

I do not see a temperature_C element in the mqtt subscribe snippet in your other posts above.
Reply all
Reply to author
Forward
0 new messages