Community
OpenEnergyMonitor

Community

Install EmonCMS onto DietPi

Hello

I already installed emoncms from zero through dietpi it seems that everything is going well but the data sent by emonesp by mqtt does not appear, where i would have to configure them in inputs? i am a little lost, in emoncms.org gets them well but no in local


thank you

You will need to explain how you did that.

  • Did you install the LAMP server and Mosquitto through the dietpi-software command
  • or did you use the EmonScripts
  • or some other method?

Can you click on the button Copy as Markdown next to Server Information on the Admin page and paste here please (no further formatting required).

image

In general the problem is the emoncms_mqtt service is dead so EmonCMS is not reading the data from the MQTT Broker.
image

[edit]
That service is the ‘old’ service which is probably why it is dead.

The service-runner service is also not present.

I used the guide https://tech.borpin.co.uk/2018/10/13/emoncms-on-dietpi/
the packages available in diet-software with some variants for example php7.3 instead 7.0
copy as Markdown–>

Server Information

Server Information

Services

  • mqtt_input :- Activating Auto-restart
  • emoncms_mqtt :- Activating Auto-restart
  • redis-server :- Active Running
  • mosquitto :- Active Running

Emoncms

  • Version :- 10.1.13
  • Modules :- Administration | App v2.0.9 | Dashboard v2.0.5 | Device v2.0.3 | EventProcesses | Feed | Graph v2.0.6 | Input | CoreProcess | Schedule | Time | User | Visualisation
  • Git :-

Server

  • OS :- Linux 4.19.75+
  • Host :- emonpi | emonpi | (192.168.3.97)
  • Date :- 2019-12-19 11:27:29 UTC
  • Uptime :- 11:27:29 up 10 min, 1 user, load average: 0.24, 0.28, 0.20

Memory

  • RAM :- Used: 18.94%
    • Total :- 480.27 MB
    • Used :- 90.96 MB
    • Free :- 389.31 MB
  • Swap :- Used: 0.00%
    • Total :- 1.53 GB
    • Used :- 0 B
    • Free :- 1.53 GB
      Write Load Period

Disk

  • / :- Used: 19.56%
    • Total :- 14.33 GB
    • Used :- 2.8 GB
    • Free :- 11.07 GB
    • Write Load :- -16.64 B/s (9 hours 50 mins)
  • /boot :- Used: 21.53%
    • Total :- 252.05 MB
    • Used :- 54.28 MB
    • Free :- 197.77 MB
    • Write Load :- 0 B/s (9 hours 50 mins)

HTTP

  • Server :- Apache/2.4.38 (Raspbian) HTTP/1.1 CGI/1.1 80

MySQL

  • Version :- 5.5.5-10.3.17-MariaDB-0+deb10u1
  • Host :- localhost:6379 (127.0.0.1)
  • Date :- 2019-12-19 11:27:28 (UTC 00:00‌​)
  • Stats :- Uptime: 598 Threads: 9 Questions: 154 Slow queries: 0 Opens: 42 Flush tables: 1 Open tables: 36 Queries per second avg: 0.257

Redis

  • Version :-
    • Redis Server :- 5.0.3
    • PHP Redis :- 4.2.0
  • Host :- localhost:6379
  • Size :- 21 keys (741.30K)
  • Uptime :- 0 days

MQTT Server

  • Version :- Mosquitto 1.5.7
  • Host :- localhost:1883 (127.0.0.1)

