rfm12pi feeds inactive after events module install

Hi all,

We've installed the event and report modules into emoncms and ran the database updates. Now the rfmi2pi feeds are no longer updating.

sudo apt-get update
sudo apt-get install php5-mcrypt php5-curl
cd /var/www/emoncms/Modules
sudo git clone https://github.com/emoncms/event.git

The file /var/log/rfmi12pi.log has the following error:

Call to a member function fetch_object() on a non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php

It looks like it can't set up the access to the database. We've connected using mysqld and the databases are all there and running.

I've also tried the following to fix it with no luck:

sudo service rfm12piphp stop
cd /var/www/emoncms
git pull
cd /var/www/emoncms/Modules
git pull
cd /var/www/emoncms/Modules/raspberrypi
git pull
sudo cp /var/www/emoncms/Modules/raspberrypi/rfm12piphp /etc/init.d/
sudo chmod 755 /etc/init.d/rfm12piphp
sudo update-rc.d rfm12piphp defaults
sudo service rfm12piphp start
sudo reboot

Anyone got any suggestions?

Cheers, Iain

Iain's picture

Re: rfm12pi feeds inactive after events module install

Okay, so we spent a while debugging it.

It doesn't appear to be a database issue.

I uncommented the line raspberry_run.php line 135 which is:

echo $remotedata."\n";

The $remotedata variable was empty except for the JSON []

The frequency was also wrong in the output, it said 433 MHz but ours was set to 868. 

We noticed that the light on the rfm12pi board was lit constantly and not blinking.

We shutdown the pi and removed and reseated the rfm board. Now it doesn't light up at all.

Anyone got any ideas?

Cheers, Iain

 

Iain's picture

Re: rfm12pi feeds inactive after events module install

I've attached the log output from a test run with the python gateway:

2013-12-08 15:34:12,893 DEBUG Opening serial port: /dev/ttyAMA0
2013-12-08 15:34:13,019 INFO Setting RFM2Pi | baseid: 15
2013-12-08 15:34:14,025 INFO Setting RFM2Pi | frequency: 8
2013-12-08 15:34:15,029 INFO Setting RFM2Pi | sgroup: 210
2013-12-08 15:34:16,238 INFO Serial RX:

