Tried to update my emonpi using the Admin function. Previously it had been running flawlessly. Now the screen shows ERROR MQTT not connected. I’ve looked in the forum for help.
sudo service mosquitto status sows that Mosquito is running
and the (hopefully) relevant part of emonhub.conf says
Type = EmonHubMqttInterfacer
mqtt_host = 127.0.0.1
mqtt_port = 1883
mqtt_user = ''
mqtt_passwd = ''
pubchannels = ToRFM12,
subchannels = ToEmonCMS,
# emonhub/rx/10/values format
# Use with emoncms Nodes module
node_format_enable = 1
node_format_basetopic = emonhub/
# emon/emontx/power1 format - use with Emoncms MQTT input
nodevar_format_enable = 1
nodevar_format_basetopic = emon/
I’d be really grateful for any ideas please
Anything reported in emonhub.log or emoncms.log?
emonhub.log shows nothing but emoncms.log has many lines - short extract…
2017-5-3 18:32:48 FEEDWRITER INFO PHPFina bytes written: 0
2017-5-3 18:32:54 MQTT INFO Reloading config
2017-5-3 18:33:00 MQTT INFO Reloading config
2017-5-3 18:33:06 MQTT INFO Reloading config
2017-5-3 18:33:12 MQTT INFO Reloading config
2017-5-3 18:33:18 MQTT INFO Reloading config
2017-5-3 18:33:24 MQTT INFO Reloading config
2017-5-3 18:33:30 MQTT INFO Reloading config
2017-5-3 18:33:36 MQTT INFO Reloading config
2017-5-3 18:33:42 MQTT INFO Reloading config
2017-5-3 18:33:48 MQTT INFO Reloading config
2017-5-3 18:33:48 FEEDWRITER INFO PHPTimeSeries bytes written: 0
2017-5-3 18:33:48 FEEDWRITER INFO PHPFina bytes written: 0
2017-5-3 18:33:54 MQTT INFO Reloading config
2017-5-3 18:34:00 MQTT INFO Reloading config
2017-5-3 18:34:06 MQTT INFO Reloading config
2017-5-3 18:34:12 MQTT INFO Reloading config
2017-5-3 18:34:18 MQTT INFO Reloading config
2017-5-3 18:34:24 MQTT INFO Reloading config
2017-5-3 18:34:30 MQTT INFO Reloading config
2017-5-3 18:34:36 MQTT INFO Reloading config
2017-5-3 18:34:42 MQTT INFO Reloading config
2017-5-3 18:34:48 MQTT INFO Reloading config
2017-5-3 18:34:48 FEEDWRITER INFO PHPTimeSeries bytes written: 0
2017-5-3 18:34:48 FEEDWRITER INFO PHPFina bytes written: 0
2017-5-3 18:34:54 MQTT INFO Reloading config
2017-5-3 18:35:00 MQTT INFO Reloading config
2017-5-3 18:35:06 MQTT INFO Reloading config
2017-5-3 18:35:12 MQTT INFO Reloading config
2017-5-3 18:35:18 MQTT INFO Reloading config
Does that help shed any light? Really grateful for any ideas (newbie, don’t know what this all means )
Unfortunately not, or at least not to me it doesn’t, I might hazard a guess that the emoncms input is having trouble loading the config, are you able to ssh into the emonPi and try this command?
mosquitto_sub -v -u 'emonpi' -P 'emonpimqtt2016' -t 'emon/#'
if you get output resembling something like this
it would suggest the issue is with emoncms and you maybe able to find something using
sudo systemctl status mqtt_input.service
or even resarting the service with
sudo service mqtt_input stop
sudo service mqtt_input start
Or can you attach your emonpi_update.log? you can download it from the emoncms admin page.
How old is the emonPi? or more importantly, how old was the emonSD image prior to updating?
Yes I can SSH in ok
mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘emon/#’ just freezes, no response, even with a sudo
sudo systemctl status mqtt_input.service gives an answer systemctl: command not found
sudo service mqtt_input stop says mqtt unrecognised service
The emonPi is about 18 months old and I upgraded successfully earlier this year, prabably Feb or March
emonpiupdate.log is now blank which is strange as it was populated with details of the earlier upgrade when I clicked on it this afternoon
Oh dear !!! That sounds like you have a “pre-systemd” OS ie Raspbian wheezy (or Minibian?) and the “mqtt_input” init script has been removed by the update script perhaps (See the “EmonPi problem after update” thread for more info)
I think that would have probably been before Glyn switched out the mqtt service from SysV to systemd (see the “Mqtt_input script run as systemd instead of initd” thread for more info).
That’s a shame, it would have shed some light on whats what,
Can you tell us the response to
ls -la /etc/init.d/mqtt_input
ls -la /var/www/emoncms/scripts/mqtt_input
EDIT - and what is returned by this command too
ls /boot | grep emonSD
ls -la /etc/init.d/mqtt_input SAYS ls: cannot access/etc/init.d/mqtt_input: No such file or directory
ls -la /var/www/emoncms/scripts/mqtt_input also reports no such file etc
I’m starting to think I’ll have to reflash the card and start again - is there any way of saving some settings (e.g. the details of the cms site I report to (at a university, not the standard emoncms)
amd ls /boot | grep emonSD reports emonsd 17Jun2015_2updated
That will be the problem, that is an old image that uses a different OS and isn’t compatable with the current emonSD update routine.
Now would be a good time to switch to the new emonSD image. It would make more sense than trying to fix an out dated image, I think the current image is more “future proof” in it’s design.
Hopefully @jon or @paul or @glyn.hudson can jump in and offer some advice on how to transfer settings and data as that’s not something I have much experience with.
However you go about transfering your settings and data, I would recommend taking this oppertunity to replace your SD card perhaps, they are not expensive and it’s always handy to have a spare. Installing a new image to a new (larger?) card will mean you have the old one to get stuff off right up until the new one is fully running.
i do not play with emonsd that much. but perhaps you just need to re install mqtt
sudo apt-get install mosquitto
and sudo apt-get install mosquitto-clients
it worth a chance over reflashing everything
and hopefully that all that broken
or manual insert the mqtt_input script
Jeremy could indeed try fixing it, all the info he needs is on one of those links I provided. Mosquitto itself will still be there and running just fine, all that is missing is the later phpmqtt_input.php script and it’s init script. once these are present and the service is enabled it should work. BUT it will still be old software without an update path on an OS thats no longer used and also vulnerable to the “dirty cow” exploit.
Now is as good as any time to take the plunge to the later image rather than investing time in something that will never improve or evolve, but that’s just my tuppence worth of course.
Many thanks both
Stephen’s suggestions tried but I’m already running latest versions
I think I’ll take the plunge as Paul suggests and move to the latest image (on a brand new card)
BUT - is there any way to get useful stuff off the old system first? I’m thinking of historical data, feed settings etc
This is a really helpful forum, thanks folks
Yes there is a backup module and an export function on the later images but I am not familiar with the image you are using, I’m not sure they are there on the july2015 image, which is why I invited some others to help. Perhaps we can update emoncms and add any modules manually to get your data off.
In the mean time you can still start getting your new image up and running if you are using a different microSD card.
Thinking about it there may even be a forum thread or guide on migration from july15 to dec16.
Thank you. I’ve bitten the bullet and upgraded to the new image on a shiny new SD card (they’re so cheap these days!). Still need to sort out my graphs but looking good so far
Many thanks for the advice chaps
Glad you are getting it sorted, sorry none of my colleagues managed to find the time to offer some wise words on migrating the data and settings but a search turned up a thread pointing to this page in the guide.
Your old image should have updated to the latest emoncms and installed the backup module so you should be able to follow that guide ok.