MQTT Errors

167 views
Skip to first unread message

Alex Rodriguez

unread,
Mar 4, 2020, 12:50:57 PM3/4/20
to weewx-user
Hi, I am looking for assistance getting MQTT working with WeeWX and Belchertown. I am currently running WeeWX on a Raspberry Pi 4, my station is a WeatherFlow and I am publishing my site publicly via FTP to -> https://weather.bluedoor.farm. When I go to the site it shows “Connected. Waiting for data” and eventually just errors out with “Lost connection to the weather station. Please try again later!"

Looking at my syslog I do see it sending data to the MQTT server:

Mar  4 12:38:45 weewx weewx[20506]: restx: MQTT: Published record 2020-03-04 12:38:45 EST (1583343525)
Mar  4 12:38:49 weewx weewx[20506]: restx: MQTT: Published record 2020-03-04 12:38:48 EST (1583343528)
Mar  4 12:38:51 weewx weewx[20506]: restx: MQTT: Published record 2020-03-04 12:38:51 EST (1583343531)
Mar  4 12:38:53 weewx weewx[20506]: restx: MQTT: Published record 2020-03-04 12:38:52 EST (1583343532)
Mar  4 12:38:54 weewx weewx[20506]: restx: MQTT: Published record 2020-03-04 12:38:53 EST (1583343533)

In my weewx.conf file I have:

    [[MQTT]]
        server_url = mqtt://test.mosquitto.org:8081/
        topic = weather/loop
        unit_system = US
        binding = archive, loop
        aggregation = aggregate

In my skin.conf file I have:

    # MQTT Websockets defaults
    mqtt_websockets_enabled = 1
    mqtt_websockets_host = "test.mosquitto.org"
    mqtt_websockets_port = 8081
    mqtt_websockets_ssl = 1
    mqtt_websockets_topic = "weather/loop"
    disconnect_live_website_visitor = 1800000

I appreciate any assistance or pointers you may have on getting this working.

Thanks,

Alex

Gert Andersen

unread,
Mar 4, 2020, 3:21:56 PM3/4/20
to weewx-user
Hi
Try weather in the  [[MQTT]] section without the loop

Maybe you should try without ssl(port 183 and 8080) first and when it's running, try ssl.

Gert

Alex Rodriguez

unread,
Mar 4, 2020, 6:36:33 PM3/4/20
to weewx...@googlegroups.com
Thanks Gert, tried it with no luck. Could it be Mosquitto? May need to try a different broker.

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e3ad27a6-e254-47fc-b312-753e26ecd495%40googlegroups.com.

Greg Troxel

unread,
Mar 4, 2020, 8:38:42 PM3/4/20
to Alex Rodriguez, weewx...@googlegroups.com
Alex Rodriguez <al...@sdpimail.com> writes:

> Thanks Gert, tried it with no luck. Could it be Mosquitto? May need to try a different broker.

You really need to use test clients to publish and subscribe. There are
many little things that can be wrong.

mosquitto is the standard approach. Recheck acls and turn on
debugging.


Alex Rodriguez

unread,
Mar 6, 2020, 10:44:42 AM3/6/20
to Greg Troxel, weewx...@googlegroups.com
Still working on trying to get this working. Is it possible mosquitto stops responding to requests - blocks responses? Has anyone had that happen?

Greg Troxel

unread,
Mar 6, 2020, 11:54:44 AM3/6/20
to Alex Rodriguez, weewx...@googlegroups.com
Alex Rodriguez <al...@sdpimail.com> writes:

> Still working on trying to get this working. Is it possible mosquitto
> stops responding to requests - blocks responses? Has anyone had that
> happen?

Anything is possible, but it is extremely likely that you have a
configuration error, not a mosquitto bug.

Jacques Terrettaz

unread,
Mar 8, 2020, 6:14:46 AM3/8/20
to weewx-user
HI,
In your configuration, you are using the same port number (8081) to send your data to the MQTT broker and to retrieve them via the skin (websockets).
According to the test.mosquitto.org server documentation  :
The server listens on the following ports:

    1883 : MQTT, unencrypted
    8883 : MQTT, encrypted
    8884 : MQTT, encrypted, client certificate required
    8080 : MQTT over WebSockets, unencrypted
    8081 : MQTT over WebSockets, encrypted

