Resolved - EmonGLCD time not received

Hi,

My EmonGLCD does not receive time from NanodeRF it does send the temperature.
Watts are also being received, I used the latest Jeelibs for compiling.
Ideas as where this problem could be from?

Best regards,

Johan Addink

Please be gentle I am a programming noob

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

The time comes from the server that is running emoncms. Is your NanodeRF receiving the time? Every minute, the NanodeRF sends a request and the server responds with "t13,05,39" (the time in hh,mm,ss). It prints this to the Serial Monitor. Is that happening?

If it is, have you got the Node ID of the NanodeRF set correctly in the emonGLCD code? If that is wrong, the GLCD will be ignoring the time message.
 

SUBjohan's picture

Re: Resolved - EmonGLCD time not received

Node ID of the NanodeRF was not set correct, it now works perfect.

Thank you very much for your help!

Greetz Johan

canary50's picture

Re: Resolved - EmonGLCD time not received

I think I have the same problem, could you expand on this please ? What should the Node ID be ?

thanks

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

As I wrote above, a Node ID is set in the NanodeRF. This is, if you like, its identity - it identifies where the message came from. You must specify in the receiver which messages to receive by specifying where they came from. Therefore, you must set the Node ID of the NanodeRF correctly in the emonGLCD, otherwise the GLCD will be ignoring the time message.

canary50's picture

Re: Resolved - EmonGLCD time not received

I know its me being slow ...

in the NanodeRF multimode sketch we have these lines

#define MYNODE 15           
#define freq RF12_433MHZ     // frequency
#define group 210            // network group

in the GLCD solar PV sketch we have these lines

#define MYNODE 20            // Should be unique on network, node ID 30 reserved for base station
#define freq RF12_433MHZ    
#define group 210            // network group, must be same as emonTx and emonBase

and in the emontx

#define freq RF12_433MHZ

#const int nodeID = 10;                        // emonTx RFM12B node ID
#const int networkGroup = 210;            

 

I have tried changing the nanode sketch to read MYNODE 30 but no difference.

Have I totally got the wrong end of the stick  ?

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

In a word - yes!

The Node ID's you're trying to match are the Nanode's MYNODE 15 and where it is handled by the GLCD in the loop():

      if (node_id == 15)
      {
        RTC.adjust(DateTime(2012, 1, 1, rf12_data[1], rf12_data[2], rf12_data[3]));
        last_emonbase = millis();
      }

The first line matches the Nanode's ID so the branch will be executed and the time set. If that's what you have in the GLCD, the problem is somewhere else - or it's out of range.

 

 

 

canary50's picture

Re: Resolved - EmonGLCD time not received

OK, thanks for the pointer, that all matches ......

I'm guessing I'm doing something wrong with IP addresses or emoncms subdirectory locations ?

I have emoncms setup at http://localhost the database name is emoncms-master

Serial monitor output is

[webClient]
DHCP status: 1
IP:  192.168.0.11
GW:  192.168.0.1
DNS: 8.8.8.8
DNS status: 1
SRV: 213.138.101.177
Data sent: /emoncms-master/api/post.json?apikey=###&json={rf_fail:1}
Time request sent
Data sent: /emoncms-master/api/post.json?apikey=###&node=20&csv=1650
Data sent: /emoncms-master/api/post.json?apikey=###&node=10&csv=170,31,2,23994
Data sent: /emoncms-master/api/post.json?apikey=###&node=10&csv=171,30,1,24006
Data sent: /emoncms-master/api/post.json?apikey=###&node=20&csv=1650
Data sent: /emoncms-master/api/post.json?apikey=###&node=10&csv=170,24,0,24014
Data sent: /emoncms-master/api/post.json?apikey=###&node=20&csv=1650
Data sent: /emoncms-master/api/post.json?apikey=###&node=10&csv=170,30,2,24045
Data sent: /emoncms-master/api/post.json?apikey=###&node=10&csv=168,33,2,24015
Data sent: /emoncms-master/api/post.json?apikey=###&node=20&csv=1650
Data sent: /emoncms-master/api/post.json?apikey=###&node=10&csv=170,35,1,23975

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

There doesn't appear to be a time coming back from your server. If you look at the Nanode sketch, the callback function should print "Time: t15,49,20" or something like that. It isn't there. You need to check that your server is behaving. (A quick test: change over to emoncms.org and see if the time comes in OK.)

Or maybe even send the time request by hand from your browser?

emoncms.org/time/local.json?apikey=********************

works for emoncms.org, try something like

http://localhost/********/time/local.json?apikey=********************

canary50's picture

Re: Resolved - EmonGLCD time not received

sending the time request by hand from the browser works 

http://localhost/********/time/local.json?apikey=********************

but I only get a blank screen with

http://emoncms.org/time/local.json?apikey=********************

serial monitor output is still

DNS status: 0
Data sent: /emoncms-master/api/post.json?apikey=######&json={rf_fail:1}
Time request sent
DNS status: 0

and status led on nanode is red.

help again please !

 

 

 

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

Yikes! I'm thick!

I've just realised: Why is this

Serial monitor output is

