My emonBase can't send to the emoncms for more than 10 minutes (sometimes just 2).
I am sure that the remote temperature module is working fine, because it send the data to my GLCD. What's wrong? I uploaded the sketch from github (nanodeRF_multinode) and just changed the frequency and the apikey...
Re: emonbase does not work longer than 10 minutes
With so little information, it is very difficult to diagnose a fault. I suggest you look for a fault on the network between your nanodeRF and emoncms.
Re: emonbase does not work longer than 10 minutes
Bramper, what do you see in the serial window of the nanodeRF? Might be worth trying a different mac address. Is it a new pre-assembled NanodeRF or the older kit version?
Re: emonbase does not work longer than 10 minutes
Its an older kit version.. In the serial window i see the mac address, ip address, ... And the data he is sending but after a little while it stops... Can I just change the mac address into something I choose or do it have to be a particular one?
Re: emonbase does not work longer than 10 minutes
You can change the mac address to be anything as long as its unique on your network.
Re: emonbase does not work longer than 10 minutes
Ok,
I changed the following line:
static byte mymac[] = { 0x42,0x31,0x42,0x21,0x30,0x31 };
into
static byte mymac[] = { 0x74,0x31,0x42,0x21,0x30,0x31 };
but still the smae problem: after 2 minutes it seems like the nanoder RF 'hangs', he don't sent data anymore
Re: emonbase does not work longer than 10 minutes
Are you using a local emoncms running on your own server on your own network, or emoncms.org?
Re: emonbase does not work longer than 10 minutes
I use emoncms.org
Re: emonbase does not work longer than 10 minutes
Does any data appear in emoncms in that first 2 minutes?, in the Arduino Serial window do you see the line "OK recieved" after an attempted send? If these no OK received, it will try 10 times before going through a system restart, Is that what your seeing?
This is how it should look like in the serial window:
[webClient]
DHCP status: 1
IP: 192.168.1.8
GW: 192.168.1.1
DNS: 8.8.8.8
DNS status: 1
SRV: 213.138.101.177
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&json={rf_fail:1}
Time request sent
Time: t16,43,36
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=28&csv=2347,114,6540,2200
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=10&csv=335,441,329,343,129,135,24778,3587,3618,2418,0
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=10&csv=337,442,325,339,129,135,24789,3587,3618,2418,0
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=10&csv=342,448,320,333,128,135,24784,3587,3618,2418,0
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=16&csv=1862
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=10&csv=344,447,321,335,129,135,24783,3587,3618,2418,0
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=18&csv=1768,3044
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=20&csv=1931
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=10&csv=345,451,324,338,128,134,24781,3587,3618,2418,0
OK recieved
Data sent: /api/post.json?apikey=7a3d3155d180af33b760a5e4d6552dc6&node=19&csv=1750,3362
OK recieved
Re: emonbase does not work longer than 10 minutes
This is what I get in the serial window:
[webClient]
DHCP status: 1
IP: 192.168.0.107
GW: 192.168.0.1
DNS: 8.8.8.8
DNS status: 1
SRV: 213.138.101.177
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&json={rf_fail:1}
Time request sent
Time: t06,50,30
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2518,2858
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2518,2858
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2518,2851
Time request sent
Time: t06,51,30
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2518,2858
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2518,2858
Time request sent
Time: t06,52,30
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2518,2858
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2525,2858
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2518,2858
Time request sent
Time: t06,53,30
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2525,2858
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2525,2851
It seems I miss the OK recieved line... what am I doing wrong?
For this I use only the NanodeRF (nanodeRD_multinode script) and the remote temperature module. The data the nanode sends are the termperature and the battery status...
Re: emonbase does not work longer than 10 minutes
No "OK recieved" means either the post is not getting through to emoncms.org, or the "ok" that it sends back is not getting back to you.
But the time is coming back from the server.
Are you using the read&write APIkey? Because the time is coming back correctly, and that needs only the read APIkey, it looks as if that is your problem.
Re: emonbase does not work longer than 10 minutes
Yes, I always used the read&write apikey... But when I look on the input and feeds page, the temperature changes...
Re: emonbase does not work longer than 10 minutes
The problem therefore is the ok that emoncms.org sends is not getting back to you. If you click the example on the Input API Help page that has the APIkey, do you see ok in the browser window?
Do you have a firewall that is possibly blocking the message?
Have you accidentally changed anything in decode_reply.ino? Or in my_callback(...) in the main sketch?
Re: emonbase does not work longer than 10 minutes
If I click the example on the Input API Help page, I see "ok" in the browser window
No firewall is used and nothing is changed in de script (exept the frequency and my api key number)
But the strange thing is, The value is changing on the feed page... just until the nanode "hangs"... So I got my data on the web, but nothing back... ('ok recieved')
Re: emonbase does not work longer than 10 minutes
This is worse than weird!
The same function, my_callback( ... ) receives the reply and the same function get_reply_data( ... ) processes it. It is after that when my_callback( ... ) detects "ok" (which it doesn't - apparently) or the time (which it does).
Can you insert a Serial.println(line_buf); immediately below
int lsize = get_reply_data(off);
and check what is actually being received?
(I will set up a similar system later today and post what I see.)
Re: emonbase does not work longer than 10 minutes
Ok, I added the line Serial.println(line_buf); immediatly below int lsize = get_replay_data(off);
and this is the result from the serial monitor window:
DHCP status: 1
IP: 192.168.0.205
GW: 192.168.0.1
DNS: 8.8.8.8
DNS status: 1
SRV: 213.138.101.177
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&json={rf_fail:1}
Time request sent
t12,53,22
Time: t12,53,22
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2700,2844
Fatal error: Call to a member function fetch_arr
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2700,2851
Fatal error: Call to a member function fetch_arr
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2700,2844
Fatal error: Call to a member function fetch_arr
Time request sent
t12,54,21
Time: t12,54,21
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2700,2851
Fatal error: Call to a member function fetch_arr
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2700,2851
Fatal error: Call to a member function fetch_arr
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2700,2844
Fatal error: Call to a member function fetch_arr
Time request sent
t12,55,21
Time: t12,55,21
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2700,2851
Fatal error: Call to a member function fetch_arr
Re: emonbase does not work longer than 10 minutes
I don't recognise that error message. That's surely a PHP error?
What I have done is put this
pBuf(Ethernet::buffer, 300);
in the same place, and at the end
void pBuf(byte *buf, int len)
{
for (int j = 0; j< len; j++)
{
if (*(buf+j) < 0x20 || *(buf+j) > 0x7e)
{
Serial.print('\\');
if (*(buf+j) < 0x10)
Serial.print("0");
Serial.print(*(buf+j),HEX);
}
else
Serial.print((char)*(buf+j));
}
Serial.print("\r\n");
}
That produces this output, which is the entire message (and more!) that the server returns. Printable characters are printed correctly, the rest are in the form \XX - two hexadecimal digits. It does not decode the header - only prints the first 300 characters as set in the call.
B1B!01\00\1DhJ\F3^\08\00E\80\00\FD\8A\B4@\008\06\B9\A1\D5\8Ae\B1\C0\A8\01A\00P\0B\A56+@\BD\00\00\13\86P\18<\00\AA\16\00\00HTTP/1.1 200 OK\0D\0ADate: Mon, 05 Aug 2013 16:22:17 GMT\0D\0AServer: Apache/2.2.17 (Ubuntu)\0D\0AX-Powered-By: PHP/5.3.5-1ubuntu7.11\0D\0AVary: Accept-Encoding\0D\0AContent-Length: 2\0D\0AConnection: close\0D\0AContent-Type: text/html\0D\0A\0D\0Aok\00,22,00\00\00\00\00c\82Sc5\01\03=\07\01B1B!01\0C\0AArdu
OK received
The ok you should be seeing is the one in here, not the one after the "200"
Content-Type: text/html\0D\0A\0D\0Aok\00
everything after is rubbish.
Re: emonbase does not work longer than 10 minutes
I don't understand, what do I have to do now to get the "OK recieved" so that everything is working??
Re: emonbase does not work longer than 10 minutes
I do not understand what could be preventing the "OK recieved" from appearing. I gave you pBuf( ) so that you could check the complete message that the server sends, and an example of the message that I see.
Re: emonbase does not work longer than 10 minutes
this appears in the serial monitor window:
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&json={rf_fail:1}
Time request sent
B1B!01\5;9q\A9\08\00E\00\01\04\8E?@\006\06\B9\03\D5\8Ae\B1\C0\A8\00\CD\00P\0BC\83\1Bx\0E\00\00\0DpP\189\08\C7\F4\00\00HTTP/1.1 200 OK\0D\0ADate: Mon, 05 Aug 2013 19:08:01 GMT\0D\0AServer: Apache/2.2.17 (Ubuntu)\0D\0AX-Powered-By: PHP/5.3.5-1ubuntu7.11\0D\0AVary: Accept-Encoding\0D\0AContent-Length: 9\0D\0AConnection: close\0D\0AContent-Type: text/html\0D\0A\0D\0At20,08,01\00\00\00\00c\82Sc5\01\056\04\C0\A8\00\013\04\00\00\0E\10:\04\00
Time: t20,08,01
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2781,2844
B1B!01\5;9q\A9\08\00E\00\01\83\CB\DC@\006\06z\E7\D5\8Ae\B1\C0\A8\00\CD\00P\0Bd\89\173\A9\00\00\10\84P\18<\00l&\00\00HTTP/1.1 200 OK\0D\0ADate: Mon, 05 Aug 2013 19:08:07 GMT\0D\0AServer: Apache/2.2.17 (Ubuntu)\0D\0AX-Powered-By: PHP/5.3.5-1ubuntu7.11\0D\0AVary: Accept-Encoding\0D\0AContent-Length: 134\0D\0AConnection: close\0D\0AContent-Type: text/html\0D\0A\0D\0A\0AFatal error: Call to a member fu
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2775,2837
B1B!01\5;9q\A9\08\00E\00\01\83\B4"@\006\06\92\A1\D5\8Ae\B1\C0\A8\00\CD\00P\0B\85\9B\F7\B4\B1\00\00\13\84P\18<\00\D3\1C\00\00HTTP/1.1 200 OK\0D\0ADate: Mon, 05 Aug 2013 19:08:27 GMT\0D\0AServer: Apache/2.2.17 (Ubuntu)\0D\0AX-Powered-By: PHP/5.3.5-1ubuntu7.11\0D\0AVary: Accept-Encoding\0D\0AContent-Length: 134\0D\0AConnection: close\0D\0AContent-Type: text/html\0D\0A\0D\0A\0AFatal error: Call to a member fu
Re: emonbase does not work longer than 10 minutes
There must be something wrong with the data that you are sending to emoncms. When you ask for the time, it replies (in bold)
Content-Type: text/html\0D\0A\0D\0At20,08,01\00
which is correct. When you send data, it replies
Content-Type: text/html\0D\0A\0D\0A\0AFatal error: Call to a member fu...
and from what you did earlier, we know that is "Fatal error: Call to a member function fetch_array( )"
But I do not understand because the numbers you see in emoncms is that data being accepted.
Re: emonbase does not work longer than 10 minutes
Wow fantastic bit of detective work! Thanks Bramper and Robert
Right so copying the call directly into the browser:
http://emoncms.org/api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e...
Gives:
Fatal error: Call to a member function fetch_array() on a non-object in /var/www/emoncms/Modules/input/process_model.php on line 461
Which is my fault, it was an error affecting the kwh_to_kwhd2 input process which is a little used process and probably why it had not come up before.. I have added a check which prevents the error from occuring so now the call:
http://emoncms.org/api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e...
returns "ok" as expected.
This should now mean the NanodeRF does not try and restart every 2 or so minutes, which should hopefully mean stable operation.
Re: emonbase does not work longer than 10 minutes
Digging a little deeper the error only occurs when the feed kwh_to_kwhd2 is trying to write to does not exist, which may mean you had deleted it, but that the input process for it remained. In time there will be better error checking and clean up for this in emoncms but for now I would delete that input process entry as its not doing anything useful.
Re: emonbase does not work longer than 10 minutes
all right, we are one step further... Now I can write 30 minutes to emoncms.org.. but that's it
these are the last lines from the serial monitor window:
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2162,2816
OK recieved
Time request sent
Time: t11,57,29
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2150,2816
OK recieved
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2131,2816
OK recieved
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2106,2808
OK recieved
Time request sent
Time: t11,58,29
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2087,2816
OK recieved
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2100,2808
OK recieved
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2118,2808
OK recieved
Time request sent
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2131,2816
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2106,2816
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2106,2816
Time request sent
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2125,2808
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2118,2808
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2125,2808
Time request sent
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2150,2808
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2150,2816
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2168,2808
Time request sent
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2193,2808
Data sent: /api/post.json?apikey=8421fda046bd07d32bf74d62f120c34e&node=12&csv=2162,2816
When I reset the NanodeRF, it goes again..for 30 minutes...
Re: emonbase does not work longer than 10 minutes
Hello Bramper, thats strange, how up to date are your libraries and NanodeRF code?
Re: emonbase does not work longer than 10 minutes
Problem found:
In the folder libraries there was JeeLib & JeeLib-master (and others too of course) and they had both e.g. JeeLib.h in it. I think there was an old and a new version... same with EtherCard. I removed both libraries and downloaded the latest ones..
now everything seems to work, the system is up and running for more than 2 hours now, this didn't happen before :-)
thanks for all the help!!