PHP

  • Version :- 7.3.11-1~deb10u1 (Zend Version 3.3.11)
  • Modules :- apache2handler | apcu v5.1.17 | calendar v7.3.11-1~deb10u1 | Core v7.3.11-1~deb10u1 | ctype v7.3.11-1~deb10u1 | curl v7.3.11-1~deb10u1 | date v7.3.11-1~deb10u1 | dom v20031129 | exif v7.3.11-1~deb10u1 | fileinfo v7.3.11-1~deb10u1 | filter v7.3.11-1~deb10u1 | ftp v7.3.11-1~deb10u1 | gd v7.3.11-1~deb10u1 | gettext v7.3.11-1~deb10u1 | hash v7.3.11-1~deb10u1 | iconv v7.3.11-1~deb10u1 | igbinary v3.0.0 | json v1.7.0 | libxml v7.3.11-1~deb10u1 | mbstring v7.3.11-1~deb10u1 | mosquitto v0.4.0 | mysqli v7.3.11-1~deb10u1 | mysqlnd vmysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $ | openssl v7.3.11-1~deb10u1 | pcre v7.3.11-1~deb10u1 | PDO v7.3.11-1~deb10u1 | pdo_mysql v7.3.11-1~deb10u1 | Phar v7.3.11-1~deb10u1 | posix v7.3.11-1~deb10u1 | readline v7.3.11-1~deb10u1 | redis v4.2.0 | Reflection v7.3.11-1~deb10u1 | remctl v3.15 | session v7.3.11-1~deb10u1 | shmop v7.3.11-1~deb10u1 | SimpleXML v7.3.11-1~deb10u1 | sockets v7.3.11-1~deb10u1 | sodium v7.3.11-1~deb10u1 | SPL v7.3.11-1~deb10u1 | standard v7.3.11-1~deb10u1 | sysvmsg v7.3.11-1~deb10u1 | sysvsem v7.3.11-1~deb10u1 | sysvshm v7.3.11-1~deb10u1 | tokenizer v7.3.11-1~deb10u1 | wddx v7.3.11-1~deb10u1 | xml v7.3.11-1~deb10u1 | xmlreader v7.3.11-1~deb10u1 | xmlwriter v7.3.11-1~deb10u1 | xsl v7.3.11-1~deb10u1 | Zend OPcache v7.3.11-1~deb10u1 | zip v1.15.4 | zlib v7.3.11-1~deb10u1
Client Information

Client Information

HTTP

  • Browser :- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15
  • Language :- en-us

Window

  • Size :- 1918 x 894

Screen

  • Resolution :- 1920 x 1080

NOW SHOW


mqtt_input
Activating Auto-restart

but when test status,

