A couple of things to look into.
You are using port 8883. This is usually an encrypted connection, but I don’t see any tls configuration, https://weewx-mqtt.github.io/publish/common-options/tls.html, for weewx-mqtt/publish. (Note, I believe that mosquittio_pub can use the system cert, so no additional configuration would be needed for it. But I am not certain.) You could try setting log_mqtt = true, https://weewx-mqtt.github.io/publish/common-options/#log_mqtt. This will enable logging at the “mqtt level”. It might provide some additional information. On Monday, 16 February 2026 at 12:18:45 UTC-5 [email protected] wrote: > Hi, > I'm having troubles getting weewx mqtt to publish to my remote HiveMQ > cloud broker from the RPi weewx is running on, when I test with > mosquitto_pub it does work correctly. > I'm using mqttpublish from https://github.com/weewx-mqtt/publish > > The goal is to publish the data from weewx to the remote HiveMQ broker and > then subscribe to the HiveMQ broker from my website running externally > which is why I decided to publish to a remote broker so the website doesn't > have to subscribe to a broker inside my local home network. > > does anybody have an insight to what I'm doing wrong? > > These are the related sofware versions: > weewxd version 5.2.0 > Python 3.13.5 > paho-mqtt 2.1.0 > > *I've replaced the username and password with something generic in the > information below. > > part of the debug log: > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: native id > in 'main' init 189873 > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: sanitized > configuration removed ['password'] > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: > sanitized_service_dict is {'keepalive': '60', 'enable': 'true', 'log_mqtt': > 'true', 'host': '72faee6f34dd47e8b26860352d1801f6.s1.eu.hivemq.cloud', > 'topics': {'weer': {'type': 'individual', 'retain': 'true', 'unit_system': > 'METRIC'}}, 'username': 'username', 'binding': 'loop', 'port': '8883'} > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: Loop topics: > {'weer': {'qos': 0, 'retain': True, 'type': 'individual', 'unit_system': > 16, 'guarantee_delivery': False, 'ignore': False, 'append_unit_label': > True, 'conversion_type': 'string', 'format': '%s', 'fields': {}, > 'aggregates': {}}} > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: Archive > topics: {} > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: native id > in init 189873 > feb 16 17:07:16 weewx weewxd[189873]: INFO user.mqttpublish: starting > thread > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: Thread-2 > 547775377760 > feb 16 17:07:16 weewx weewxd[189873]: INFO user.mqttpublish: joining thread > feb 16 17:07:16 weewx weewxd[189873]: DEBUG user.mqttpublish: native id > in run 189878 > feb 16 17:07:16 weewx weewxd[189873]: INFO user.mqttpublish: joined thread > feb 16 17:07:16 weewx weewxd[189873]: INFO user.mqttpublish: started thread > feb 16 17:07:16 weewx weewxd[189873]: DEBUG weewx.engine: Finished loading > service user.mqttpublish.PublishWeeWX > feb 16 17:07:16 weewx weewxd[189873]: ERROR user.mqttpublish: Disconnected > with result code 128 > feb 16 17:07:17 weewx weewxd[189873]: DEBUG user.mqttpublish: waiting > feb 16 17:07:22 weewx weewxd[189873]: DEBUG user.mqttpublish: waiting > > > When I test from the commandline with this mosquitto command the message > doe correctly arrive at the broker: > mosquitto_pub -h 72faee6f34dd47e8b26860352d1801f6.s1.eu.hivemq.cloud -p > 8883 -t "weer" -m "Hello from RPI" -u "username" -P "password" > > > This is the related part from weewx.conf: > [MQTTPublish] > enable = true > log_mqtt = true > # The MQTT server. > # Default is localhost. > host = 72faee6f34dd47e8b26860352d1801f6.s1.eu.hivemq.cloud > # The port to connect to. > # Default is 1883. > port = 8883 > # Maximum period in seconds allowed between communications with the broker. > # Default is 60. > keepalive = 60 > # username for broker authentication. > # Default is None. > username = username > # password for broker authentication. > # Default is None. > password = password > # The binding, loop or archive. > # Default is: loop > binding = loop > [[topics]] > [[[weer]]] > type = individual > retain = true > unit_system = METRIC > > Thank you very much, > > Roy > -- 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/aa9dd9ee-2f3a-4f93-b674-32cb605c3fccn%40googlegroups.com.