You should therefore send your data using port 1883 :   server_url = mqtt://test.mosquitto.org:1883/


Alex Rodriguez

unread,
Mar 8, 2020, 8:45:08 AM3/8/20
to weewx-user
Hi Jacques-

Thanks for the feedback, I tried that but it still just reports “Connected. Waiting for data”. Someone had suggested changing the topic to something more unique, I tried that but it also did not work. From what I can see in the logs the data is getting sent, its just the webpage cant seem to find/pull it.

Alex

--
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 weewx-user+...@googlegroups.com.

Jacques Terrettaz

unread,
Mar 8, 2020, 9:04:03 AM3/8/20
to weewx-user

Alex,  did you tried to use the unencrypted websocket (port 8080), with mqtt_websockets_ssl = 0 ?  If your Belchertown web page is accessible from internet, could you send me the link, so that I can see if there is some  javascript  websockets errors ?

Alex Rodriguez

unread,
Mar 8, 2020, 9:49:18 AM3/8/20
to weewx...@googlegroups.com
Hi Jacques, yes its available online at weather.bluedoor.farm. If I set my skin.conf to mqtt_websockets_ssl = 0 and mqtt_websockets_port = 8080, it fails right away. If I set them to mqtt_websockets_ssl = 1 and mqtt_websockets_port = 8081, it shows connecting but ultimately fails. I have it set to 0 and 8080 at the moment.

On Mar 8, 2020, at 9:04 AM, Jacques Terrettaz <jterr...@gmail.com> wrote:


Alex,  did you tried to use the unencrypted websocket (port 8080), with mqtt_websockets_ssl = 0 ?  If your Belchertown web page is accessible from internet, could you send me the link, so that I can see if there is some  javascript  websockets errors ?

--
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 weewx-user+...@googlegroups.com.

Jacques Terrettaz

unread,
Mar 8, 2020, 11:10:24 AM3/8/20
to weewx-user
Alex,
Since your web site is secure, there is right now an error "the operationis insecure" triggered by the mqtt websockets connection. Could you please use the port 8081 and mqtt_websockets_ssl = 1, and I will have a look again.

Alex Rodriguez

unread,
Mar 8, 2020, 12:21:39 PM3/8/20
to weewx-user
Thanks again Jacques, its changed over now.

On Mar 8, 2020, at 11:10 AM, Jacques Terrettaz <jterr...@gmail.com> wrote:

Alex,
Since your web site is secure, there is right now an error "the operationis insecure" triggered by the mqtt websockets connection. Could you please use the port 8081 and mqtt_websockets_ssl = 1, and I will have a look again.

--
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 weewx-user+...@googlegroups.com.

Jacques Terrettaz

unread,
Mar 8, 2020, 12:27:54 PM3/8/20
to weewx-user
OK, no more errors, but... no data.

Please add "/loop" at the end of  your mqtt_websockets topic :  

# MQTT Websockets defaults
    mqtt_websockets_enabled = 1
    mqtt_websockets_host = "test.mosquitto.org"
    mqtt_websockets_port = 8081
    mqtt_websockets_ssl = 1
    mqtt_websockets_topic = "yourtopic/loop"

Alex Rodriguez

unread,
Mar 8, 2020, 12:37:00 PM3/8/20
to weewx-user
That did it! THANK YOU!!!

Alex

--
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 weewx-user+...@googlegroups.com.

vince

unread,
Mar 8, 2020, 12:39:21 PM3/8/20
to weewx-user
On Sunday, March 8, 2020 at 9:27:54 AM UTC-7, Jacques Terrettaz wrote:
OK, no more errors, but... no data.



Your mqtt server 'also' has to enable websockets.

Check to verify it has configs there for both 1883 and 8081. 

vince

unread,
Mar 8, 2020, 12:41:33 PM3/8/20
to weewx-user

Just change 9001 there to whatever port you want mosquitto to listen for websockets on, and of course make sure weewx's config matches.
Reply all
Reply to author
Forward
0 new messages