Certain Feeds will not update.....

 I have a water/gas/electricity build( which I must put up here!). One emontx is for water, and the other does gas+electricity....

All the inputs are coming in fine, but for some reason; the water [mV and pulse count] won't propogate through to their respective feeds..

I reinstalled emoncms; I created a totally new database and started from the beginning and it's still happening. I've even created a new user.

I have noticed in my serial[ from the emonbase] that after a while it starts to flag the following error

Fatal error : call to a member function fetch_array() on a non-object in /var/emoncms3/I ; and that's all I get. I expect it's db.php in the 'Includes' dir though. I was getting this error initially upon logging in(Google Chrome), but by granting my emoncms3 user all privilages it sorted it. Always worried when I don't have a root cause though!

I'm using my own version of the following https://github.com/openenergymonitor/NanodeRF/blob/master/NanodeRF_singleCT_RTCrelay_GLCDtemp/NanodeRF_singleCT_RTCrelay_GLCDtemp.ino

[ must put it up on github, though since the inputs are being populated correctly, I'm assuming it's working]

Has anyone else had a feed that could be created, but didn't get updated even though the input was working fine?

thanks, Eamonn

seannation's picture

Re: Certain Feeds will not update.....

That looks like a PHP error, i.e. an error with the emoncms software.

The error message doesn't say which file it is coming from but it's probably from db.php which includes the fetch_array command. This command is executed every time there is a database query. Considering the error message complains about a non-object, this would suggest the database connection hasn't been started successfully.

First thing would be to make sure you've got the correct database settings in settings.php.

EnergyRnR's picture

Re: Certain Feeds will not update.....

 Sean,thanks for your input.

 I checked the settings file a while back, and it's correct. Also, other feeds are updating ok so that would confirm we can access the DB etc. There's something specific about the feed from the water emontx thats not working. It's writing the data correctly to the 'input' table, but even the simplest process of feeding it straight through to a feed isn't happening.

It's definately related to my emoncms installation, and I thought it might be file permissions issue in my ubuntu environment but that's not the case I think. I opened up file permissions fully to test this.

thanks again - enjoy the w/end - you know what I'll be doing :-)

Eamonn

EnergyRnR's picture

Re: Certain Feeds will not update.....

 And it's working now....  I wish I could say I fixed it. I did change the emonbase sketch though to clean up the Serial o/p... we'll see.

EnergyRnR's picture

Re: Certain Feeds will not update.....

 I'm convinced the root cause is with my emonbase sketch, but it'll have to wait till 2morrow :-) 

EnergyRnR's picture

Re: Certain Feeds will not update.....

Still not working ;

I'm taking inputs from 2 emontx's and can see the inputs update correctly.No matter what I do though, either my gas or water feeds will fail to update. Interesting that the electrical feed always works.When the feed fails I get the 'Fatal error: Call to a member function fetch_array() on a non-object in /var/www/emoncms3/I'

I've reinstalled latest emoncms3, created a new db, new user [ALL db priviliges], so I'm definately after breaking something....  

 

TrystanLea's picture

Re: Certain Feeds will not update.....

 Hello Eamonn, It is strange that it sometimes works and othertimes does not. what are your input/feed names? can you paste here the json string? It might be that your running to the end of the string buffer on the nanode?

EnergyRnR's picture

Re: Certain Feeds will not update.....

 Now that's a possibility....here's a sample of the serial output.

Fatal error: Call to a member function fet
Date: Thu, 16 Feb 2012 18:50:03 GMT
 
ok recieved
 
2(Watertx): Wtr-Vcc:3312, Wtr-pulse:7657Data for Display {rf_fail:0,Real:0.00,App:1379.41,V:227.92,I:0.00,PF:0.00,Pwr-Vcc:3312,Gas(W):6653.00,Pulse:20582,Wtr_mV:3312,Wtr_Pulse:7657}
GET /emoncms3/api/post.json?apikey=7dc7a502ce8cfd9b008a6acad90b0fc7&json={rf_fail:0,Real:0.00,App:1379.41,V:227.92,I:0.00,PF:0.00,Pwr-Vcc:3312,Gas(W):6653.00,Pulse:20582,Wtr_mV:3312,Wtr_Pulse:7657} HTTP/1.1
Host: 
Accept: text/html
Connection: close
 
must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=k8jl1bs1eh1kq7j7vl48t2eh66; path=/
Vary: Accept-Encoding
Content-Length: 5
Connection: close
Content-Type: text/html
 
 
 
 
ok
Date: Thu, 16 Feb 2012 18:50:07 GMT
 
ok recieved
ch_array() on a non-object in /var/www/emoncms3/I
ok recieved
 

TrystanLea's picture

Re: Certain Feeds will not update.....

Great, thanks, It looks like it should be within the buffer length, comes to 124 characters. The buffer length is 150 and is set on line 70: 

char buf[150];

You could try setting it to 200 to be safe.

It may also be worth stripping out the brakets in Gas(W) but thats probably not causing the problem.

TrystanLea's picture

Re: Certain Feeds will not update.....

Do you still get the error if you paste:

/emoncms3/api/post.json?apikey=7dc7a502ce8cfd9b008a6acad90b0fc7&json={rf_fail:0,Real:0.00,App:1379.41,V:227.92,I:0.00,PF:0.00,Pwr-Vcc:3312,Gas(W):6653.00,Pulse:20582,Wtr_mV:3312,Wtr_Pulse:7657}

manually into the address bar on your browser?

EnergyRnR's picture

Re: Certain Feeds will not update.....

 yeah; I had already increased the buffer length to 200 ; and I get the same error when I paste that string into the address bar; 

I was thinking though that all my inputs are updating correctly; This should exclude the possibility of there being a sketch/buffer lenger issue I think.

It seems to me like, I'm trying to INSERT into the table but there's nothing to fetch...

db_fetch_array() is returning nothing - so I'm seeing if I can figure out why the array would be empty : needles, haystacks :-)

 

EnergyRnR's picture

Re: Certain Feeds will not update.....

 works if I paste the following into the address bar though....which seems to just a restriction on the JSON string length - I just deleted some of the string.... Is there a limitation elsewhere in mysql?

http://localhost/emoncms3/api/post.json?apikey=7dc7a502ce8cfd9b008a6acad90b0fc7&json={rf_fail:0,PF:0.00,Pwr-Vcc:3312,Gas(W):6653.00,Pulse:20582,Wtr_mV:3312,Wtr_Pulse:7657}

TrystanLea's picture

Re: Certain Feeds will not update.....

Both strings work fine for me here when I put them in the address bar and I can add as many characters as I like it seems. I will let you know if I can think of something

EnergyRnR's picture

Re: Certain Feeds will not update.....

 no prob; I've definately found a way of breaking it :-) which would be useful if it were intended. Thanks for the ideas.

TrystanLea's picture

Re: Certain Feeds will not update.....

 Is it possible to get it working in the short term by changing the names?

EnergyRnR's picture

Re: Certain Feeds will not update.....

 

 no - I don't think so. 
Right now I had the following working (until I created the first feed-then the db_fetch_array() error popped up again)

/emoncms3/api/post.json?apikey=7dc7a502ce8cfd9b008a6acad90b0fc7&json={rf_fail:0,R:0.00,P:4694,W:9173}

 
So, I'm going to test that with my full set of variables as part of the JSON object. i.e. that I get no errors until I start creating feeds from the inputs.

 

TrystanLea's picture

Re: Certain Feeds will not update.....

When do the errors first start appering? is it at the feed creation stage? or input registering? 

 

Comment viewing options

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