MQTT Weewx authentication

127 views
Skip to first unread message

Rui Pinto

unread,
Aug 29, 2019, 7:08:13 AM8/29/19
to weewx-user
Hello!!

I'm trying to publish data to a topic in the Mosquitto broker through authentication. 
I succedd without authentication but i wanted to publish data with authentication.

I successfully changed the user and password in the mosquitto configurations, but i don't know where do i put the username and password in the Weewx configurations.

I don't know if i have to put the username and password in the weew.conf file...
Here's my configuration of MQTT in Weewx.conf: 

[StdRESTful]
    [[MQTT]]
       server_url = mqtt://localhost:1883/
       topic = weewx/default/default/VantagePro2
       unit_system = METRIC

Les Niles

unread,
Aug 29, 2019, 7:49:57 AM8/29/19
to weewx...@googlegroups.com
It’s in https://github.com/weewx/weewx/wiki/mqtt — put the username/password before the server name:
        server_url = mqtt://username:password@localhost:1883/

  -Les

--
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/63673c7b-da3a-4e5f-b865-ce802dd01c5f%40googlegroups.com.

Paul Lacatus

unread,
Aug 29, 2019, 9:16:33 AM8/29/19
to weewx...@googlegroups.com
Server_url = mqtt://User:pass@localhost:1883/

Sent from my iPad
--

Rui Pinto

unread,
Sep 2, 2019, 10:19:45 AM9/2/19
to weewx-user
Thank you very much for the help!!


Another question:

- Is it possible to change the QoS of the MQTT client (weewx)?

Xant

unread,
Sep 3, 2019, 1:20:39 AM9/3/19
to weewx-user

I went through MAAANY hours in this issue... and the following is what works 4me.

WeeWX conf:

    [[MQTT]]
        #X server_url = mqtt://test.mosquitto.org:1883/
        #X server_url = mqtt://broker.hivemq.com:1883/
        server_url = mqtt://[user:pw]@localhost:1883/
        topic = weather
        unit_system = US
        binding = archive, loop
        aggregation = aggregate

Belchertown skin:

    # MQTT Websockets defaults
    mqtt_websockets_enabled = 1
    #X mqtt_websockets_host = test.mosquitto.org
    #X mqtt_websockets_port = 8080
    #X mqtt_websockets_host = broker.hivemq.com
    #X mqtt_websockets_port = 8000
    mqtt_websockets_host = [ur URL]
    mqtt_websockets_port = 9001
    mqtt_websockets_ssl = 0
    mqtt_websockets_topic = "weather/loop"
    #X disconnect_live_website_visitor = 1800000

Uncomment the above as you wish. Try a free public MQTT (before local), as Mosquitto or HiveMQ as the above...

Remember to set your router port forwarding as well...

Xant

Rui Pinto

unread,
Sep 3, 2019, 6:00:02 AM9/3/19
to weewx...@googlegroups.com
Thank you for responding!!

The solution couldn't just be set the option retain to True?

Best Regards

--
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.

Xant

unread,
Sep 3, 2019, 12:09:04 PM9/3/19
to weewx-user

Fala Rui!

Dont understand the question. Do you mean the port#?

Abs
Xant
Reply all
Reply to author
Forward
0 new messages