Page 1 of 1

MQTT Problems

Posted: Sat 14 Aug 2021 5:58 pm
by GSV3MiaC
Had to rebuild my Raspberry Pi, from scratch, and now the Cumulus MX MQTT server does not seem to talk to the (new) mosquitto mqtt install. Everything seems the same, but no data flows. The Cumulus MX mxdiag logs show the following:

2021-08-14 18:44:50.915 InitSerial: Connection confirmed
2021-08-14 18:44:50.916 SendLoopCommand: Starting - LOOP 50
2021-08-14 18:44:54.326 LOOP: 4 - Expected data not received, expected 99 bytes, got 0
2021-08-14 18:44:58.327 LOOP: 5 - Expected data not received, expected 99 bytes, got 0
2021-08-14 18:45:00.229 DoLogFile: Writing log entry for 8/14/2021 6:45:00 PM
2021-08-14 18:45:00.230 DoLogFile: Written log entry for 8/14/2021 6:45:00 PM
2021-08-14 18:45:00.233 Writing today.ini, LastUpdateTime = 8/14/2021 6:45:00 PM raindaystart = 597.2 rain counter = 598.4
2021-08-14 18:45:02.325 LOOP: 6 - Expected data not received, expected 99 bytes, got 0
2021-08-14 18:45:03.327 LOOP: 6 - Timed out waiting for LOOP data
2021-08-14 18:45:03.328 SendLoopCommand: Starting - LPS 2 1
2021-08-14 18:45:03.412 InitSerial: Connecting to the station
2021-08-14 18:45:04.415 InitSerial: Connection confirmed
2021-08-14 18:45:04.415 SendLoopCommand: Starting - LOOP 50
2021-08-14 18:45:09.623 SendLoopCommand: Starting - LPS 2 1
2021-08-14 18:45:09.663 InitSerial: Connecting to the station
2021-08-14 18:45:10.666 InitSerial: Connection confirmed
2021-08-14 18:45:10.667 InitSerial: Connecting to the station
2021-08-14 18:45:11.676 InitSerial: Connection confirmed
2021-08-14 18:45:11.676 SendLoopCommand: Error sending LOOP command [LPS 2 1]: Specified port is not open.
2021-08-14 18:45:11.677 InitSerial: Connecting to the station
2021-08-14 18:45:12.680 InitSerial: Connection confirmed
2021-08-14 18:45:12.681 SendLoopCommand: Starting - LOOP 50
2021-08-14 18:45:15.894 SendLoopCommand: Starting - LPS 2 1
2021-08-14 18:45:15.934 SendLoopCommand: Starting - LOOP 50
2021-08-14 18:45:19.007 SendLoopCommand: Starting - LPS 2 1
2021-08-14 18:45:19.081 SendLoopCommand: Starting - LOOP 50
2021-08-14 18:45:22.323 LOOP: 4 - Expected data not received, expected 99 bytes, got 0
2021-08-14 18:45:23.325 LOOP: 4 - Timed out waiting for LOOP data
2021-08-14 18:45:23.326 SendLoopCommand: Starting - LPS 2 1
2021-08-14 18:45:23.413 InitSerial: Connecting to the station
2021-08-14 18:45:24.416 InitSerial: Connection confirmed
2021-08-14 18:45:24.416 SendLoopCommand: Starting - LOOP 50
2021-08-14 18:45:29.617 SendLoopCommand: Starting - LPS 2 1
2021-08-14 18:45:29.659 SendLoopCommand: Starting - LOOP 50
2021-08-14 18:45:31.381 WOW Response: ERROR - Response code = ServiceUnavailable, body = The service is unavailable.
2021-08-14 18:45:32.733 SendLoopCommand: Starting - LPS 2 1
2021-08-14 18:45:32.806 SendLoopCommand: Starting - LOOP 50

But whether any of that related to mqtt issues, and if so how, I do not comprehend. Help much appreciated!! The mqtt output is going to homeassistant, on the same machine, but that isn't seeing anything. mqtt is configured toi send every 30 secs (just for testing) so some should have occurred during that log snippet.

Mosquitto is running, and I see message traffic from other (local) sources, just nothing from CumulusMX.

Re: MQTT Problems

Posted: Sat 14 Aug 2021 7:54 pm
by GSV3MiaC
Updated to latest version and the log file (mxdiag) now makes more sense but still can't connect to server it at least says so now):

2021-08-14 20:50:28.664 MQTT attempting to reconnect with server
2021-08-14 20:50:28.665 MQTT reconnected OK
2021-08-14 20:50:28.668 Error: MQTT disconnected from the server
2021-08-14 20:50:28.669 MQTT Error: failed to connect to the host
2021-08-14 20:50:28.669 Error while connecting with host '192.168.1.21:1883'.
2021-08-14 20:50:29.527 LOOP: 34 - Data packet is good
2021-08-14 20:50:31.527 LOOP: 35 - Data packet is good
2021-08-14 20:50:33.519 LOOP: 36 - Data packet is good
2021-08-14 20:50:33.669 MQTT attempting to reconnect with server
2021-08-14 20:50:33.670 MQTT reconnected OK
2021-08-14 20:50:33.672 Error: MQTT disconnected from the server
2021-08-14 20:50:33.672 MQTT Error: failed to connect to the host
2021-08-14 20:50:33.672 Error while connecting with host '192.168.1.21:1883'.
2021-08-14 20:50:35.524 LOOP: 37 - Data packet is good
2021-08-14 20:50:37.618 LOOP: 38 - Data packet is good
2021-08-14 20:50:38.673 MQTT attempting to reconnect with server
2021-08-14 20:50:38.674 MQTT reconnected OK
2021-08-14 20:50:38.677 Error: MQTT disconnected from the server
2021-08-14 20:50:38.677 MQTT Error: failed to connect to the host
2021-08-14 20:50:38.678 Error while connecting with host '192.168.1.21:1883'.
2021-08-14 20:50:39.523 LOOP: 39 - Data packet is good
2021-08-14 20:50:41.525 LOOP: 40 - Data packet is good

Re: MQTT Problems

Posted: Sat 14 Aug 2021 8:20 pm
by GSV3MiaC
OK, the problem is that the latest version of mosquitto (which I got when I rebuilt) defaults to not allowing external connections at all. You need to add
'listener 1883'
and
'allow_anonymous true'

lines to a mosquitto .conf file (as found in /etc/mosquitto/conf.d folder)

Hacing got past that I am now seeing errors in the diag of
MQTTfeed: Error process the template file [mqtt/dave.txt], error = Object reference not set to an instance of an object.

OK, I discover the mqtt templates have changed rather a lot in the new release!!

Re: MQTT Problems

Posted: Mon 16 Aug 2021 10:30 am
by mcrossley
Glad you got it sorted.
GSV3MiaC wrote: Sat 14 Aug 2021 8:20 pm OK, I discover the mqtt templates have changed rather a lot in the new release!!
Yes, you need to reformat the templates for the new release - MQTT is now much more flexible in how it can be configured.