WeeWx MQTT publishing, but no data received on topic

208 views
Skip to first unread message

bmb...@gmail.com

unread,
Nov 4, 2024, 9:01:04 PM11/4/24
to weewx-user
Im re-building my WeeWx install after a very precarious previous install went bad - and setting it all up again. I tried WeeWx 5, but the virtual environment for Python was too much for me, so i restarted on 4.9.
So far Ive gotten it all up and running, but my MQTT will not work as expected. 
Ive got my WeeWx receiving SDR data, and publishing MQTT but the website doesnt receive updates, just says "connected, waiting for data"
I can connect to the server, and I do get publications, but only if i use the catch all -t "#'
if I use 'weather' or 'weather/loop' i get nothing, like the website.
Ive checked the topic, and it is weather. so Im not sure where I'm going wrong.

WeeWx.conf :
 [[MQTT]]
        host = 192.168.44.204
        enable = true
        topic = weather
        unit_system = US
        binding = archive, loop
        aggregation = aggregate

    [[Belchertown]]
        skin = Belchertown
        HTML_ROOT = /var/www/html
        enable = true
        [[[Extras]]]
    #--- MQTT Websockets (for Real Time Streaming) Options ---
            mqtt_websockets_enabled = 1
            mqtt_websockets_host = imagingphototech.com
            mqtt_websockets_port = 9001
            mqtt_websockets_ssl = 0
            mqtt_websockets_topic = "weather/loop"
            disconnect_live_website_visitor = 1800000
Mosquitto.conf
persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

allow_anonymous true

listener 9001
protocol websockets

listener 1883
protocol mqtt


log_type error


Logs: 
weewx status
weewx.service - LSB: weewx weather system
     Loaded: loaded (/etc/init.d/weewx; generated)
     Active: active (running) since Mon 2024-11-04 20:43:43 EST; 16min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1294805 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS)
      Tasks: 7 (limit: 3908)
        CPU: 1min 4.748s
     CGroup: /system.slice/weewx.service
             ├─1294821 python3 /usr/share/weewx/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf
             └─1294822 rtl_433 -M utc -F json -f 915M -R 78 -R 113 -Y classic

Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/dewpoint_degree_F": 42.62659565255956 (degree_F)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/ET_inch": None (inch)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/heatindex_degree_F": 44.13100000000001 (degree_F)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/humidex_degree_F": 45.68 (degree_F)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/inDewpoint_degree_F": None (degree_F)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/maxSolarRad_watt_per_meter_squared": 0.0 (watt_per_meter_squared)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/rainRate_inch_per_hour": 0.0 (inch_per_hour)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/windchill_degree_F": 45.68 (degree_F)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/windrun_mile": None (mile)
Nov 04 21:00:00 raspberrypi python3[1294821]: weewx[1294821] INFO weewx.restx: MQTT: Published record 2024-11-04 20:59:57 EST (1730771997)

journalctl -u 0f weewx : dateTime': 1730771661, 'usUnits': 17}
Nov 04 20:54:24 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: New loop packet: {'outTemp': 45.32, 'outHumidity': 89.0, 'windDir': None, 'windSpeed': 0.0, 'UV': 0.0, 'dateTime': 1730771661, 'usUnits': 1, 'pressure': None, 'altimeter': None, 'appTemp': 43.55636152833608, 'barometer': None, 'cloudbase': 957.8282981938706, 'dewpoint': 42.27155548794697, 'ET': None, 'heatindex': 43.735, 'humidex': 45.32, 'inDewpoint': None, 'maxSolarRad': 0.0, 'rainRate': 0.0, 'windchill': 45.32, 'windrun': None}
Nov 04 20:54:24 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/outTemp_degree_F": 45.32 (degree_F)
Nov 04 20:54:24 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/outHumidity_percent": 89.0 (percent)
Nov 04 20:54:24 raspberrypi python3[1294821]: weewx[1294821] DEBUG user.mqtt: Publishing "weather/windDir_degree_compass": None (degree_compass)

mosquitto_sub -v -h imagingphototech.com -p 1883 -t '#'
weather/connection_status online
weather/connection_status online
weather/outTemp_degree_F 45.5
weather/outHumidity_percent 89.0
weather/windDir_degree_compass (null)
weather/windSpeed_mile_per_hour 0.0
weather/UV_uv_index 0.0
weather/dateTime_unix_epoch 1730771709
weather/usUnits 1
weather/pressure_inHg (null)
weather/altimeter_inHg (null)
weather/appTemp_degree_F 43.773622155368685
weather/barometer_inHg (null)
weather/cloudbase_foot 958.3918021116529
weather/dewpoint_degree_F 42.44907607070873
weather/ET_inch (null)

