I've been following this guide - http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi and http://openenergymonitor.org/emon/emoncms/installing-ubuntu-debian-pi - for installing emoncms on my RaspberryPi and all is going well except for the bit about SSH keys (http://openenergymonitor.org/emon/emoncms/installing-ubuntu-debian-pi section 6).
In the helpful tip:
Helpful tip: If doing this via SSH use $ cat /home/pi/.ssh/id_rsa.pub to display the SSH key in the terminal window. then select and [Ctrl + Shift + C] to copy to clipboard ready to paste into Github setting page.
Can anyone explain more about this - is it on the Raspberry, or PC? I've tried typing that into the Raspberry and also following this guide https://help.github.com/articles/generating-ssh-keys but I can't figure what to do.
Incase it matters, I am controlling the Raspberry from my laptop using Putty
I have tried going further without this SSH keys bit and everything appears to work, until i type my IP address into my browser - I get nothing. I guess this is related to the SSH keys?
I may just be getting a little out of my depth, but I have one of Martin Harizanov's RFM12B to raspberry boards which I hope to get all setup.
Thanks
Dennis
Re: emoncms onto RaspberryPI
I am thinking of creating a SD image with emoncms all set up, you will just have to plug in the RFM2Pi board. How does that sound?
I will be making step by step notes in the process and also make these available.
As per using git: you can also just download emoncms as a .zip and unzip it in /var/www
Also, note that latest emoncms (https://github.com/emoncms/emoncms) doeas have an add-on module for the rfm2pi board (https://github.com/emoncms/raspberrypi)
There is no documentation on how to install it yet, I am planning of creating such these days.
Re: emoncms onto RaspberryPI
That's very cool!
The only problem left is getting a Raspberry Pi :-). Waiting times are like 3 weeks (I live in the EU)...
Re: emoncms onto RaspberryPI
A ready loaded SD card sounds an excellent idea - I for one would certainly be interested.
As it is, I followed all the installation steps as per my initial post and all appeared to go well, except for the bit about SSH keys (it did say optional anyway so I initially carried on past it) and then at the bit where I type in my RaspberryPI IP address. Am I correct in that http://192.168.1.199/emoncms3 is what I type - 192.168.1.199 is definately the RaspberryIP LAN IP, although it does have a wifi adaptor but I tried it's IP address aswell with no luck (it appears intermittent whether it works or not when accessing with Putty).
Dennis
Re: emoncms onto RaspberryPI
I'm in!
Closer reading explains all - I was trying to change the settings for the non-modular version when I had installed the modular.
My IP address part was correct except the url ends in emoncms instead of emoncms3.
So I've logged into emoncms, ran minicom and I see serial data received so all looks good so far. I'll now wait patiently for the rest of the quide to complete.
Thanks
Re: emoncms onto RaspberryPI
Documentation for rm12pi is slowly taking shape: http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi, not quite complete yet. Trystran is working on making the modular emoncms easier to setup with auto module detection. Should be on github soon.
Yes, releasing a ready to go SD card image is on the plan.
Re: emoncms onto RaspberryPI
Hi,
thanks all, at same stage as Denis above,
I followed instructions and receiving fine (serial port RPi) from two nodes (emontx and emonglcd) see attached screen shots.
I also installed modular emoncms as described and can now register and login etc. ok
Looking forward to next instructions, in the mean time is there any point in trying to use script at
https://github.com/mharizanov/TinySensor/blob/42208d23cdc8d3308a844b8909... or other - more as a learning curve then to preempt proper solution.
Cheers
Peter
P.S. Anyone got description of serial input, with exception on first part on each line which is node ID it doesn't make much sense to me refer attached screenshots, tried changing temp and power to see which changed but not much clarity.
Re: emoncms onto RaspberryPI
I am correcting the link to the wiki in Glyn's post, it should be:
http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi
Great work there Glyn!
Just a comment on those that don't want to use or install git, you can use this alternative method to pull the latest emoncms and raspberrypi module:
cd /var/www/
sudo wget -O emoncms.tar.gz https://github.com/emoncms/emoncms/tarball/master
tar xvfz emoncms.tar.gz
sudo mv -i emoncms-emoncms-96885fe emoncms
cd /var/www/Modules/
sudo wget -O raspberrypi.tar.gz https://github.com/emoncms/raspberrypi/tarball/master
tar xvfz raspberrypi.tar.gz
sudo mv -i emoncms-raspberrypi-b9703b5 raspberrypi
NOTE that the bold part will change with every new version on github so you need to replace with the correct value
I added these ti the wiki
Also, you can create the tables required for the raspberrypi module by simply visiting the ADMIN tab, so that won't require any modification in index.php
I have the SD card image ready, but it is a 8GB one, this is the size of my SD card. I will see how large it is when zipped, and need to think of a way to share that over the interned without spending al my site allowed traffic ..
I will post details on my experience with setting the cron job for the raspberrypi module later today.
Re: emoncms onto RaspberryPI
Great thanks Martin.
I followed link above and it all seems to work fine, the serial port on Pi is reading from RFM12 you sent for both my emontx and emonglcd. The emoncms modular version is working on Raspberry Pi as per instructions above.
But what now? Where do I put API code for my emoncms and how do I use data received. Lots of questions if the answer is wait that's no problem but if you can advise I would like to try over weekend - great learning curve ( but don't want to waste your valuable time).
Cheer
Peter
Re: emoncms onto RaspberryPI
The rest is pretty easy, here is how I got it to work, maybe not the best way. No need to put the API anywhere, it already knows it as it is part of emoncms now.
Edit crontab this way:
and add this line to the end of it:
*/1 * * * * root cd /var/www/emoncms/Modules/raspberrypi && php raspberrypi_run.php
then reboot and you will start seeing data being fed in emoncms.
From there on it is the standard stuff, identify the inputs and log them to feeds.
Re: emoncms onto RaspberryPI
The original raspberrypi_run.php file runs too slow and omits transmissions. Here is my fix for those eager to test it out
Re: emoncms onto RaspberryPI
Thanks Martin. I'll add your non git based setup info to the wiki and get Trystan to take a look at the php script and your fix.
Re: emoncms onto RaspberryPI
If anyone notices any errors on the wiki. Feel free to edit. Your openenergymonitor.org login details should carry over. You might need to logout then log back in before loading the wiki for it to work.
Re: emoncms onto RaspberryPI
Hello again. Hope you can assist me a bit more please I'm a bit stuck.
Getting the following in emoncms "Message: The RFM12 to PI interface script is not running, you may need to configure cron"
Cron file below: I added job (php raspberrypi_run.php) correct I hope???? and reboot
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
*/1 * * * * root cd /var/www/emoncms/Modules/raspberrypi && php raspberrypi_run.php
#
Also question about base id in emoncms - see screen shot. Is the id given to raspberry pi (RF12 module)
Cheers
Peter
Re: emoncms onto RaspberryPI
I get that from time to time, yet the INPUTS tab shows data is incomming. Do you have data beinf fed?
Re: emoncms onto RaspberryPI
Hi Martin,
I can use API help in emoncms using Set the input entry time manually: to send data ok see screen print attached.
As discusse I am receiving data on minicom ok for two nodes node =10 (emontx) and node =20 (emonglcd) both on group 210. A screen shot minicom is in my earlier post above.
Do I have to customize the file you provided above php raspberrypi_run.php ??? OR OTHER fILES
Cheers
Peter
Re: emoncms onto RaspberryPI
Yes please replace the raspberrypi_run.php with the content as shown above. The original file didn't work for me well as it was skipping most of the incoming messages. Simply copy/paste the content and save.
sudo nano /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php
Re: emoncms onto RaspberryPI
I already did this. My question is do I need to customize any part of the file for my nodes or my API key?
Thanks
Re: emoncms onto RaspberryPI
Great Martin, thanks for the speed improvements and working out the cron setup. I have updated your changes to the raspberrypi_run.php script to the repo. I've also updated the wiki documentation with the setup steps.
Re: emoncms onto RaspberryPI
Sorry Peter, I am reading between the lines :(
No, no need to set-up the API. The raspberrypi_run.php script pulls it out of the database. The script works by just capturing incoming packets from whatever node id. It expects that the node is sending payload of INT values only (no limit in the number of int values). Then it creates an input for that node in the form
node#_@ where # is the id of the remote node and @ is the payload int index. For emonTx we have a structure of this sort:
typedef struct { int power1, power2, power3, battery; } PayloadTX;
so you will receive something like this:
node10_1= power 1 reading
node10_2=power2 reading
node10_3=power3 reading
node10_4=battery
This is possible because all the values in the payload are ints. This is the part of the code that takes care of it:
$values = explode(' ',$data);
$msubs = "";
for($i=2; $i<(count($values)-1); $i+=2){
if ($i>2) $msubs .= ",";
$msubs .= $values[$i] + $values[$i+1]*256;
}
This approach utilizes the newly introduces CSV multinode concept, where you don't need to re-program the gateway (nanode or raspberry) with each additional node that you add to your system, as it automatically recognizes it and adds it to the list of inputs. quite neat, but at the cost of expecting only ints as payload. Not that this is a big problem, because lots of readings can be fit in an int. Temperatures multiplied by 100 also fit in int and then in emoncms you simply add a rule to multiply the incomng value by 0.01 to get the actual value.
If you still want to decode the incoming packets and make a good old json post, I have example of that in PHP here: https://github.com/mharizanov/TinySensor/blob/master/PHP_gateway/serial.php
it is pretty easy, and then you can have any type of packet, but will require script modification with the addition of each new node. Still I recommend to use the CSV approach.
Maybe in the future emoncms will support node configuration, where one of the settings will be a string to identify the incoming packet data structure types.
The ID of the RFM2Pi board should be some available number, 25 seems fine. It only matters, if you send packets. That's useful when you have the EMONGLCD for example, and need to send out the current time. I have example of this in my perl script, but I guess this is something yet to be added to the raspberrypi_run.php
I hope this helps
Re: emoncms onto RaspberryPI
Hi Martin/Trystan. Thanks a mil Martin for detailed explanation, helped a lot. I've reinstalled using latest files and followed new instructions published by Trystan.
Making progress, I can now see RFM12 to PI interface script is up and running in emoncms panel. I have verified again rf12 receiving ok
[RF12demo.Attiny84]
Available commands:
<nn> i - set node ID (standard node ids are 1..26)
(or enter an uppercase 'A'..'Z' to set id)
<n> b - set MHz band (4 = 433, 8 = 868, 9 = 915)
<nnn> g - set network group (RFM12 only allows 212, 0 = any)
<n> c - set collect mode (advanced, normally 0)
...,<nn> a - send data packet to node <nn>, with ack
...,<nn> s - send data packet to node <nn>, no ack
<n> l - turn activity LED on DIG8 on or off
<n> q - set quiet mode (1 = don't report bad packets)
Current configuration:
88 i24 g210 @ 868 MHz
10 60 0 62 0 14 0 231 101 26 5 60 0
10 61 0 63 0 11 0 228 101 26 5 60 0
10 61 0 62 0 17 0 172 101 26 5 61 0
No inputs yet for node10 - will keep you posted on progress, thanks again.
Cheers
Peter
P.S. From your post above "No, no need to set-up the API" can you please explain how script knows where to send inputs e.g. in the case were I have numerous registered users and API keys.
Re: emoncms onto RaspberryPI
Lets try couple things:
can you do the following from the console:
$ mysql -u root -p
it will ask for your password, enter the one you used when setting up emoncms.
Then change the database by typing:
mysql> use emoncms; <enter>
next, lets see what users you have in the system, we need the ID:
lets see what you have in the raspberrypi table:
mysql> select * from raspberrypi;
So for user ID (mharizanov) I do have all that is necessary - api key and settings.
can you repeat these steps and post the result? I suspect that if you have more than one user registered, it may be picking the wrong api key.
Re: emoncms onto RaspberryPI
4Here you go.
mysql> select id,username from users;
+----+----------+
| id | username |
+----+----------+
| 1 | root |
| 2 | peter |
+----+----------+
2 rows in set (0.00 sec)
mysql> select * from raspberrypi;
+--------+----------------------------------+--------+-----------+--------+----- -------+
| userid | apikey | sgroup | frequency | baseid | runn ing |
+--------+----------------------------------+--------+-----------+--------+----- -------+
| 1 | d92bd75a12b5bb2b567fd339320078d0 | 210 | 8 | 24 | 1351 360262 |
+--------+----------------------------------+--------+-----------+--------+-----
1 row in set (0.01 sec)
APIKEY above is same as root user in emoncms.
checked script was now updated version using sudo nano /var/www/emoncms/Modules/raspberrypi $ sudo nano raspberrypi_run.php - looks same.
I added second user peter to try something, I was not receiving input data before either.
Cheers
Peter
Re: emoncms onto RaspberryPI
ok from what you post, yser 'root' should be seeing inputs.
I am slowly running out of ideas what could be wrong, one more thing to try direct output from the rasperrypi_run.php:
can you please do the following:
cd /var/www/emoncms/Modules/raspberrypi/
php raspberrypi_run.php
let it run for a minute then copy/paste the output. You may get "already running", which will make the puzzle even more puzzling :)
I get this:
Re: emoncms onto RaspberryPI
Here you go
Thanks
Peter
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $ php raspberrypi_run.php
PHP Warning: fopen(): Unable to find the wrapper "dio.serial" - did you forget to enable it when you configured PHP? in /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php on line 54
PHP Warning: fopen(dio.serial:///dev/ttyAMA0): failed to open stream: No such file or directory in /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php on line 54
PHP Warning: fclose() expects parameter 1 to be resource,
boolean given in /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php on line 105
Re: emoncms onto RaspberryPI
Hi Martin,
Thanks a mil, learned loads and its now working thanks to your great effort, much appreciated.
Here's the printouts you requested which pointed to mistake I made.
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $ php raspberrypi_run.php
PHP Warning: fopen(): Unable to find the wrapper "dio.serial" - did you forget to enable it when you configured PHP? in /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php on line 54
PHP Warning: fopen(dio.serial:///dev/ttyAMA0): failed to open stream: No such file or directory in /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php on line 54
PHP Warning: fclose() expects parameter 1 to be resource,
boolean given in /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php on line 105
My mistake due to inexperience was in process: http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi
Step 3 $ sudo nano /etc/php5/cli/php.ini add extension=dio.so to file in the beginning of the ;Dynamic Extensions; section on line 843 [Ctrl+X] then [y] then [Enter] to save and exit
I placed code as described but never removed ";" obvious to a programmer but I thought about it and decided to leave ";" for some reason. ";" now removed and it's working now.
Peter
Re: emoncms onto RaspberryPI
gotcha :)
the PHP serial library isn't installed. Carefully follow this:
Re: emoncms onto RaspberryPI
I've been working through this again tonight and I cannot get the script to run - Message: The RFM12 to PI interface script is not running, you may need to configure cron
What I have done is reinstalled Modular emoncms & raspberrypi.
Added the line */1 * * * * root cd /var/www/emoncms/Modules/raspberrypi && php raspberrypi_run.php at the end of crontab
Minicom is showing nodes and data which looks ok.
I have set the RaspberryPI and emoncms to the same BaseID, frequency and group etc.
When I follow the above thread advice, when I get to the bit where I type mysql> select * from raspberrypi;, then the last box 'Running' displays NULL (everything else looks as it should).
Any idea's what I've missed/where I've gone worng?
Thanks
Dennis
Re: emoncms onto RaspberryPI
Hi Martin, Like I said in above post , when I removed the ; from start of code line 843 in php5/cli/php.ini, it started to work e.g. receiving input data from RF12 to emoncms.
Anyway I followed your instructions above and here is results.
See comments below:
Install serial PHP libraries
$ sudo apt-get install php-pear php5-dev
result
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-pear is already the newest version.
php5-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 55 not upgraded.
$ sudo pecl install channel://pecl.php.net/dio-0.0.6
result:
pecl/dio is already installed and is the same as the released version 0.0.6
install failed
Checkek below and already complete
$ sudo nano /etc/php5/cli/php.ini add extension=dio.so to file in the beginning of the ;Dynamic Extensions; section on line 843 [Ctrl+X] then [y] then [Enter] to save and exit
Restart apache $ sudo /etc/init.d/apache2 restart
result
[....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
. ok
Then checked script:
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $ php raspberrypi_run.php
Already running
Note that RF12 is still sending input data to emoncms.
Cheers
Peter
Re: emoncms onto RaspberryPI
Cheers
Peter
Re: emoncms onto RaspberryPI
Dennis, looks like the raspberrypi_run.php is not being run for some reason.
Lets try the same as we did for Peter: can you please do the following:
cd /var/www/emoncms/Modules/raspberrypi/
php raspberrypi_run.php
let it run for a minute then copy/paste the output.
Re: emoncms onto RaspberryPI
Thanks Martin
I ran the file and here is the result:
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $ php raspberrypi_run.php
SERIAL RX: 10 38 1 78 0 0 0 62 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 74 0
294,78,0,24126,1037,1731,2818,3512,3587,2800,3462,2706,74
SERIAL RX:> 16i
SERIAL RX: 10 40 1 76 0 0 0 57 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 73 0
296,76,0,24121,1037,1731,2818,3512,3587,2800,3462,2706,73
SERIAL RX:> 4b
SERIAL RX: 10 30 1 76 0 0 0 57 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 72 0
286,76,0,24121,1037,1731,2818,3512,3587,2800,3462,2706,72
SERIAL RX: 20 152 6 9 0
1688,9
SERIAL RX:> 210g
SERIAL RX: 10 29 1 82 0 0 0 29 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 72 0
285,82,0,24093,1037,1731,2818,3512,3587,2800,3462,2706,72
SERIAL RX: 10 31 1 79 0 0 0 33 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 72 0
287,79,0,24097,1037,1731,2818,3512,3587,2800,3462,2706,72
SERIAL RX: 10 35 1 83 0 0 0 45 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 72 0
291,83,0,24109,1037,1731,2818,3512,3587,2800,3462,2706,72
SERIAL RX: 10 33 1 79 0 0 0 17 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 73 0
289,79,0,24081,1037,1731,2818,3512,3587,2800,3462,2706,73
SERIAL RX: 10 34 1 79 0 0 0 26 94 13 4 195 6 2 11 184 13 3 14 240 10 134 13 146 10 72 0
290,79,0,24090,1037,1731,2818,3512,3587,2800,3462,2706,72
Dennis
Re: emoncms onto RaspberryPI
hmm it looks exactly as it should.
Can you edit the raspberrypi_run.php to add the text in bold. That will print out the POST string and maybe it will ring a bell:
cd /var/www/emoncms/Modules/raspberrypi/
sudo nano raspberrypi_run.php
dnfthen scroll to find this function:Add the text in bold, underlined.
Then run the raspberrypi_run.php to see what it outputs. Try the address that it outputs in your laptop browser, just replace 127.0.0.1 with whatever IP address your PI has and report what happens
Re: emoncms onto RaspberryPI
I'm on my mobile just now so will have to try this a bit later, but to ensure I do it right can I as what you mean by 'dnf' then scroll to find this function:?
On raspberry boot up I have seen reference to 127.0.0.1, but where exactly to I change this?
Sorry if this is simple questions but I've just recovered from hours of fixing my networking after setting up auto wlan login (not much fun!), so I just want to be sure....
thanks again
Dennis
Re: emoncms onto RaspberryPI
sorry the 'dnf' was unintentional, probably copy/paste thing, ignore it.
What I meant is that the raspberry will print out a message like this "127.0.0.1:80/emoncms/............" so in order to test that this works, you will have to replace the 127.0.0.1 with the IP of the Raspberry as 127.0.0.1 is a loopback IP address and you can't see that from another computer. The idea was to simulate a data post.
No problem just to let me know what the script outputs, we will try figure it out and you don't have tow worry about the 127.0.0.1
I very much wanted to release my SD card image to make it easier for all, but I am having one heck of a time to save it, I get some weird errors
Re: emoncms onto RaspberryPI
I've added that line and below is what is on screen:
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $ php raspberrypi_run.php
SERIAL RX:> 16i
SERIAL RX:> 4b
SERIAL RX:> 210g
SERIAL RX: 10 50 2 0 0 0 0 138 93 219 2 108 7 196 10 28 13 209 12 29 17 87 25 171 11 8 8 0
562,0,0,23946,731,1900,2756,3356,3281,4381,6487,2987,88
127.0.0.1:80/emoncms/input/post?apikey=6001ab5423cf985b5f1e3d151d904b08&node=10&csv=56 2,0,0,23946,731,1900,2756,3356,3281,4381,6487,2987,88
SERIAL RX: 10 71 11 0 0 0 0 182 92 219 2 108 7 196 10 28 13 209 12 29 17 87 25 171 11 93 0
2887,0,0,23734,731,1900,2756,3356,3281,4381,6487,2987,93
127.0.0.1:80/emoncms/input/post?apikey=6001ab5423cf985b5f1e3d151d904b08&node=10&csv=2887,0,0,23734,731,1900,2756,3356,3281,4381,6487,2987,93
SERIAL RX: 10 3 11 0 0 0 0 161 92 219 2 108 7 196 10 28 13 209 12 29 17 87 25 171 11 95 0
2819,0,0,23713,731,1900,2756,3356,3281,4381,6487,2987,95
127.0.0.1:80/emoncms/input/post?apikey=6001ab5423cf985b5f1e3d151d904b08&node=10&csv=2819,0,0,23713,731,1900,2756,3356,3281,4381,6487,2987,95
SERIAL RX: 10 189 10 0 0 0 0 7 93 219 2 114 7 196 10 28 13 203 12 60 17 131 25 184 11 94 0
2749,0,0,23815,731,1906,2756,3356,3275,4412,6531,3000,94
127.0.0.1:80/emoncms/input/post?apikey=6001ab5423cf985b5f1e3d151d904b08&node=10&csv=2749,0,0,23815,731,1906,2756,3356,3275,4412,6531,3000,94
Hopefully this will give some tell tale info?
Thanks
Dennis
Re: emoncms onto RaspberryPI
Everything now appears to be working, and the usual typo was to blame.
Up until a few minutes ago I was manually typing everything into the raspberrypi via Putty, but I've just figured how to copy/paste (simple, but true...).
I had missed several spaces in the line - */1 * * * * root cd /var/www/emoncms/Modules/raspberrypi && php raspberrypi_run.php
Once this was corrected, all is now working correctly.
I'm sorry for your troubles, and thank you very much once again for helping me.
Dennis
Re: emoncms onto RaspberryPI
Now when I'm trying to setup feeds from the inputs I only have an option to select the process, and I have no options for the argument or actions. The attached screenshot should explain.
I'm sure it'll probably be something simple, but I really cannot figure it. Any idea's.
EDIT: Figured it out - it's different from the online emoncms as you need to setup inputs with http://IPADDRESS/emoncms/input/process/add?inputid=1&type=1&arg=-1&arg2=power.
Thanks
Re: emoncms onto RaspberryPI
Hi, Dispite getting RPi working above with the help of Martin, I decided to begin fresh install equipped with my new gained knowledge. Followed Documentation for rm12pi http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi and using Martin Harizanov's RFM12B module I got my Raspberry pi working with two modules (emontx and emonglcd).
Great work guys.
Cheers
Peter
Re: emoncms onto RaspberryPI
Hi, Getting some very unusual behavior on inputs. I've started getting input data for many different nodes with node1_x, nodes2_x and CSV. I have attached PDF. minicom -b 9600 -o -D /dev/ttyAMA0 seems very slow and doesn't reflect inputs received as attached.
Cheers
Peter
Re: emoncms onto RaspberryPI
Yes, I noticed that myself. It happens when the PHP tryis to interpret the help messages that are shown then the RFM2Pi board starts up.
Here is a fix, just look up that section in the code in raspberrypi_run.php and replace:
if ($data[0]!=">")
{
$values = explode(' ',$data);
if ($values && is_numeric($values[1]))
{
$msubs = "";
for($i=2; $i<(count($values)-1); $i+=2){
if ($i>2) $msubs .= ",";
$msubs .= $values[$i] + $values[$i+1]*256;
}
echo $msubs."\n";
$url = "/emoncms/input/post?apikey=".$apikey."&node=".$values[1]."&csv=".$msubs;
getcontent("localhost",80,$url);
}
}
Then remove the 'dirty' inputs by deleting them in the INPUTS tab.
Glyn, Trystan: can you also fix this on Github?
Re: emoncms onto RaspberryPI
Ok, I've broke it!
As I was having similar problems to above then I updated the raspberrypi_run.php but now nothing works again. I've tried working through the checks as above and it will not run php raspberrypi_run.php. It displays:
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $ php raspberrypi_run.php
PHP Parse error: syntax error, unexpected end of file in /var/www/emoncms/Modules/raspberrypi/raspberrypi_run.php on line 133
Below is a copy/paste of the section in raspberrypi_run.php, incase I have done something silly:
{
echo "SERIAL RX:".$data;
if ($data[0]!=">")
{
$values = explode(' ',$data);
if ($values && is_numeric($values[1]))
{
$msubs = "";
for($i=2; $i<(count($values)-1); $i+=2){
if ($i>2) $msubs .= ",";
$msubs .= $values[$i] + $values[$i+1]*256;
}
echo $msubs."\n";
$url = "/emoncms/input/post?apikey=".$apikey."&node=".$values[1]."&csv=".$msubs;
getcontent("localhost",80,$url);
}
}
}
}
fclose($f);
Any idea's?
Also when something is updated in github/emoncms, how do we do an update on the RaspberryPI?
Dennis
Re: emoncms onto RaspberryPI
Unbalanced parentheses! Either one too many closing, or a missing opening, but I don't know which or where.
Re: emoncms onto RaspberryPI
Hello all, thanks Martin, just uploaded your fix.
Dennis I think you might one additional } before fclose($f).
PS: wrote a bit of info on the new modular emoncms version in the blog today which hopefully gives a bit more context and detail on the changes.
Re: emoncms onto RaspberryPI
Thanks for that
I manually copy/pasted the updated git changes and it now works again. When I figures how to 'git pull' I got the below:
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $ git pull
Updating 28dcdc3..2937e12
error: Your local changes to the following files would be overwritten by merge:
raspberrypi_run.php
Please, commit your changes or stash them before you can merge.
Aborting
pi@raspberrypi /var/www/emoncms/Modules/raspberrypi $
I assume this was because I had done a manual update, but is there an easy way to get it back able to update via git pull?
Many thanks again to all who have helped me.
Dennis