Custom build: LCD showing ERROR: MQTT Not Connected

Hello,

I have recently started my work on this project and able to get the Raw Data using Arduino Nano on RasPi terminal using CT sensor. Even after getting the IP address on LCD I get error message on my 16x2 LCD as:
Error: MQTT
Not Connected
Frankly, I am new to this segment. I have gone through the forum but not able to understand the cause of issue. Any advice that where I am lacking, why LCD is giving the Error message and how I can go further to use the EmonCMS and get the data on mobile Application.

AdityaR

This message usually appears momentarily when the emonTx is first booted as the mosquito mqtt server starts up. Please could you provide some more info about your setup are you running the pre built image SD card? What version Raspberry Pi are you using? Am I correct in assuming that you are not using an Emonpi, rather a custom setup with Arduino + Raspberry Pi?

Yes, I am using Arduino Nano + Raspberry Pi and I tried my best to follow the circuit schematic.
I am using the 3 May 2016 image SD version and Raspberry Pi 2. I am not clear about the MQTT error that why it is occurring as I am able to get the Data on RasPi terminal however they are RAW values.

It looks like the LCD python script is having trouble connecting to the Mosquitto mqtt server. You can try and connect to mosquitto yoursef.

  • log in via SSH: user ‘pi’ password: 'emonpi2016
  • Check mosquitto mqtt server is runing, run command:
    • $ sudo service mosquitto status
    • if needed $ sudo service mosquitto start or restart
  • Run command:
    • $ mosquitto_sub -v -u 'emonpi' -P 'emonpimqtt2016' -t ' emon/#'

This will display all MQTT messages on the emon topic.

emonHub and Emoncms also neeed to connect to the MQTT server you can check for errors by looking at:

$ tail /var/log/emonhub/emonhub.log
$ tail /var/log/emoncms.log

See MQTT section of the user guide for more info about how MQTT works on the emonPi: MQTT - Guide | OpenEnergyMonitor

I have checked, MQTT server is active working well. And these are the results for the log files.I find some issues in emoncms.log
It is like this: ERROR|phpmqtt_input.php|MQTT must be enabled in settings.php

I have tried changing according to your instructions in the file by referring log file but not able to rectify the issue. Kindly tell me what exactly I need to change.

Is mqtt enabled in /var/www/emoncms/settings.php

You should have entry:

  $mqtt_enabled = true;            // Activate MQTT by changing to true
    $mqtt_server = array( 'host'     => 'localhost',
                          'port'     => 1883,
                          'user'     => 'emonpi',
                          'password' => 'emonpimqtt2016',
                          'basetopic'=> 'emon'

If not then just replace settings.php with default.emonpi.settings.php

`
$ rpi-rw
$ cd /var/ww
$ sudo cp emonpi.settings.php settings.php
$ sudo service mqtt_input restart
$ rpi-ro

Hello Glyn thanks for this.Yes, I have implemented as you guided.
It shows on LCD:

date JUl 01 04:56
Uptime 0.03 days

emonPi Build
emonSD-03May16

WiFi: YES xx%
192.168.xx.xx

ERROR: MQTT
Not Connected

I am able to get something on EmonCMS app (My Electric) 200W POWER and a graphical change. I have interfaced Arduino UNO board this time (sudo nano emonpi/firmware/platformio.ini). As board mentioned in platformio.ini is UNO.

However, LCD showing the same error
ERROR: MQTT
Not Connected

Check the lcd script logfile:

/var/log/emonpilcd/emonpilcd.log

And check that the mqtt credentials are correct in

/home/pi/emonpi/emonPiLCD/emoPiLCD.py