TIA

vince

unread,
Nov 4, 2024, 10:00:31 PM11/4/24
to weewx-user
You seem to be publishing to a MQTT broker on a computer on your LAN (192.168.44.204) yet you have the skin trying to connect to a MQTT websockets listener on different computer that has a public ip address (imagingphototech.com = 98.109.100.246).  That's not going to work if they are two different computers.

If you want to be LAN-only, make them both point to your LAN system's address.  If you want to view from a browser off your LAN, make them both point to your Internet system's address.   If you go Internet you should likely enable username/password for your MQTT broker there as well.

bmb...@gmail.com

unread,
Nov 4, 2024, 10:54:24 PM11/4/24
to weewx-user
I thought that the MQTT broker could be a local device if the device was the same computer as the weewx / web server. the public IP resolves to that computer. hence why I can subscribe to imagingphototech.com -t '#' and receive the publications. 
Using another computer with MQTTX, I can subscribe to either lan or wan address and receive the topics on weather / # 
yet the webpage says "waiting for data"

jterr...@gmail.com

unread,
Nov 5, 2024, 3:13:52 AM11/5/24
to weewx-user
There is no weather/loop topic shown after your "mosquitto_sub -v -h imagingphototech.com -p 1883 -t '#' " command.

Belchertown skin is looking for  this "weather/loop"  topic, and will display "waiting for data" as long as this topic is not published.

bmb...@gmail.com

unread,
Nov 5, 2024, 7:11:18 AM11/5/24
to weewx-user
right, but I dont understand why.
weeewx seems to be publsihing one:
Nov 05 07:07:59 raspberrypi python3[1316464]: weewx[1316464] DEBUG user.mqtt: New loop packet: {'outTemp': 46.4, 'outHumidity': 95.0, 'windDir': None, 'windSpeed': 0.0, 'UV': 0.0, 'dateTime': 1730808476, 'usUnits': 1, 'pressure': None, 'altimeter': None, 'appTemp': 45.245115652841136, 'barometer': None, 'cloudbase': 572.6365667027871, 'dewpoint': 45.046399106507735, 'ET': None, 'heatindex': 45.205, 'humidex': 46.594988755566824, 'inDewpoint': None, 'maxSolarRad': 14.56323578586372, 'rainRate': 0.0, 'windchill': 46.4, 'windrun': None}
topic is set for the same on both MQTT and Belchertown skin. is my MQTT broker not interacting with weewx correctly?
or, how can i figure out what loop it is publishing.

Jacques Terrettaz

unread,
Nov 5, 2024, 8:03:39 AM11/5/24
to weewx...@googlegroups.com
Which MQTT weewx extension are you using ?  

If you are using this one : https://github.com/michael-slx/weewx-mqtt. , this extension  will not generate  a weather/loop topic.

You have to use this one : https://github.com/matthewwall/weewx-mqtt

bmb...@gmail.com

unread,
Nov 5, 2024, 8:12:42 AM11/5/24
to weewx-user
Thanks, I am using the 1st one. The Matthewwall version generates errors once installed about the fact that user.mqtt.MQTT is not available? 
Ive tried (I think) to use just weather as a topic, but that doesn't seem to work? or at least I dont know the correct verbiage for it to work. 

Jacques Terrettaz

unread,
Nov 5, 2024, 8:19:14 AM11/5/24
to weewx...@googlegroups.com
You have to delete (or rename) the folder /bin/user/mqtt. , which contains the « Michael-six » extension . It is in conflict with the /bin/user/mqtt.py  of the Matthewwall version.


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/GkQS636A1sw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/0c8525c2-736a-4313-a1cd-228b5ef82982n%40googlegroups.com.

Message has been deleted

bmb...@gmail.com

unread,
Nov 5, 2024, 8:30:59 AM11/5/24
to weewx-user
Ah, getting somewhere. OK, under /etc/weewx/bin/user/ i have no mqtt folder or files.
i did find it under /usr/share/weewx/user/ and copied it to /etc/weewx/bin/user, but it still errors "Module 'user.mqtt' has no attribute 'MQTT' when searching for 'user.mqtt.MQTT'"

bmb...@gmail.com

unread,
Nov 5, 2024, 8:40:26 AM11/5/24
to weewx-user
OK!
Deleted the old michael six, reinstalled MattWall MQTT, worked out of a couple of issues, and Boom! LIVE DATA! :D
Man, i dont know what topic i would have needed to use (or if i could for the belchertown skin) for the michael6 MQTT, but its working now, finally!
now a million other little things to clean up but the major hurdle is completed. Thanks so much!!
Reply all
Reply to author
Forward
0 new messages