OpenEnergyMonitor Community

Changing MQTT topic name kills my feeds

I’ve been running emon for almost five years with intermittent loss of data due to software hangups and problems with randomly created ‘ghost’ inputs, always requiring a new build and resulting in data loss.

I’ve recently built a home monitoring system that uses MQTT to collect data from various distributed sensors into an INFLUXDB system, back it up and display it with Grafana. It seemed logical to add the emon MQTT data to my system so I’ve bridged my MQTT broker to the emon MQTT broker. The only problem I had was my chosen major MQTT topic is ‘Home’. I consulted the emon docs and found a paragraph entitled ‘New MQTT Topic Format’ that states ’ *Note: the default base topic is emon/ this is set in /etc/emonhub/emonhub.conf and /var/www/emoncms/settings.ini*.’ Great, I edited emnonhub.conf to suit but settings.ini does not make any reference to the Topic Name so was not edited. I could find no other reference to changing the MQTT topic name, so assumed that was all that was necessary.

All appeared fine so I integrated the emon system into my logging and display system and now have a nice Grafana dashboard including the emon data.
Five days later I look at the emon system, no data for the past five days, more data loss !!! I can only assume that because I changed the MQTT topic the emon logging system no longer sees any data as it presumably uses the MQTT data stream as part of the feeds !!!

Can anyone please complete the instructions for changing the MQTT topic without losing all my emon feeds ???

Thanks in advance

Hello @PaulM

Yes that’s correct.

Does your MQTT section in emoncms/settings.ini look like this? assuming it does you can add the basetopic definition at the end like this:

enabled = true
user = ‘emonpi’
password = ‘emonpimqtt2016’
basetopic = ‘emon’

Hi, thanks for your reply. Yes, the [mqtt] section just has the ‘enabled…’, ‘user…’ and ‘password…’ lines. I’ll add the ‘basetopic…’ line and see what happens.

Thanks again

1 Like