Resolved:
I had to do some investigative work here:
#1 After going through the code I found out what code 5 meant - (Connection
refused - not authorised) (found that in pubmqtt.py)
#2 That told me right there that the username and password were not being
passed - then looking at my config I see I put the [[tls]]
tls_version = tls before the username and password when it should have
been after.
#3 looking through the code further I found .conf examples in
the MQTTSubscribe.py - which clearly shows where the [[tls]] needed to
go, and just verifying the observation I made above.
Rich - Thank You for your help, it helped me dig deeper... Not sure if
there is a way to get the TLS option added during the station re-config
phase of this, it would have made it easier. [MQTTSubscribeDriver]
For others that may run into this here's the config that I am using now...
Also I'm using the newest WeeWx 5.0 beta -
[MQTTSubscribeDriver]
# This section is for the MQTTSubscribe driver.
# The driver to use:
driver = user.MQTTSubscribe
# The MQTT server.
# Default is localhost.
host = localhost
# 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 = what ever you have it set at (none is default)
# password for broker authentication.
password = what ever you have it set at (none is default)
# Controls the MQTT logging.
# Default is false.
log = false
# 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-code
[[tls]]
# 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
FJ
On Friday, November 3, 2023 at 8:34:21 PM UTC-4 Fjordey wrote:
Rich,
I was missing that part... but still not working...
[[tls]]
tls_version = tls
The problem now is I'm getting an error code 5 - I'm sure it's something
simple.
CRITICAL weewx.engine: **** weewx.WeeWxIOError: Unable to connect.
Return code is 5 flags are {'session present': 0}.
here's my config for that now which fails:
# The driver to use:
driver = user.MQTTSubscribe
# The MQTT server.
# Default is localhost.
host = **************.s2.eu.hivemq.cloud
# The port to connect to.
# Default is 1883.
port = 8883
[[tls]]
tls_version = tls
# Maximum period in seconds allowed between communications with the
broker.
# Default is 60.
keepalive = 60
# username for broker authentication.
# Default is None.
username = *******
# password for broker authentication.
# Default is None.
password = *********
# Configuration for the message callback.
[[message_callback]]
On Friday, November 3, 2023 at 5:43:10 PM UTC-4 [email protected] wrote:
I’m not following your question. I was able to connect to test.mosquitto.org
using the following configuration.
[MQTTSubscribeDriver]
driver = user.MQTTSubscribe
host = test.mosquitto.org
port = 8886
[[tls]]
tls_version = tls
.
.
.
rich
On Friday, 3 November 2023 at 14:18:06 UTC-4 Fjordey wrote:
Does anyone know if it is possible for MQTTSubscribeDriver to make a TLS
connection?
Using a cloud broker and they are all using TLS connections. (at least all
the free brokers are)
I dug into the readme files of that driver and it talks about having TLS
added awhile back and shows how to add certs etc... but I do not see how to
connect to MQTTS.
FJ
--
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 on the web visit
https://groups.google.com/d/msgid/weewx-user/ef79dbd3-646d-46fc-bd66-a77ca9a9cf0an%40googlegroups.com.