The MQTT no longer works.

72 views
Skip to first unread message

PC

unread,
Jan 2, 2023, 6:55:50 AM1/2/23
to weewx-user
Hello,
Back to my PI Broker MQTT, I see that I do not receive anything Weewx.
I tested the broker from my WeeWX PI, and it works !

À vous lire

Here are the ad hoc parts of the weewx.conf :

    [[MQTT]]
        server_url = 192.168.0.51:1883
        topic = Meteo
        unit_system = METRIC
        binding = loop

[Engine]
    # The following section specifies which services should be run and in what order.
    [[Services]]
        prep_services = weewx.engine.StdTimeSynch
        data_services = ,
        process_services = weewx.engine.StdConvert, weewx.engine.StdCalibrate, weewx.engine.StdQC, weewx.wxservices.StdWXCalculate
        xtype_services = weewx.wxxtypes.StdWXXTypes, weewx.wxxtypes.StdPressureCooker, weewx.wxxtypes.StdRainRater, weewx.wxxtypes.StdDelta
        archive_services = weewx.engine.StdArchive
        restful_services = weewx.restx.StdStationRegistry, weewx.restx.StdWunderground, weewx.restx.StdPWSweather, weewx.restx.StdCWOP, weewx.restx.StdWOW, weewx.restx.StdAWEKAS, user.mqtt.MQTT
        report_services = weewx.engine.StdPrint, weewx.engine.StdReport

And what the log tells:

Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: MQTT: Unexpected exception of type <class 'ValueError'>
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: *** Traceback (most recent call last):
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 379, in run_loop
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***     self.process_record(_record, dbmanager)
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***   File "/usr/share/weewx/user/mqtt.py", line 522, in process_record
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***     self.get_mqtt_client()
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***   File "/usr/share/weewx/user/mqtt.py", line 453, in get_mqtt_client
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***     mc.connect(url.hostname, url.port)
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 913, in connect
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***     bind_address, bind_port, clean_start, properties)
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 978, in connect_async
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***     raise ValueError('Invalid host.')
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: *** ValueError: Invalid host.
Jan  2 12:16:42 PiMeteo weewx[26975] CRITICAL weewx.restx: MQTT: Thread terminating. Reason: Invalid host.

vince

unread,
Jan 2, 2023, 12:06:33 PM1/2/23
to weewx-user
On Monday, January 2, 2023 at 3:55:50 AM UTC-8 blaise....@gmail.com wrote:
    [[MQTT]]
        server_url = 192.168.0.51:1883
 
Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: ***     raise ValueError('Invalid host.')

Jan  2 12:16:42 PiMeteo weewx[26975] ERROR weewx.restx: *** ValueError: Invalid host.


Try server_url = mqtt://192.168.0.51:1883 and see if that fixes things.

This is documented in the extension page at https://github.com/matthewwall/weewx-mqtt if you look at the example.
 

PC

unread,
Jan 2, 2023, 12:37:53 PM1/2/23
to weewx-user
Yes, it works and it was in front of my eyes.

But I focused on "server_url", either the name or address of the server and not its protocol which is obviously "mqtt://" ...

So, @Tom, another little thing to improve, but thank you very much!
Reply all
Reply to author
Forward
0 new messages