[webClient]
DHCP status: 1
IP:  192.168.0.11
GW:  192.168.0.1
DNS: 8.8.8.8
DNS status: 1
SRV: 213.138.101.177   <=====  THE EMONCMS.ORG server address!  It should be a 192.168....

So it looks like you're sending a request to emoncms.org with the APIkey for your private copy! You're a spammer, no wonder it's ignoring you.

Unless your router does DNS, it's probably safer to use the local IP address 192.168...... of your localhost (you need to check what that is - your router or Apache should tell you) and put

char website[] PROGMEM = "";

and basedir is "emoncms-master"
 

canary50's picture

Re: Resolved - EmonGLCD time not received

confusion still reigns ... sorry !

The IP address of http://localhost is a 127.0... number, are you suggesting it should be a 192.168... number ?

and should hisip be set to true or false ? 

// change to true if you would like the sketch to use hisip
boolean use_hisip = false;

I seem to have tried everything but I am still consistently getting a "rf fail" message,

Data sent: /emoncms-master/api/post.json?apikey=####&json={rf_fail:1}.

but I do seem to be getting data transmitted from emontx & emonglcd

Data sent: /emoncms-master/api/post.json?apikey=####&node=10&csv=-216,460,1,23858
Data sent: /emoncms-master/api/post.json?apikey=####&node=20&csv=1625

I really appreciate the help you are giving !

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

My problem is I haven't got your setup! What is certain is that the IP address that DNS is coming back with, 213.138.101.177, is wrong. And a 127.0...   IP address is local within your computer, not within your LAN. What have you got in the top of the Nanode sketch for the server settings etc?

For the old Nanode sketches before they were cleaned up and rationalised, for a local Wampserver I had:

#define PROGURL ""            // Enter the emonCMS server domain name here inside the quotes. Else put an empty string if using a static IP address
                            // e.g.  #define PROGURL "vis.openenergymonitor.org"
#define PROG_IP  {10,0,0,5}    // Enter the emonCMS server static IP address here (COMMA-SEPARATED), else comment out the whole of this line

where the 10.0.... address is allocated by my (old) router, which corresponds to your 192.168... address range.

This was a long time ago and I didn't have success then going through DNS to get the IP address. Can you not interrogate you router and see what address it has allocated to the server? - I don't see a problem because you can probably tell the router to keep the same IP address for the server anyway, so then you would never need DNS to resolve it.
 

canary50's picture

Re: Resolved - EmonGLCD time not received

Very aware I'm taking up a lot of time on this ......

I've tried interrogating my Netgear router and using the DNS lookup facility it comes back with  213.138.101.177. I've tried whois and that comes back with the same IP address. If I Ping it, it fails.

If I type it (213.138.101.177.) into the browser bar I get to the Emoncms v3 beta website with the following message

Hello! This is the old entry point for the hosted openenergymonitor emoncms. The new entry point is emoncms.org, if you have an account on vis.openenergymonitor.org all your data can be accessed via emoncms.org just log in as usual.

You asked about server settings ....

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x42,0x31,0x42,0x21,0x30,0x31 };

// 1) Set this to the domain name of your hosted emoncms - leave blank if posting to IP address
char website[] PROGMEM = "emoncms.org";

// or if your posting to a static IP server:
static byte hisip[] = { 192,168,1,10 };

// change to true if you would like the sketch to use hisip
boolean use_hisip = false; 

// 2) If your emoncms install is in a subdirectory add details here i.e "/emoncms3"
char basedir[] = "/emoncms-master";

// 3) Set to your account write apikey
char apikey[] = "###";

//IP address of remote sever, only needed when posting to a server that has not got a dns domain name (staticIP e.g local server)
byte Ethernet::buffer[700];
static uint32_t timer;

 

 

 

 

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

"I've tried interrogating my Netgear router ... "  Well, if you're asking DNS what the IP address of emoncms.org is, it will give you that address. It's a bit like asking the way to Sainsbury's when you want to go to the Co-Op!
(When you get time, it might be a good idea to read up on what DNS does.)

Here is your problem:

// 1) Set this to the domain name of your hosted emoncms - leave blank if posting to IP address
char website[] PROGMEM = "emoncms.org";

That is the website emoncms.org hosted by OEM, and use_hisip is false so it is going there. What you should be looking for is the IP address of the machine that is your local server that your local program emoncms is running on.

I don't have your set-up, however 192,168,1,10 looks as if it could be correct, so you need to set use_hisip to true and tell your router to always use that IP for the server - that's what a static IP address means (the machine is identified to the router by its MAC). Your APIkey of course needs to the one you see when you create an account and log in to emoncms on your local server.

When you do that, the Nanode should report something like:

[webClient]
DHCP status: 1
IP:  192.168.0.11
GW:  192.168.0.1
DNS: 8.8.8.8       <===== (not sure it will report these - you're not interested anyway
DNS status: 1     <===== as you're not using DNS)
SRV: 192.168.1.10

and with a bit of luck, values might appear in emoncms.

It's too late now - if I get time tomorrow afternoon, I'll set up a NanodeRF to work into my Wampserver and check that all that is correct.

TrystanLea's picture

Re: Resolved - EmonGLCD time not received

Not sure if this has been covered but are you using the static IP Nanode example to post to you local server?

https://github.com/openenergymonitor/NanodeRF/tree/master/NanodeRF_multi...

you will need to change the lines:

static byte hisip[] = { 213,138,101,177}; 

static byte myip[] = { 192,168,1,200 };        //NanodeRF static IP address - not needed if using DHCP
static byte gwip[] = { 192,168,1,254 };        // gateway ip address - not needed if using DHCP

to which from the posts above are the details of your local network

static byte hisip[] = { 192,168,1,10};
static byte myip[] = { 192,168,0,11 };        //NanodeRF static IP address - not needed if using DHCP
static byte gwip[] = { 192,168,0,1 };        // gateway ip address - not needed if using DHCP

 

 

canary50's picture

Re: Resolved - EmonGLCD time not received

thanks, been using multinode so switched over to multinode static, changed lines as suggested but stil no joy.

Serial monitor output

[webClient]
IP:  192.168.0.11
Gateway:  192.168.0.1
Server: 192.168.1.10
Data sent: emoncms-master/api/post.json?apikey=###&json={rf_fail:1}

TrystanLea's picture

Re: Resolved - EmonGLCD time not received

Does the line emoncms-master/api/post.json?apikey=###&json={rf_fail:1} work if you place it in your web browser manually?

Does it return an ok?

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

I've just downloaded a fresh copy of emoncms and re-installed on my Wampserver, and with that and these settings at the top of an otherwise "as downloaded" copy of NanodeRF_multinode_static_IP.ino it's all working for me.

static byte mymac[] = { 0x42,0x31,0x42,0x21,0x30,0x31 };
char website[] PROGMEM = "";
boolean use_hisip = true; 
static byte hisip[] = { 192,168,1,64};    // IP of Machine on which Wampserver is running
static server IP (hisip)
boolean use_staticIP = true; 
static byte myip[] = { 192,168,1,66 };    //NanodeRF static IP address - not needed if using DHCP
static byte gwip[] = { 192,168,1,254 };   // gateway ip address - not needed if using DHCP
char basedir[] = "/emoncms-dev";

(I had been getting no response out of Wampserver, despite the requests successfully reaching index.php).

Have you looked at your Apache access log and error log?  In the access log, if Apache is receiving the requests (i.e. they are reaching your server) you should see lines like:

192.168.1.66 - - [05/Apr/2013:01:43:16 +0100] "GET /emoncms-dev/input/post?
apikey=deadbeef12345678900987654321feeda&node=10&csv=2,39,-1,39,0,37 HTTP/1.0" 200 2

Of course, there shouldn't be anything in the error log. If there is anything relevant in there, it might be a good clue.
 

 

canary50's picture

Re: Resolved - EmonGLCD time not received

OK, I'll try all of that and let you know. Thanks again for the guidance.

IanL's picture

Re: Resolved - EmonGLCD time not received

At the risk of confusing the thread, I need to go back to the starting discussion.  (Apologies if this is the wrong way to approach a thread that has moved on from the original subject.)

My problem is described accurately by the original poster, I cannot get time on the GLCD.

Robert's first post in this thread asks:

"The time comes from the server that is running emoncms. Is your NanodeRF receiving the time? Every minute, the NanodeRF sends a request and the server responds with "t13,05,39" (the time in hh,mm,ss). It prints this to the Serial Monitor. Is that happening?"

In my case, the answer is no.  The output from serial monitor is:

NanodeRF_multinode_bulksend
My IP: 192.168.1.78
GW IP: 192.168.1.254
DNS IP: 192.168.1.254
Server: 213.138.101.177
NO DATA
SENDING: 5 [[0,10,371,-10,0,24055],[0,20,2400],[5,10,368,-9,2,24006],[10,20,2400],[11,10,364,-4,3,23961]]ok

...etc...  But I can get the "t19,08,00" response if I enter the time request by hand, as kindly described above.  Data are getting to emoncms.org and I can graph these on Dashboard.  It's the NO DATA that is foxing me.

Today I've reloaded all the latest relevant sketches I can find and made minimal changes to them, to try and nail the problem.  The Nanode changes are:

#define MYNODE 15           
#define freq RF12_868MHZ     // frequency
#define group 210            // network group
- and the apikey, of course.

The NanodeRF node ID in the GLCD code is no doubt another problem that I shall have to attack later, if I get this sorted.  I'll be grateful for any thoughts.

Ian.

Robert Wall's picture

Re: Resolved - EmonGLCD time not received

That sketch has no code in it to receive and forward the time that comes back from emoncms.

You should have more success with NanodeRF_multinode.

[Edit] Having looked harder at the sketch, it would appear that this is because of memory issues.

IanL's picture

Re: Resolved - EmonGLCD time not received

Robert: thank you, that had been causing me much headscratching.  The time is now set and all is well.

Sorry Trystan, I'm not going to be able to reduce the load on your servers.  The lack of available memory appears to be a major frustration in many threads here.

Comment viewing options

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