Belchertown mqtt help please

207 views
Skip to first unread message

vince

unread,
Nov 24, 2019, 10:39:07 PM11/24/19
to weewx-user
Pat - I'm trying to do a clean Belchertown current 1.1 dev installation on top of weewx 4.0.0b3 under python3 and continue to get the dreaded "Failed connecting to the weather station. Please try again later! " failure.   Looking for help in trying to get it working locally on my LAN first.

Here's my current setup, using the WeatherFlow UDP driver on current Raspbian...

/etc/mosquitto/conf.d/1883.conf:
allow_anonymous true
listener 1883
protocol mqtt

/etc/mosquitto/conf.d/9001.conf:
allow_anonymous true
listener 9001
protocol websockets

Verify it's listening according to netstat:
# netstat -tulpen|grep mosquitto
tcp        0      0 0.0.0.0:1883            0.0.0.0:*               LISTEN      0          3444866    6849/mosquitto
tcp        0      0 0.0.0.0:9001            0.0.0.0:*               LISTEN      0          3444869    6849/mosquitto
tcp6       0      0 :::1883                 :::*                    LISTEN      0          3444867    6849/mosquitto

Verify it's indeed listening via mosquitto_sub
# mosquitto_sub -h localhost -t weather/loop
{"dateTime": "1574652627.0", "windSpeed_mph": "0.0", "usUnits": "1.0", "beaufort": "0.0", "maxSolarRad": "0.0", "rainRate_inch_per_hour": "0.0", "hourRain_in": "0.0", "rain24_in": "0.0004393700787401575", "dayRain_in": "0.0004393700787401575"}

Weewx MQTT section....

     [[MQTT]]
        server_url = http://localhost:1883
        topic = weather
        binding = archive, loop
        aggregation = aggregate
        log_success = false

Belchertown MQTT section....

[[Belchertown]]
     [[[ Extras ]]]
belchertown_debug = 1 
          mqtt_websockets_enabled = 1
          mqtt_websockets_host = localhost
          mqtt_websockets_port = 9001
          mqtt_websockets_topic = weather/loop


I have restarted mosquitto and weewx multiple times.  No joy.

I have belchertown_debug=1 but have no idea what that does, nor how I can dig deeper.

Help ?


Xant

unread,
Nov 25, 2019, 12:26:31 AM11/25/19
to weewx-user
After much trial-and-error, the following is what works in my Rpi case:

1) WeeWX conf:

    [[MQTT]]

        server_url = mqtt://[user]:[password]@localhost:1883/    <== user/password/localhost/port
        topic = weather
        unit_system = US
        binding = archive, loop
        aggregation = aggregate

2) Belchertown conf:

[Extras]
    # MQTT Websockets defaults
    mqtt_websockets_host = [domain-name]   <== the actual DomainName, not "localhost"
    mqtt_websockets_port = 9001
    mqtt_websockets_ssl = 0
    mqtt_websockets_topic = "weather/loop"

Best, X 

vince

unread,
Nov 25, 2019, 12:41:59 AM11/25/19
to weewx-user
On Sunday, November 24, 2019 at 9:26:31 PM UTC-8, Xant wrote:
After much trial-and-error, the following is what works in my Rpi case:
    mqtt_websockets_host = [domain-name]   <== the actual DomainName, not "localhost"


Yes - that works - thanks !

I guess it makes sense, the browser has to connect to a remote server, which generally isn't localhost (the computer running the browser).    I did test the IP address as well, which also works.

Thanks agin for the help.

Xant

unread,
Nov 25, 2019, 1:13:31 AM11/25/19
to weewx-user
Glad did work for you, as I also - and many - struggled with that as well ( https://groups.google.com/forum/#!topic/weewx-user/PysWhKpUPAE ).

The confusion increases as there are many misleading postings out there that not clarify the localhost vs domain-name settings, that is: server --> localhost, websockets --> domain-name (must resolve externally).

Also, many postings just mentioning "localhost" and omitting user/pass@localhost/port.


Pat

I would suggest to include the above WeeWX.conf and Skin.conf MQTT sections excerpts in Belchertown/MQTT instructions as to clarify personal server settings and usage.

Best, X
Reply all
Reply to author
Forward
0 new messages