[email protected]:/var/www/html# service mqtt_input status
● mqtt_input.service - Emoncms MQTT Input Script
Loaded: loaded (/etc/systemd/system/mqtt_input.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2019-12-19 11:27:36 GMT; 29s ago
Docs: https://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
Process: 1202 ExecStart=/usr/bin/php /var/www/emoncms/scripts/phpmqtt_input.php (code=exited, status=255/EXCEPTION)
Main PID: 1202 (code=exited, status=255/EXCEPTION)
[email protected]:/var/www/html#

Service runner also try install but said me error
sudo pip install redis
sudo ln -s /var/www/emoncms/scripts/services/service-runner/service-runner.service /lib/systemd/system
sudo systemctl enable service-runner.service
sudo systemctl start service-runner.service
systemctl status service-runner.service

[email protected]:/var/www/html/emoncms# systemctl status service-runner.service
● service-runner.service - Emoncms service-runner Input Script
Loaded: loaded (/var/www/emoncms/scripts/services/service-runner/service-runner.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2019-12-19 11:56:42 GMT; 4s ago
Docs: https://github.com/emoncms/emoncms/blob/master/scripts/services/install-service-runner-update.md
Process: 1929 ExecStart=/usr/bin/python /var/www/emoncms/scripts/services/service-runner/service-runner.py (code=exited, status=217/USER)
Main PID: 1929 (code=exited, status=217/USER)

I’m guilty for that :grin:, but DietPi and EmonCMS have moved on :frowning_face: but it should still be possible.

The major issue is that the folder structure has changed as have the services since I wrote that and the Item I link to for the MQTT install has been depreciated - note the top heading.

I’m wondering how best to install EmonCMS onto DietPi now. I am thinking that it might be better to use the EmonScripts and tell the install script not to install the elements installed by dietpi-software. However, that is fairly high risk.

In simple terms you want to do the same as this bit of the install script

but possibly change the drop-in for the service.

What hardware are you using? Is there a specific need for DietPi? At the time I was using low power gear so wanted a lightweight base OS.

I have now put a warning on that guide that it is depreciated.

Raspberry pi nano Zero Wifi, I’m going to try the Emonscripts
thank you

Do you have an EmonBase RFM card?

Are you using Lighttpd or Apache?

It really depends how much effort you want to put in to get it running. I suspect it will take a few attempts to get it right - when I am trying this sort of thing I tend to go back to a fresh image a couple of times when I get something wrong.

Looking at it, I think it should work if you use the EmonScript but with the appropriate changes to the config file.

It may need some manual setting of the webserver as that is all tied into the install of apache.

Yes I used apache2, a question if I run the installation script will overwrite everything or I should start a fresh installation again?

This is a tricky one.

I know that DietPi do some interesting things when installing software so it is usually better to install from their software installer, but EmonCMS does some of the config after install.

If you stop EmonCMS installing Apache, then it will not get configured correctly!

I’d start from a fresh DietPi image.

Definitely disable the installation of Log2Ram in the config file (comment it out).

I already did the complete installation of dietpi and emoncms from the scripts but now there is no service working

Server Information

Server Information

Services

Emoncms

  • Version :- low-write 10.1.13
  • Modules :- Administration | App v2.0.9 | Backup v2.1.7 | Dashboard v2.0.5 | DemandShaper v1.1.0 | Device v2.0.3 | EventProcesses | Feed | Graph v2.0.6 | Input | Postprocess v2.1.2 | CoreProcess | Schedule | sync | Time | User | Visualisation
  • Git :-

Server

  • OS :- Linux 4.19.75+
  • Host :- emonpi | emonpi | (192.168.3.96)
  • Date :- 2019-12-19 17:06:11 UTC
  • Uptime :- 17:06:11 up 1 min, 1 user, load average: 2.12, 0.87, 0.32

Memory

  • RAM :- Used: 20.16%
    • Total :- 480.27 MB
    • Used :- 96.81 MB
    • Free :- 383.46 MB
  • Swap :- Used: 0.00%
    • Total :- 1.53 GB
    • Used :- 0 B
    • Free :- 1.53 GB
      Write Load Period

Disk

  • / :- Used: 20.40%
    • Total :- 14.33 GB
    • Used :- 2.92 GB
    • Free :- 10.95 GB
    • Write Load :- 3.67 KB/s (0 mins)
  • /boot :- Used: 21.55%
    • Total :- 252.05 MB
    • Used :- 54.31 MB
    • Free :- 197.73 MB
    • Write Load :- 0 B/s (0 mins)

HTTP

  • Server :- Apache/2.4.38 (Raspbian) HTTP/1.1 CGI/1.1 80

MySQL

  • Version :- 5.5.5-10.3.17-MariaDB-0+deb10u1
  • Host :- localhost:6379 (127.0.0.1)
  • Date :- 2019-12-19 17:06:11 (UTC 00:00‌​)
  • Stats :- Uptime: 66 Threads: 10 Questions: 136 Slow queries: 0 Opens: 45 Flush tables: 1 Open tables: 39 Queries per second avg: 2.060

Redis

  • Version :-
    • Redis Server :- 5.0.3
    • PHP Redis :- 5.1.1
  • Host :- localhost:6379
  • Size :- 3 keys (756.48K)
  • Uptime :- 0 days

MQTT Server

  • Version :- Mosquitto 1.5.7
  • Host :- localhost:1883 (127.0.0.1)

PHP

  • Version :- 7.3.11-1~deb10u1 (Zend Version 3.3.11)
  • Modules :- apache2handler | calendar v7.3.11-1~deb10u1 | Core v7.3.11-1~deb10u1 | ctype v7.3.11-1~deb10u1 | curl v7.3.11-1~deb10u1 | date v7.3.11-1~deb10u1 | dom v20031129 | exif v7.3.11-1~deb10u1 | fileinfo v7.3.11-1~deb10u1 | filter v7.3.11-1~deb10u1 | ftp v7.3.11-1~deb10u1 | gd v7.3.11-1~deb10u1 | gettext v7.3.11-1~deb10u1 | hash v7.3.11-1~deb10u1 | iconv v7.3.11-1~deb10u1 | json v1.7.0 | libxml v7.3.11-1~deb10u1 | mbstring v7.3.11-1~deb10u1 | mosquitto v0.4.0 | mysqli v7.3.11-1~deb10u1 | mysqlnd vmysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $ | openssl v7.3.11-1~deb10u1 | pcre v7.3.11-1~deb10u1 | PDO v7.3.11-1~deb10u1 | pdo_mysql v7.3.11-1~deb10u1 | Phar v7.3.11-1~deb10u1 | posix v7.3.11-1~deb10u1 | readline v7.3.11-1~deb10u1 | redis v5.1.1 | Reflection v7.3.11-1~deb10u1 | session v7.3.11-1~deb10u1 | shmop v7.3.11-1~deb10u1 | SimpleXML v7.3.11-1~deb10u1 | sockets v7.3.11-1~deb10u1 | sodium v7.3.11-1~deb10u1 | SPL v7.3.11-1~deb10u1 | standard v7.3.11-1~deb10u1 | sysvmsg v7.3.11-1~deb10u1 | sysvsem v7.3.11-1~deb10u1 | sysvshm v7.3.11-1~deb10u1 | tokenizer v7.3.11-1~deb10u1 | wddx v7.3.11-1~deb10u1 | xml v7.3.11-1~deb10u1 | xmlreader v7.3.11-1~deb10u1 | xmlwriter v7.3.11-1~deb10u1 | xsl v7.3.11-1~deb10u1 | Zend OPcache v7.3.11-1~deb10u1 | zlib v7.3.11-1~deb10u1
Client Information

Client Information

HTTP

  • Browser :- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15
  • Language :- en-us

Window

  • Size :- 1918 x 840

Screen

  • Resolution :- 1920 x 1080
LAST ENTRIES ON THE LOG FILE

Did you record the the output messages during the install?

When I run the install I tee the messages to a log file.

./main.sh 2>&1 | tee install.log

[edit]
Can you post the config.ini you used for the install as well?

[edit2]
you can probably test by just running emoncms_core.sh script as that installs the services and look for the errors.

[edit3]
Ah - the issue may be sudo as this is widely used but IIRC not installed by default on DietPi as you run normally as root.

@b31k - I’ve moved this to a new thread that reflects what is going on.

Hello

it’s finally working in Raspberry pi ZERO w

  • Fresh install from Raspibian Lite to SD
  • Install Emoncms Script
  • Post configure, desactive emonhub, service-runner and demandshaper.

…and automatically appears in the inputs menu the data of the emonesp.

You need service-runner.

Ok, I reinstalled redis

sudo pip install redis
sudo ln -s /var/www/emoncms/scripts/services/service-runner/service-runner.service /lib/systemd/system
sudo systemctl enable service-runner.service
sudo systemctl start service-runner.service
systemctl status service-runner.service

[email protected]:~ $ systemctl status service-runner.service
● service-runner.service - Emoncms service-runner Input Script
   Loaded: loaded (/var/www/emoncms/scripts/services/service-runner/service-runner.service; enabled; vendor preset: enabled)
   Active: **active (running)** since Sat 2019-12-21 12:28:21 GMT; 1s ago
     Docs: https://github.com/emoncms/emoncms/blob/master/scripts/services/install-service-runner-update.md
 Main PID: 14983 ((python))
   Memory: 0B
   CGroup: /system.slice/service-runner.service
           └─14983 (python)

Dec 21 12:28:21 emonpi systemd[1]: Started Emoncms service-runner Input Script.

but I a have new a problem in App My electric, not show Kwh yesterday show me but not today???
I don’t know if it has anything to do with the installation.

thank you

1 Like

There are 3 bits to the Redis puzzle, the server (from apt), the PHP extension (from PECL) and the Python package (PIP).

Are all 3 running/enabled/configured?