I have read these steps over several times already, followed them, and am
still getting errors, that's why I'm here asking for help. FWIW, I'm not a
NOOB, I did RTFM, I currently have 18 devices (PC's and SBC's), all running
either Debian or Raspberry Pi OS, and have been using Linux exclusively
since 1993, when I started using it while in college - perhaps I'm getting
old, and it's starting to show ;-).
Here are the steps I have taken to attempt to get this working:
I uninstalled the MQTTSubscribe driver that I had installed earlier by
running sudo weectl extension uninstall MQTTSubscribe, to "start fresh".
I then performed each of the steps, starting from the beginning, found at
https://github.com/bellrichm/WeeWX-MQTTSubscribe/?tab=readme-ov-file#weewx-mqttsubscribe
Please note that during following these steps, I had to run weectl
extension install
https://github.com/bellrichm/WeeWX-MQTTSubscribe/archive/refs/tags/v3.zip
as sudo, because otherwise it denied me because of permissions, and yes, I
have followed all the instructions found here:
https://github.com/weewx/weewx/wiki/Understanding-permissions#working-with-permissions-in-a-unix-environment.
I also read here: https://groups.google.com/g/weewx-user/c/dPWhlQQgwWk. I'm
"fairly sure" that I have the correct permissions to my user account, since
I can edit /etc/weewx/weewx.conf without sudo, and can start weewx as my
user on this device:
myusername@Zero2W-1:~ $ systemctl restart weewx
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to restart 'weewx.service'.
Authenticating as: ,,, (myusername)
Password:
==== AUTHENTICATION COMPLETE ====
Other than that one thing, everything else seemed to be going good until I
got to this point:
https://github.com/bellrichm/WeeWX-MQTTSubscribe?tab=readme-ov-file#validate-and-test-the-configuration,
and the validation ran fine, but the simulate just kept running, producing
no errors, all I get is a blinking cursor for about 20 seconds, then the
cursor stops blinking.
At that point, I did a CTRL-C and got this:
python3 $USER_ROOT/MQTTSubscribe.py simulate $RUN_MODE --conf
mqttsubscribe.template.conf
^CTraceback (most recent call last):
File "/etc/weewx//bin/user/MQTTSubscribe.py", line 3397, in <module>
main()
File "/etc/weewx//bin/user/MQTTSubscribe.py", line 3390, in main
simulator.run()
File "/etc/weewx//bin/user/MQTTSubscribe.py", line 3136, in run
self.simulate_driver_packet(driver)
File "/etc/weewx//bin/user/MQTTSubscribe.py", line 3047, in
simulate_driver_packet
for packet in driver.genLoopPackets():
File "/etc/weewx//bin/user/MQTTSubscribe.py", line 2342, in genLoopPackets
data = self._handle_empty_queue()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/etc/weewx//bin/user/MQTTSubscribe.py", line 2385, in
_handle_empty_queue
time.sleep(self.wait_before_retry)
KeyboardInterrupt
I have attached the "newly" generated MQTTSubscribeDriver configuration
template, that was produced by following the instructions, with the only
the user and password info changed, maybe you can see what is going wrong,
or what I'm missing here. Also, I am in including the Micro Python code
snippet from my Raspberry Pico 2W (The device I am publishing the sensor
data via MQTT from, via WiFi) to show my data mapping, which is all being *sent
to a single topic (weatherpi)*, on the Raspberry Pi Zero2W-1 device which
has the Mosquitto <https://mosquitto.org/> server installed and working,
along with the paho-mqtt <https://pypi.org/project/paho-mqtt/> client,
which I installed from the Raspberry Pi OS repo, using sudo apt install
python3-paho-mqtt. I'm pretty sure that everything is working up to
receiving the information to the Zero2W-1:
sudo tail -f /var/log/mosquitto/mosquitto.log
1760745310: New connection from 192.168.1.106:60569 on port 1883.
1760745310: New client connected from 192.168.1.106:60569 as pico2w (p2,
c1, k0, u'myusername').
1760745310: No will message specified.
1760745310: Sending CONNACK to pico2w (0, 0)
1760745326: Received PUBLISH from pico2w (d0, q0, r0, m0, 'weatherpi', ...
(132 bytes))
1760745342: Received PUBLISH from pico2w (d0, q0, r0, m0, 'weatherpi', ...
(132 bytes))
1760745358: Received PUBLISH from pico2w (d0, q0, r0, m0, 'weatherpi', ...
(132 bytes))
Here is the last output from WeeWX with the "newly generated" configuration
in place:
systemctl status weewx
× weewx.service - WeeWX
Loaded: loaded (/lib/systemd/system/weewx.service; enabled; preset:
enabled)
Active: failed (Result: exit-code) since Fri 2025-10-17 15:34:37 PDT;
22min ago
Duration: 1.065s
Docs: https://weewx.com/docs
Process: 8805 ExecStart=weewxd /etc/weewx/weewx.conf (code=exited,
status=4)
Main PID: 8805 (code=exited, status=4)
CPU: 1.063s
Oct 17 15:34:37 Zero2W-1 weewxd[8805]: CRITICAL weewx.engine: ****
File "/etc/weewx/bin/user/MQTTSubscribe.py", line 2011, in __init>
Oct 17 15:34:37 Zero2W-1 weewxd[8805]: CRITICAL weewx.engine: ****
super().__init__(service_dict, logger)
Oct 17 15:34:37 Zero2W-1 weewxd[8805]: CRITICAL weewx.engine: ****
File "/etc/weewx/bin/user/MQTTSubscribe.py", line 1751, in __init>
Oct 17 15:34:37 Zero2W-1 weewxd[8805]: CRITICAL weewx.engine: ****
raise ValueError("[[topics]] is required.")
Oct 17 15:34:37 Zero2W-1 weewxd[8805]: CRITICAL weewx.engine: ****
ValueError: [[topics]] is required.
Oct 17 15:34:37 Zero2W-1 weewxd[8805]: CRITICAL __main__: Unable to load
driver: [[topics]] is required.
Oct 17 15:34:37 Zero2W-1 weewxd[8805]: CRITICAL __main__: ****
Exiting...
Oct 17 15:34:37 Zero2W-1 systemd[1]: weewx.service: Main process exited,
code=exited, status=4/NOPERMISSION
Oct 17 15:34:37 Zero2W-1 systemd[1]: weewx.service: Failed with result
'exit-code'.
Oct 17 15:34:37 Zero2W-1 systemd[1]: weewx.service: Consumed 1.063s CPU
time.
At this point, I'm pretty sure (AFAICT) I just need to figure out how to
get the data from there into WeeWX, using the MQTTSubscribeDriver. I'm
sorry that there is so much info in this post, I'm just trying to convey
what is in front of me, and get help to fix the problem. Please forgive my
lack of knowledge here, this is my first experience with WeeWX. If you need
anything else, please don't hesitate to ask, I am happy to help in any way
I can - this is driving me bonkers!
On Friday, October 17, 2025 at 1:05:35 PM UTC-7 vince wrote:
> Read the web pages top to bottom a couple times (link)
> <https://github.com/bellrichm/WeeWX-MQTTSubscribe>. They are there for a
> reason. You might need to read it top to bottom a couple times. Invest the
> time. Do what it says.
>
> Rather than randomly trying to hit a good configuration, definitely do the
> configuration and testing steps starting at (link)
> <https://github.com/bellrichm/WeeWX-MQTTSubscribe/tree/master?tab=readme-ov-file#create-an-example-configuration>
> and
> do what the documentation says. That will output a validly formatted
> template file you can edit to match your setup and test. Pay particular
> attention to the comments in the template file it'll generate.
>
> Rich's driver/service is a little unusual in that it seems to have an
> installer to even do the right thing to put it into place, but I haven't
> tried that personally.
>
> On Friday, October 17, 2025 at 12:06:14 PM UTC-7 James Michael Wall wrote:
>
>> So, I must be doing something wrong, not sure what though. I am attaching
>> my updated weewx.conf file, and the error that it generated.
>>
>> On Tuesday, October 14, 2025 at 4:49:43 PM UTC-7 vince wrote:
>>
>>> 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.
>>>
>>>
>>> On Tuesday, October 14, 2025 at 4:28:06 PM UTC-7 James Michael Wall
>>> wrote:
>>>
>>>> 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'.
>>>>
>>>> On Tuesday, October 14, 2025 at 3:55:38 PM UTC-7 James Michael Wall
>>>> wrote:
>>>>
>>>>> 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
>>>>> <https://bc-robotics.com/shop/raspberry-pi-pico-1591b-weather-board/>
>>>>> with Raspberry Pico 2W
>>>>> <https://www.raspberrypi.com/products/raspberry-pi-pico-2/>, 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
>>>>> <https://www.raspberrypi.com/products/raspberry-pi-zero-2-w/>,
>>>>> 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.
>>>>>
>>>>>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/weewx-user/2f703d03-c146-4829-9671-7b07d6b10b36n%40googlegroups.com.
#
# This is an example configuration for MQTTSubscribe
# It was created on 2025-10-17 at 14:27:25 with MQTTSubscribe version 3.0.0
#
# Replace '[MQTTSubscribe]' with '[MQTTSubscribeService]' or
'[MQTTSubscribeDriver]'
# For additional information see,
https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring#the-mqttsubscribedrivermqttsubscribesection-section
[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
# Controls if validation errors raise an exception (stopping WeeWX from
starting) or only logged.
# Default is false
stop_on_validation_errors = true
# The binding, loop or archive.
# Default is loop.
# Only used by the service.
binding = loop
# The MQTT server.
# Default is localhost.
host = localhost
# Controls the MQTT logging.
# Default is false.
log = false
# password for broker authentication.
# Default is None.
password = myusername_password
# The port to connect to.
# Default is 1883.
port = 1883
# username for broker authentication.
# Default is None.
username = myusername
# The TLS options that are passed to tls_set method of the MQTT client.
# For additional information see,
https://eclipse.org/paho/clients/python/docs/strptime-format-codes
[[tls]]
# Turn tls on and off.
# Default is true.
enable = false
# Path to the Certificate Authority certificate files that are to be
treated as trusted by this client.
ca_certs = ""
# The PEM encoded client certificate and private keys.
# Default is None
certfile = None
# The certificate requirements that the client imposes on the broker.
# Valid values: none, optional, required
# Default is required,
certs_required = required
# The encryption ciphers that are allowable for this connection.
Specify None to use the defaults
# Default is None.
ciphers = None
# The private keys.
# Default is None
keyfile = None
# The version of the SSL/TLS protocol to be used.
# Valid values: sslv2, sslv23, sslv3, tls, tlsv1, tlsv11, tlsv12.
# Default is tlsv12.
tls_version = tlsv12
# For additional information see,
https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring#the-topic-name-sections
[[topics]]
# Units for MQTT payloads without unit value.
# Valid values: US, METRIC, METRICWX.
# For more information see, http://weewx.com/docs/customizing.htm#units
# Default is US.
unit_system = METRIC
# The first topic to subscribe to
# For additional information see,
https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring#the-topic-name-sections
[[[weatherpi]]]
# When set to false, the topic is not subscribed to.
# Valid values: True, False
# Default is True
subscribe = True
# Sets the default value for all fields in this topic.
# Setting the value to 'true' "opts out" and the desired fields
will need to set 'ignore = true'
# Valid values: True, False.
# Default is False.
ignore = False
# Configuration information about the MQTT message format for this
topic
[[[[message]]]]
# The format of the MQTT payload.
# Currently support: individual, json, keyword.
# Must be specified.
type = json
# The incoming field name from MQTT.
# For additional information see,
https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring#the-field-name-sections
# Use this template for any fields that need to be configured.
# If no fields need to be configured, remove this section.
[[[[tempout]]]]
# True if the incoming field should not be processed into WeeWX.
# Valid values: True, False.
# Default is derived from the 'ignore' option at the topic
level.
ignore = False
[[[[humout]]]]
# True if the incoming field should not be processed into WeeWX.
# Valid values: True, False.
# Default is derived from the 'ignore' option at the topic
level.
ignore = False
[[[[bar]]]]
# True if the incoming field should not be processed into WeeWX.
# Valid values: True, False.
# Default is derived from the 'ignore' option at the topic
level.
ignore = False
[[[[caseTemperature]]]]
# True if the incoming field should not be processed into WeeWX.
# Valid values: True, False.
# Default is derived from the 'ignore' option at the topic
level.
ignore = True
[[[[windspd]]]]
# True if the incoming field should not be processed into WeeWX.
# Valid values: True, False.
# Default is derived from the 'ignore' option at the topic
level.
ignore = False
[[[[winddir]]]]
# True if the incoming field should not be processed into WeeWX.
# Valid values: True, False.
# Default is derived from the 'ignore' option at the topic
level.
ignore = False
[[[[rainr]]]]
# True if the incoming field should not be processed into WeeWX.
# Valid values: True, False.
# Default is derived from the 'ignore' option at the topic
level.
ignore = False
# True if the incoming data is cumulative.
# Valid values: True, False.
# Default is False.
contains_total = False
# The WeeWX name.
# Default is the name from MQTT.
name = weatherpi
# The second topic to subscribe to
# Use this and the above topic section as a template to configure
additional topics.
# If no additional topics are needed, remove this section
# ------------------------------------------------------------------
# Build payload and publish
# ------------------------------------------------------------------
payload = {
'tempout': temperature,
'humout' : humidity,
'bar' : pressure,
'caseTemperature': caseTemperature,
'windspd' : measuredWind,
'winddir' : windHeading,
'rainr' : rainfall
}
mqtt_client.publish(TOPIC, ujson.dumps(payload))
print(f"Published to {TOPIC}: {payload}")