WeeWX 5.1.0-4 MQTTSubscribe Driver "Topic" Error

27 views
Skip to first unread message

James Michael Wall

unread,
Oct 14, 2025, 6:55:38 PM (2 days ago) Oct 14
to weewx-user
Hello,

I am new to using WeeWX, and am having trouble getting the MQTTSubscribe driver to work properly. I am following the directions found at https://github.com/bellrichm/WeeWX-MQTTSubscribe as best as I can, but some of it is hard for me to understand. My basic understanding of WeeWX and MQTT is very limited, so I am going to do the best I can to explain my problem, provide whatever information necessary, and (hopefully) get this issue resolved so I can get my weather station working.

Here is my Hardware/Software Setup Overview:

Weather Station/MQTT Client/MQTT Publisher:

BC-Robotics 1591B Weatherboard with Raspberry Pico 2W, running MicroPython v1.26.1-2025-09-11. This device is collecting, parsing, and sending data from various weather sensors connected to it over WiFi on my local LAN using umqttsimple. This device is set up as an MQTT client, which publishes the sensor data using the topic "weatherpi" to the MQTT broker on the Raspberry Pi Zero 2W listed below. 

Weather Reciever/MQTT Server/MQTT Broker/MQTT Subscriber/WeeWX Server:

Raspberry Pi Zero 2W, running Raspberry OS "Bookworm" with WeeWX version 5.1.0-4 installed as a Debian package via the WeeWX debian repo instructions. I have installed  Mosquitto version 2.0.11, and python3-paho-mqtt 1.6.1-1. I set up Mosquitto to act as an MQTT broker on this device, subscribed to the topic "weatherpi", which is published by the Pico. I have installed the MQTTSubscribe  driver per the instructions found in the Github link above.

AFAICT, I have everything set up correctly on the Pico, and it is publishing successfully to the Mosquitto MQTT server, but when I run sudo weectl station reconfigure, after going through all the prompts, I get the following error:

Traceback (most recent call last):
  File "/usr/share/weewx/weectl.py", line 75, in <module>
    main()
  File "/usr/share/weewx/weectl.py", line 67, in main
    namespace.func(namespace)
  File "/usr/share/weewx/weectllib/__init__.py", line 90, in dispatch
    namespace.action_func(config_dict, namespace)
  File "/usr/share/weewx/weectllib/station_cmd.py", line 311, in reconfigure_station
    weectllib.station_actions.station_reconfigure(config_dict=config_dict,
  File "/usr/share/weewx/weectllib/station_actions.py", line 164, in station_reconfigure
    config_config(config_dict,
  File "/usr/share/weewx/weectllib/station_actions.py", line 207, in config_config
    config_driver(config_dict, driver=driver, no_prompt=no_prompt)
  File "/usr/share/weewx/weectllib/station_actions.py", line 466, in config_driver
    settings = weecfg.prompt_for_driver_settings(final_driver,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/weewx/weecfg/__init__.py", line 520, in prompt_for_driver_settings
    settings = editor.prompt_for_settings()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/weewx/bin/user/MQTTSubscribe.py", line 2424, in prompt_for_settings
    if len(self.existing_options['topics']) > 1:
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/configobj/__init__.py", line 554, in __getitem__
    val = dict.__getitem__(self, key)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'topics'.

In following the directions given in the top of the weewx-user group with regard to posting, I am attaching my weewx.conf file, and system log from the RP Zero using the following command: journalctl -xe | grep weewx to this post. The other information requested is listed above. If you need anything else, please let me know, I am happy to help.

weewx-20251014-1405.conf.txt
WeeWX Log 20251014 1401.txt

James Michael Wall

unread,
Oct 14, 2025, 7:28:06 PM (2 days ago) Oct 14
to weewx-user
Also,

Sorry, I forgot to provide WeeWX status, FWIW:

$ systemctl status weewx
× weewx.service - WeeWX
     Loaded: loaded (/lib/systemd/system/weewx.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2025-10-14 16:24:18 PDT; 2s ago
   Duration: 903ms
       Docs: https://weewx.com/docs
    Process: 4176 ExecStart=weewxd /etc/weewx/weewx.conf (code=exited, status=4)
   Main PID: 4176 (code=exited, status=4)
        CPU: 904ms

Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL weewx.engine:     ****             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL weewx.engine:     ****    File "/etc/weewx/bin/user/MQTTSubscribe.py", line 2011, in __init__
Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL weewx.engine:     ****      super().__init__(service_dict, logger)
Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL weewx.engine:     ****    File "/etc/weewx/bin/user/MQTTSubscribe.py", line 1751, in __init__
Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL weewx.engine:     ****      raise ValueError("[[topics]] is required.")
Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL weewx.engine:     ****  ValueError: [[topics]] is required.
Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL __main__: Unable to load driver: [[topics]] is required.
Oct 14 16:24:18 Zero2W-1 weewxd[4176]: CRITICAL __main__:     ****  Exiting...
Oct 14 16:24:18 Zero2W-1 systemd[1]: weewx.service: Main process exited, code=exited, status=4/NOPERMISSION
Oct 14 16:24:18 Zero2W-1 systemd[1]: weewx.service: Failed with result 'exit-code'.

vince

unread,
Oct 14, 2025, 7:49:43 PM (2 days ago) Oct 14
to weewx-user
Your weewx.conf section looks incomplete/incorrect. You are missing all the configuration info you need to add.

If you look at the examples in https://github.com/bellrichm/WeeWX-MQTTSubscribe/tree/master/exampleConfigs they should give you the basic format needed although you’ll need to figure out your custom mapping of data to weewx database fields.


Reply all
Reply to author
Forward
0 new messages