Cannot setup Emoncms

Hopefully, someone can help me. I am a complete newbie and have just bought an Emonpi Solar pv kit from openenergymonitor.org here in the UK and am having problems setting up EmonCMS. Hardware has been installed and appears to be working and is connected to my router using a TP-Link powerline ethernet connection and the screen on the Emonpi shows – YES.

I have pinged the emonpi from my computer and the connection appears to be OK:
sp2

I started the connection process by clicking on http://192.168.1.248 and this took me to the emoncms log-in screen. After logging in, there was no Emoncms setup wizard as described in the guide but I was taken into the setup for Emoncms and from here on I am totally lost; there are no readings from my Solar pv system or household consumption and the info on the screens is different to that shown in the guide. I did try changing things, but I think I have totally b******d up the setup process.
Here are the Inputs and Feeds screens:


I think the data is being captured by Emoncms as I can see Emonhub updating:

I did think about doing a factory reset on the emonpi and starting the process again but was worried about losing the key scripts etc.

At this stage all I want to do is get a basic setup working as shown in the setup guide. Is there anyone who can please help me get it working?

Thanks in advance

Brian

Welcome, Brian to the OEM forum.

It think you are correct there.

Correct. The numbers look believable and the data is certainly getting as far as emonHub - it looks as if you’re exporting power there.

I’m not an emonCMS expert, so I don’t understand why the data isn’t appearing on the Inputs page. I suspect one of the components within the “emonCMS” system that moves the data around isn’t running.

I’m sorry this has happened to you. I would advise doing nothing until someone better placed than me can advise you. I’d hope it’s a very simple problem.

Thanks for your response, Robert. I’m running out of ideas! I have tried creating new Emoncms accounts but no luck there either.Oddly, I can’t access the Admin page; when I click on it, I receive a message ‘Admin Authentication Required session timed out or user not Admin. Re authenticate this page’
This takes me back to the login page where I log in and still cannot access Admin page. I suspect the answer to my problem lies within the Admin page.

That’s not surprising. The emonPi emonCMS is set up by default for one user only - which is the first one you create, with full Admin rights.

Usually means you just log out and log back in. You do need to navigate back to the login page via the browser’s address bar in order to be able to log in.

One thought: after you powered your emonPi for the first time, did you give it PLENTY of time to update itself? Because if you didn’t, it’s probably half-updated and in a right tangle. If that’s the case, and you have no meaningful data that you want to keep, I’d almost suggest downloading the SD card image and reflashing it, as that will be the quickest and safest way back to a known state.

Silly me, should have RTM. Having created new users, I deleted the old accounts and so will not be able to get to the original user that I first set up.

That doesn’t work and remain in the same loop and is probably related to my comment above.

This could have happened. I have contacted openenergymonitor.org where I bought the bundle a few days ago and will wait to see what their suggestion is before reflashing the SD card (I will need some advice on how to do that!)

How did you do that? Assuming you used phpmyadmin or mySQL commands you maybe able to recover things if you can alter 2 fields in the current users MySQL record of the “user” database.

  1. the only difference between a user account and an admin account is the “admin” field has a 1 not 0 so any user can be given admin status by changing that entry.

  2. the MQTT input of emoncms is hardcoded to only use user “1” so the second and subsequent users will not get MQTT inputs, hence your data has stopped updating. By editing the “id” field of the current user to “1” you should start to see data.

However these fields are held in redis and used to create session cookies so you may need to clear the browser cache and/or flush redis to see the changes once you’ve edited the 2 fields.

Thanks for trying to help. Sadly, my experience is such that I do not understand your advice. I hoped that the setting up of the Emonpi Solar PV bundle would be ‘plug and play’ and once I had a stable connection, I would then be able to learn a little more about Raspberry Pi etc. But in answer to your question as to how I deleted the accounts, all I did was press the red button! (see screen shot below).

Ahh yes! My bad, I forgot about that button and the ability to delete oneself from within emoncms. In that case I’m afraid there is no easy way to undo what hes happened.

Basically the emonSD image ships with additional users disabled in the emoncms settings (or at least it used to), to create a second user that setting needs changing and that can only be done via the command line so it could be assumed that a user changing that setting is doing so for a reason and knows what they may be doing.

From what you write it sounds like that setting isn’t currently disabled and when you (were allowed to) set up a second user you unknowingly strayed off the beaten path and into a less “plug’n’play” grey area.

@TrystanLea or @emrys if it’s not currently the case, is it possible to prevent user 1 from ever being deleted on an emonSD install?

I’m not sure what you mean about “losing the key scripts” but if you have not collected much data and/or created alot of bespoke inputs, feeds and dashboards etc, the easyier solution would be to factory reset, we could walk you through the relevant commands in an attempt to undo whats happened but I do not see that as an easy thing and it may have future consequence (although I can’t imagine what) so a clean start may be wiser as well as easier.

Sorry, my bad words, I was (and still am) concerned that a factory reset would delete the software relating to Emoncms on the SD card… If a reset could take me back to square one, it would be ideal. I could then start the process of setting up Emoncms again. I have no meaningful production/consumption data on the card and so that would not be a problem if it was lost. In a worse case scenario, would it just be a matter of downloading and reinstalling a new copy of the software that was originally loaded on the SD card?

I’ve never tried it, I would take it as meaning “OEM Factory” as distinct from “Raspberry Pi Factory”. But as you say, if it does destroy emonHub/emonCMS, then a download and reload is easy enough. I use Balena Etcher (Linux, Windows & MacOS) on a laptop, and while it’s there (if necessary) expand the data partition using GParted.

My Emonpi Solar PV is now up and running and thought I should share the outcome with you. After my discussions with you guys, I spoke with Glyn at opernenergymonitor.org. He confirmed that by me creating new accounts I had overwritten the initial user account (only 1 user allowed). Glyn confirmed that a factory reset would allow me to start the setting-up process, but he said the best option was to send me out a new SD card which I received yesterday. However, I again encountered a problem in setting up feeds and Glyn identified that there was an error in the latest SD card build. He suggested two options, reflash the SD card with the new image or deal with the issue via SSH. Somewhat hesitantly because of my lack of experience, I chose the SSH option and using Glyn’s instructions, removed the settings file and now all is fine.

sudo rm /var/www/emoncms/settings.php

I also flashed the new image build on the old SD card using Etcher which will be useful as a backup. Well, I’ve gained some basic knowledge about SSH, Putty and Etcher which I’m sure will be useful in the future. Thanks again for your help and excellent customer service from Glyn at openenergymonitor.org too.

Just seen the latest post from @martin and it appears that he had much the same problem as me.

2 Likes