New version of the emoncms apps module

I’ve been working on a new version of the emoncms app’s module over the last few weeks, the first release of which is now ready for testing :slight_smile: The key new features are:

  • Ability to have multiple instances of an app, e.g a MyElectric app for multiple circuits in a building.

  • A list of available apps that is separate to the menu list meaning that only used app’s are shown.

  • A new sidebar menu for navigation through the apps module.

  • A large code refactor that moves away from the single page app implementation of the apps module towards a separate page for each app implementation that should help with making development of new apps easier.

  • A new My Electric app which shows a daily bar graph where a particular day can be clicked on for the detailed power view, plus average consumption comparison with UK average and ZeroCarbonBritain low energy home potential standards.

  • A Time of Use app that can show night time vs day time electricity consumption, making use of the potential of cumulative kWh feeds stored with PHPFina.

  • A Heatpump Monitoring app, for exploring COP, heat output vs electrical input and system temperatures.

  • An initial start on an OpenEVSE app to be expanded soon beyond the initial MyElectric clone that it currently is.

List of available apps:

The new apps module is currently live on emoncms.org and is available in a branch of the app’s module called refactor: https://github.com/emoncms/app/tree/refactor

The apps module requires the latest version of the emoncms master branch to work. We will be merging this in to the emonpi stable branches after a bit more testing over the next week or so.

If your interested in creating your own app, a good place to start is to try modifying and adding to the template app which gives a basic code example for a bare bones app: https://github.com/emoncms/app/blob/refactor/apps/template.php

For a full list of ongoing emoncms developments see: https://community.openenergymonitor.org/t/active-development-topics/2954/7

1 Like

The latest emoncms master branch has an option in settings.php to make the top menu bar blue which I think looks quite nice with some of the new apps in the apps module, here’s an example:

This can be enabled by setting $themecolor = “blue”; in settings.php:

// Theme location (folder located under Theme/, and must have the same structure as the basic one)
$theme = "basic";
$themecolor = "blue";

Its also possible to set an app as the starting page once you log in to emoncms. I’ve added a field to the account profile called starting page that can be set to point to any starting location, I think this gives quite a nice user experience, once its set up all you have to do is login and the main app used is shown straight away.

2 Likes

The new changes to the apps modules described by @TrystanLea in this post have now been merged into master (9.0) branch and now available on all emonSD emonPi / emonBase after running an update (Admin > Update) :tada:

@glyn.hudson
Hi Glyn
There seems to be problem with the update, after updating you get the following…

After renaming the default.settings.php…

Please find the original settings below…
settings.php.txt (5.9 KB)

Regards
Dave

Hi @Dave,

Might you have made any local custom changes to settings.php that prevented an automatic update? Could you attach a copy of your emonpiupdate.log?

You need to copy default.emonpi.settings.php

$ cp /var/www/emoncms/default.emonpi.settings.php /var/www/emoncms/settings.php

See the exact same issue on another thread:

It could be you are running an old SD card image version, I will investigate.

Thanks @glyn.hudson
I’ve replaced the settings.php with the default emonpi settings as you advised and its all working.
I’m not aware of any changes, but I am running @stuart sma bluetooth to read figures directly from the sma inverter and its not running, but could be because its night-time?
Please see below update log as requested…
emonpiupdate.log.txt (33.3 KB)

Regards
Dave

Great, thanks a lot. Any chance you could run emonPi update once more and send me the update log again?

The update log is showing that there has been a change to /etc/rc.local which might be stopping the emonPi from updating some parts of the software. Running the update a second time might fix this.

Thanks,

Hi Glyn
I hit update again and downloaded the log as below…
emonpiupdate.log.txt (39.5 KB)

Regards
Dave

Thanks. Mmm the issue is still persisting.

/home/pi/emonpi folder is not updating. I think this is due to a local change made to /home/pi/emonpi/rc.local_jessieminimal

Could you try and see what the change to this file could be by connecting via ssh and running a git diff:

cd /home/pi/emonpi
git diff rc.local_jessieminimal

There also seems to be a file called ##settings.php in /var/www/emoncms and a folder called images that I’m unfamiliar with.

Thanks Glyn
The output from the git diff is…

pi@emonpi(rw):~$ cd /home/pi/emonpi
pi@emonpi(rw):emonpi$ git diff rc.local_jessieminimal
diff --git a/rc.local_jessieminimal b/rc.local_jessieminimal
index b6b2891..07f5bda 100755
--- a/rc.local_jessieminimal
+++ b/rc.local_jessieminimal
@@ -18,6 +18,13 @@ then
   chown -R pi:pi /var/log/logrotate
   chown -R mosquitto:mosquitto /var/log/mosquitto