2013-12-08 15:34:16,241 WARNING Misformed RX frame: ['\x00']
2013-12-08 15:34:16,449 INFO Serial RX: Available commands:
2013-12-08 15:34:16,452 WARNING Misformed RX frame: ['Available', 'commands:']
2013-12-08 15:34:16,669 INFO Serial RX:   123 x      - Toggle configuration change protection, 1=Unlocked
2013-12-08 15:34:16,672 WARNING Misformed RX frame: ['123', 'x', '', '', '', '', '', '-', 'Toggle', 'configuration', 'change', 'protection,', '1=Unlocked']
2013-12-08 15:34:16,889 INFO Serial RX:   <nn> i     - set node ID (standard node ids are 1..26)
2013-12-08 15:34:16,893 WARNING Misformed RX frame: ['<nn>', 'i', '', '', '', '', '-', 'set', 'node', 'ID', '(standard', 'node', 'ids', 'are', '1..26)']
2013-12-08 15:34:17,308 INFO Serial RX:   <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)
2013-12-08 15:34:17,311 WARNING Misformed RX frame: ['<n>', 'b', '', '', '', '', '', '-', 'set', 'MHz', 'band', '(4', '=', '433,', '8', '=', '868,', '9', '=', '915)']
2013-12-08 15:34:17,528 INFO Serial RX:   <nnn> g    - set network group (RFM12 only allows 212, 0 = any)
2013-12-08 15:34:17,531 WARNING Misformed RX frame: ['<nnn>', 'g', '', '', '', '-', 'set', 'network', 'group', '(RFM12', 'only', 'allows', '212,', '0', '=', 'any)']
2013-12-08 15:34:17,745 INFO Serial RX:   <n> c      - set collect mode (advanced, normally 0)
2013-12-08 15:34:17,748 WARNING Misformed RX frame: ['<n>', 'c', '', '', '', '', '', '-', 'set', 'collect', 'mode', '(advanced,', 'normally', '0)']
2013-12-08 15:34:17,963 INFO Serial RX:   ...,<nn> a - send data packet to node <nn>, with ack
2013-12-08 15:34:17,966 WARNING Misformed RX frame: ['...,<nn>', 'a', '-', 'send', 'data', 'packet', 'to', 'node', '<nn>,', 'with', 'ack']
2013-12-08 15:34:18,477 INFO Serial RX:   ...,<nn> s - send data packet to node <nn>, no ack
2013-12-08 15:34:18,480 WARNING Misformed RX frame: ['...,<nn>', 's', '-', 'send', 'data', 'packet', 'to', 'node', '<nn>,', 'no', 'ack']
2013-12-08 15:34:18,694 INFO Serial RX:   <n> l      - turn activity LED on DIG8 on or off
2013-12-08 15:34:18,697 WARNING Misformed RX frame: ['<n>', 'l', '', '', '', '', '', '-', 'turn', 'activity', 'LED', 'on', 'DIG8', 'on', 'or', 'off']
2013-12-08 15:34:18,906 INFO Serial RX: Current configuration:
2013-12-08 15:34:18,908 WARNING Misformed RX frame: ['Current', 'configuration:']
2013-12-08 15:34:19,118 INFO Serial RX: 65 i1* g12 @ 433 MHz  Lock: 1
2013-12-08 15:34:19,121 WARNING Misformed RX frame: ['65', 'i1*', 'g12', '@', '433', 'MHz', '', 'Lock:', '1']
2013-12-08 15:34:19,575 INFO Serial RX:
2013-12-08 15:34:19,578 WARNING Misformed RX frame: ['\x01']

It appears to hang after the x01 frame warning.

TrystanLea's picture

Re: rfm12pi feeds inactive after events module install

Hello Iain, is your emoncms install being hosted on the raspberrypi? the empty $remotedata would ok if this was the case.

It would be interesting to know what line the first error you reported above originated from:

"The file /var/log/rfmi12pi.log has the following error:

    Call to a member function fetch_object() on a non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php"

Iain's picture

Re: rfm12pi feeds inactive after events module install

Hi Trystan,

The emoncms install is indeed on the raspberrypi.

The line that reported it was : Line 29

$row = $result->fetch_object();

The result object is a mysql query and the fact that we'd just updated the db schema with the /admin/view made us think it might be an issue in connecting to the database.

The events module required:

sudo apt-get update

sudo apt-get install php5-mcrypt php5-curl

Do you have any thoughts?

EDIT: I should add that /emoncms/raspberrypi/get.json does seem to return the settings okay.

Thanks, Iain

doddz3h's picture

Re: rfm12pi feeds inactive after events module install

Just thought I'd pipe in to update anyone that might experience a similar thing in the future.

We managed to fix this eventually, more rather than pot luck than anything.

I went through the git repos for the modules and emon doing pulls to update, noticing one failed with a index corruption error. I deleted the suspect folder and cloned it back down. Still nothing working at this stage.  Rebooting, reseating the module hadn't worked.

Then, the breakthrough came when I was in minicom and I removed and reseated the RFM2PI module. Previously minicom had been responding with weird data, generally being unresponsive but after reseating it now it seemed to respond as expected. Through that I was able to see that the config seemed wrong so I corrected that and data began printing in the console. It was some faffing around making sure it was on the right group (it was on the 0 for all setting) which eventually resulted in the data getting passed onto emoncms.

So with that in mind I would speculate that it was a corrupt git repo causing some havoc by having invalid settings getting applied to the RFM12 at startup. But still, very confused as to how this happened when we were meerly installing new modules.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.