[[topics]] is required error on WeeWX-MQTTSubscribe

88 views
Skip to first unread message

Vrishab Kakade

unread,
Jul 16, 2024, 6:09:09 AMJul 16
to weewx-user

I did a fresh install of the latest MQTTSubscribe with Weewx 5 and I get the below error when I start weewx, but the simulation works just fine.

(weewx-venv) weewx@freedompi:~/weewx-data $ weewxd
Using configuration file /home/weewx/weewx-data/weewx.conf
Using configuration file /home/weewx/weewx-data/weewx.conf
topics_dict {'unit_system': 'METRIC', 'pico/temperature': {'subscribe': 'True', 'ignore': 'False', 'message': {'type': 'individual'}, 'outTemp': > {'ignore': 'False', 'contains_total': 'False', 'name': 'outTemp'}}}
topics_dict None
Traceback (most recent call last):
File "/home/weewx/weewx-venv/bin/weewxd", line 8, in
sys.exit(main())
^^^^^^
File "/home/weewx/weewx-venv/lib/python3.11/site-packages/weewxd.py", line 121, in main
engine = weewx.engine.StdEngine(config_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/weewx/weewx-venv/lib/python3.11/site-packages/weewx/engine.py", line 89, in init
self.loadServices(config_dict)
File "/home/weewx/weewx-venv/lib/python3.11/site-packages/weewx/engine.py", line 157, in loadServices
obj = weeutil.weeutil.get_object(svc)(self, config_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/weewx/weewx-data/bin/user/MQTTSubscribe.py", line 2179, in init
self.subscriber = MQTTSubscriber.get_subscriber(service_dict, self.logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/weewx/weewx-data/bin/user/MQTTSubscribe.py", line 1829, in get_subscriber
return MQTTSubscriberV2MQTT3(service_dict, logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/weewx/weewx-data/bin/user/MQTTSubscribe.py", line 1752, in init
raise ValueError("[[topics]] is required.")
ValueError: [[topics]] is required.


Any idea why this would fail? I printed the value for topics_dict and it seems to be picking the correct values, but it also seems to be picking None.

topics_dict {'unit_system': 'METRIC', 'pico/temperature': {'subscribe': 'True', 'name': 'outTemp', 'ignore': 'False', 'message': {'type': 'individual'}}}
topics_dict None

This is my configuration.

[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 = false # Controls if validation errors raise an exception (stopping WeeWX from starting) or only logged. # Default is true 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 = freedompi.local # Controls the MQTT logging. # Default is false. log = false # password for broker authentication. # Default is None. password = # The port to connect to. # Default is 1883. port = 1883 # username for broker authentication. # Default is None. username = weewx # 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 [[[pico/temperature]]] # 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 = individual # 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. [[[[outTemp]]]] # 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 = outTemp

bell...@gmail.com

unread,
Jul 16, 2024, 9:34:03 AMJul 16
to weewx-user
Based on the snippet of the log file, my best guess is you also have a [MQTTSubscribeService] section that has no topics configured.
If this is not the case, set debug = 1, restart WeeWX, and post the complete log here. Make sure no sensitive information is in it.
rich

Reply all
Reply to author
Forward
0 new messages