+if [ ! -d /var/log/supervisor ]; then
+        mkdir /var/log/supervisor;
+        touch /var/log/supervisor/supervisord.log
+        chown -R dataplicity:dataplicity /var/log/supervisor;
+        service supervisor restart
+fi
+
   # Restart services,they should run happy now log dir's are created
   service apache2 restart
   service redis-server restart
pi@emonpi(rw):emonpi$

The ##settings.php was the original settings.php that was causing problems and the images folder is for images that I load in the dashboards.

Regards
Dave

Ah, I see the issue there is an entry in rc.local from dataplicity. I’m assuming you installed dataplicity on the emonPi? I’ve not used it, however I’ve just had a look and it looks like a nice solution for easy remote Pi access: https://www.dataplicity.com/

How have you been finding it?

In order to get the emonpi folder to update while keeping the dataplicity changes to rc.local we need to stash your changes, pull in the new changes then restore your changes. Try running:

rpi-rw
cd /home/pi/emonpi
git stash
git pull
git stash pop

In order to run git stash you may need to give git your name and email. I don’t plan to push anything to github to come you can just make these up.

See the “Dataplicity VPN” thread, @barfle did say he would look at a fix for this back in January.

I saw no mention of any specific commit relating to this when I briefly looked through the repo just now though.

If I get a mo, I will try a fresh install to see if the issue still exists as the installer seems to be downloaded from the main site rather than being in the client repo so a fix might not be obvious without trying it.

Apologies for the delay. We have a new version of the agent due out in the next two weeks. I have asked that this be looked at in time for that release. Some of our own devices are also impacted by this issue.

2 Likes

Thanks Glyn

Please see below output from SSH session

pi@emonpi(rw):emonpi$ git config --global user.email [email protected]
pi@emonpi(rw):emonpi$ git config --global user.name Dave
pi@emonpi(rw):emonpi$ git stash
Saved working directory and index state WIP on master: 91d2e6f use '==' instead                                                                                                  of '='
HEAD is now at 91d2e6f use '==' instead of '='
pi@emonpi(rw):emonpi$ git pull
Updating 91d2e6f..fad6524
Fast-forward
 .gitignore               |  3 ++-
 emoncms-filesystem       |  1 +
 emoncmsupdate            | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 emonpiupdate             | 21 ++++++++++++++++++-
 factoryreset             |  2 +-
 firmware/readme.md       | 11 ++++++++++
 firmware/src/src.ino     |  6 +++---
 firstbootupdate          |  2 +-
 md5sum.py                | 24 ++++++++++++++++++++++
 ntp_update.sh            | 11 ++++++++++
 rc.local_jessieminimal   |  7 +++++--
 service-runner           |  9 +++++---
 service-runner-update.sh |  2 +-
 sudo_crontab             |  5 +++++
 14 files changed, 144 insertions(+), 13 deletions(-)
 create mode 100644 emoncms-filesystem
 create mode 100755 md5sum.py
 create mode 100755 ntp_update.sh
pi@emonpi(rw):emonpi$ git stash pop
Auto-merging rc.local_jessieminimal
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   rc.local_jessieminimal

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        1
        Atmega328/emonPi_RFM69CW_RF12Demo_DiscreteSampling/compiled/emonPi_Firmw                                                                                                 are.hex
        hardware/emonpi/emonpi2c/

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (581402d08aa6e5822dc1df9afbc239139549dc13)
pi@emonpi(rw):emonpi$

Thanks for your help all and kind regards
Dave

I’ve just added the bash commands you need to setup dataplicity log files to the standard emonPi rc.local so dataplicity will work out of the box for all emonPi users. You can now stash your changes and pull in the latest change and you will be good to go for automatic updates in the future:

rpi-rw
cd /home/pi/emonpi
git stash
git pull
rpi-ro

Then reboot to test dataplicity comes back online ok.

See my post on the dataplicity thread for more info:

1 Like

That sounds great, thank you. Is there a forum for discussing Dataplicity?

I’d like to test the new apps, but can’t find them… Have they moved to another location?

Edit: Ok got it, It’s merged to master :slight_smile:

Hi, I’m pretty much a novice with respect to EmonCMS but am getting the hang of things.
I recently updated the apps (git pull) and noticed a change from the previous My Solar Divert. Previously the divert was displayed as ‘cumulative’ with the house use. Like in this picture.

You can see the orange ‘divert’ is stacked on top of the light blue house use.

But now the divert starts on the x-axis. The reason I like it stacked is that it was easy to see if the there was a problem with the diversion. The cumulative house use and divert should not exceed the solar generation. I.e. the orange stacked on the light blue should not be more than the yellow. But now with the divert not being stacked on the house use it is difficult to visualize the total use.

Sorry…as a new user I am only allowed to post 1 picture. I hope this makes sense?
Marty

You should be able to post more.