Belchertown & MQTT

119 views
Skip to first unread message

Mark Fraser

unread,
Jul 19, 2023, 6:43:16 AM7/19/23
to weewx-user
I've been using the Belchertown skin with my own MQTT server for a while
now and it works fine when I'm on the same network, but if I try to
access it remotely it doesn't do live updates. I've also setup port
forwarding on my router.

In weewx.conf I have,
[[MQTT]]
server_url = mqtt://username:pass...@192.168.2.107:1883/
topic = weather
log_success = False
log_failure = True
unit_system = METRIC
binding = archive, loop
aggregation = aggregate

#--- MQTT Websockets (for Real Time Streaming) Options ---
mqtt_websockets_enabled = 1
mqtt_websockets_host = 192.168.2.107
mqtt_websockets_port = 9001
mqtt_websockets_ssl = 0
mqtt_websockets_topic = weather/loop
# disconnect_live_website_visitor = 1800000

Do I need to add:
mqtt_username = "weewxMQTTuser"
mqtt_password = "weewxMQTTpass"
Or is there something else I'm missing?

Claudio

unread,
Jul 19, 2023, 7:55:59 AM7/19/23
to weewx-user
this must be your public ip
mqtt_websockets_host = 192.168.2.107 

pannetron

unread,
Jul 19, 2023, 10:46:29 AM7/19/23
to weewx-user

Yes, the "outside URL" of your MQTT broker must map to a public IP.  All 192.168... IP addresses are non-routable, private IP addresses.  If you don't have a permanent, public IP address, you may be able to use Dynamic DNS from one of the services that offers that to register a public URL that maps to whatever your Internet service provider tells you to use as your public IP.

Mark Fraser

unread,
Jul 20, 2023, 6:29:36 AM7/20/23
to weewx...@googlegroups.com
On 19/07/2023 15:46, pannetron wrote:
>
> Yes, the "outside URL" of your MQTT broker must map to a public IP.  All
> 192.168... IP addresses are non-routable, private IP addresses.  If you
> don't have a permanent, public IP address, you may be able to use
> Dynamic DNS from one of the services that offers that to register a
> public URL that maps to whatever your Internet service provider tells
> you to use as your public IP.
> On Wednesday, July 19, 2023 at 5:55:59 AM UTC-6 Claudio wrote:
>
> this must be your public ip
> mqtt_websockets_host = 192.168.2.107
>
> Il giorno mercoledì 19 luglio 2023 alle 12:43:16 UTC+2 Mark Fraser
> ha scritto:
>
> I've been using the Belchertown skin with my own MQTT server for
> a while
> now and it works fine when I'm on the same network, but if I try to
> access it remotely it doesn't do live updates. I've also setup port
> forwarding on my router.
>
> In weewx.conf I have,
> [[MQTT]]
> server_url = mqtt://username:pass...@192.168.2.107:1883/
> <http://username:pass...@192.168.2.107:1883/>
> topic = weather
> log_success = False
> log_failure = True
> unit_system = METRIC
> binding = archive, loop
> aggregation = aggregate
>
> #--- MQTT Websockets (for Real Time Streaming) Options ---
> mqtt_websockets_enabled = 1
> mqtt_websockets_host = 192.168.2.107
> mqtt_websockets_port = 9001
> mqtt_websockets_ssl = 0
> mqtt_websockets_topic = weather/loop
> # disconnect_live_website_visitor = 1800000
>
> Do I need to add:
> mqtt_username = "weewxMQTTuser"
> mqtt_password = "weewxMQTTpass"
> Or is there something else I'm missing?

So, I should use my hopto.org URL with the port that is for MQTT (1883)?

pannetron

unread,
Jul 20, 2023, 8:48:58 AM7/20/23
to weewx-user
On Thursday, July 20, 2023 at 4:29:36 AM UTC-6 Mark Fraser wrote:
On 19/07/2023 15:46, pannetron wrote:
>
> Yes, the "outside URL" of your MQTT broker must map to a public IP.  All
> 192.168... IP addresses are non-routable, private IP addresses.  If you
> don't have a permanent, public IP address, you may be able to use
> Dynamic DNS from one of the services that offers that to register a
> public URL that maps to whatever your Internet service provider tells
> you to use as your public IP.


So, I should use my hopto.org URL with the port that is for MQTT (1883)?

hopto.org looks okay but you should still use 9001 as the port to have your router forward MQTT requests to, 
assuming that's how you have your MQTT broker set up. The 1883 port is usually used to publish data to the 
broker, 9001 is used for clients subscribing to data from the broker.  The weewx server sends to 1883, the 
Belchertown skin pulls from port 9001.

Mark Fraser

unread,
Jul 21, 2023, 9:29:47 AM7/21/23
to weewx-user
That's sorted it. I can now get live updates when I'm not at home.
Reply all
Reply to author
Forward
0 new messages