GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

I am running "Rock-solid RFM2Pi gateway solution" (http://harizanov.com/2013/08/rock-solid-rfm2pi-gateway-solution/) .. from the shop here http://shop.openenergymonitor.com/pre-loaded-raspberry-pi-gateway-4gb-sd...

Which seems to work extremely well.

The oemgateway.conf file contains the following, where sendtimeinterval is set to 60, but this *does not* appear to be doing the trick - the emonGLCD is not displaying the actual time. The Pi itself *is* OK and reports the time correctly.

# This listener manages the RFM2Pi module
[[RFM2Pi]]
    type = OemGatewayRFM2PiListener
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
    [[[runtime_settings]]]
        sgroup = 210
        frequency = 4
        baseid = 19
        sendtimeinterval = 60

Anyone have any idea what might not be working ?

Thanks

Jérôme's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

I believe it should work.

Things you can do:

- Activate logging in the gateway (see the doc on emoncms.org) and see what you get there. You may even modify python code to add prints.

- Instrument emonGLCD to see what is received and understand why it goes wrong.

Is it not just a matter of radio transmission ?

If anything is sent, it should be correctly formatted . There was an issue but it was corrected in september :

https://github.com/Jerome-github/oem_gateway/commit/43eb3c6d51242c9c6795...

If the image still contains this bug, it should be updated.

Can you please check in the code and tell us ? You should see this

self._ser.write("00,%02d,%02d,00,s" % (now.hour, now.minute))

and not

self._ser.write("%02d,00,%02d,00,s" % (now.hour, now.minute))
patmolloy's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

Hi,

Thanks for the help.

I have the gateway in DEBUG mode (see below). Have also verified that the code in oemgatewaylistener.py is correct .. it's the former of the two versions above.

I must admit to not being 100% sure of the dataflow here. What is talking to what to get the time to the GLCD -- the gateway transmitting to the GLCD ?

I can see that all of the nodes seem to be active in that data is being received by the gateway from all three and then transmitted to emoncms.org  .. 20 is the GLCD, 19 is an emonTH and 10 is an emonTX V3.

However, I see no debug messages relating to time (except the time interval  ->>> 2014-01-09 12:39:36,160 INFO Setting send time interval to 60) and no evidence of log/debug traffic from the gateway to the GLCD.

Sorry, am a bit new to all of this. Baby steps !

2014-01-09 12:39:36,138 INFO Logging level set to DEBUG
2014-01-09 12:39:36,141 INFO Opening gateway...
2014-01-09 12:39:36,143 INFO Creating buffer emoncms_local
2014-01-09 12:39:36,147 INFO Creating buffer emoncms_remote
2014-01-09 12:39:36,152 INFO Creating listener RFM2Pi
2014-01-09 12:39:36,156 DEBUG Opening serial port: /dev/ttyAMA0
2014-01-09 12:39:36,160 INFO Setting send time interval to 60
2014-01-09 12:39:36,163 INFO Setting RFM2Pi | frequency: 4
2014-01-09 12:39:37,167 INFO Setting RFM2Pi | sgroup: 210
2014-01-09 12:39:38,171 INFO Setting RFM2Pi | baseid: 19
2014-01-09 12:39:39,175 INFO Creating listener Socket
2014-01-09 12:39:39,178 DEBUG Opening socket on port 50011
2014-01-09 12:39:39,204 DEBUG Broadcasting time: 12:39
2014-01-09 12:39:39,208 INFO Serial RX: > 4b
2014-01-09 12:39:39,412 INFO Serial RX:
2014-01-09 12:39:39,415 WARNING Misformed RX frame: ['\x01']
2014-01-09 12:39:39,620 INFO Serial RX: > 210g
2014-01-09 12:39:39,825 INFO Serial RX:
2014-01-09 12:39:39,827 WARNING Misformed RX frame: ['\x01']
2014-01-09 12:39:40,032 INFO Serial RX: > 19i
2014-01-09 12:39:40,257 INFO Serial RX:
2014-01-09 12:39:40,260 WARNING Misformed RX frame: ['\x01']
2014-01-09 12:39:40,471 INFO Serial RX:  10 206 5 169 3 0 0 0 0 123 94 9 1
2014-01-09 12:39:40,474 DEBUG Node: 10
2014-01-09 12:39:40,477 DEBUG Values: [1486, 937, 0, 0, 24187, 265]
2014-01-09 12:39:40,480 DEBUG Server emoncms.org -> send data: [10, 1486, 937, 0, 0, 24187, 265]
2014-01-09 12:39:40,482 DEBUG Data string: &node=10&json={1:1486,2:937,3:0,4:0,5:24187,6:265}
2014-01-09 12:39:40,485 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=10&json={1:1486,2:937,3:0,4:0,5:24187,6:265}
2014-01-09 12:39:40,487 INFO Sending to emoncms.org
2014-01-09 12:39:40,593 DEBUG Send ok
2014-01-09 12:39:40,798 INFO Serial RX: > 0s
2014-01-09 12:39:41,004 INFO Serial RX:  -> 4 b
2014-01-09 12:39:42,607 INFO Serial RX:  20 165 11
2014-01-09 12:39:43,014 DEBUG Node: 20
2014-01-09 12:39:43,017 DEBUG Values: [2981]
2014-01-09 12:39:43,020 DEBUG Server emoncms.org -> send data: [20, 2981]
2014-01-09 12:39:43,022 DEBUG Data string: &node=20&json={1:2981}
2014-01-09 12:39:43,028 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=20&json={1:2981}
2014-01-09 12:39:43,030 INFO Sending to emoncms.org
2014-01-09 12:39:43,163 DEBUG Send ok
2014-01-09 12:39:43,370 INFO Serial RX:  20 165 11
2014-01-09 12:39:43,373 DEBUG Node: 20
2014-01-09 12:39:43,375 DEBUG Values: [2981]
2014-01-09 12:39:43,378 DEBUG Server emoncms.org -> send data: [20, 2981]
2014-01-09 12:39:43,380 DEBUG Data string: &node=20&json={1:2981}
2014-01-09 12:39:43,382 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=20&json={1:2981}
2014-01-09 12:39:43,385 INFO Sending to emoncms.org
2014-01-09 12:39:43,519 DEBUG Send ok
2014-01-09 12:39:50,715 INFO Serial RX:  10 178 5 164 3 0 0 0 0 67 94 9 1
2014-01-09 12:39:50,718 DEBUG Node: 10
2014-01-09 12:39:50,721 DEBUG Values: [1458, 932, 0, 0, 24131, 265]
2014-01-09 12:39:50,723 DEBUG Server emoncms.org -> send data: [10, 1458, 932, 0, 0, 24131, 265]
2014-01-09 12:39:50,726 DEBUG Data string: &node=10&json={1:1458,2:932,3:0,4:0,5:24131,6:265}
2014-01-09 12:39:50,728 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=10&json={1:1458,2:932,3:0,4:0,5:24131,6:265}
2014-01-09 12:39:50,731 INFO Sending to emoncms.org
2014-01-09 12:39:50,800 DEBUG Send ok
2014-01-09 12:40:01,953 INFO Serial RX:  10 209 5 167 3 0 0 0 0 131 94 9 1
2014-01-09 12:40:01,957 DEBUG Node: 10
2014-01-09 12:40:01,959 DEBUG Values: [1489, 935, 0, 0, 24195, 265]
2014-01-09 12:40:01,961 DEBUG Server emoncms.org -> send data: [10, 1489, 935, 0, 0, 24195, 265]
2014-01-09 12:40:01,964 DEBUG Data string: &node=10&json={1:1489,2:935,3:0,4:0,5:24195,6:265}
2014-01-09 12:40:01,967 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=10&json={1:1489,2:935,3:0,4:0,5:24195,6:265}
2014-01-09 12:40:01,969 INFO Sending to emoncms.org
2014-01-09 12:40:02,046 DEBUG Send ok
2014-01-09 12:40:02,252 INFO Serial RX:  20 165 11
2014-01-09 12:40:02,255 DEBUG Node: 20
2014-01-09 12:40:02,257 DEBUG Values: [2981]
2014-01-09 12:40:02,260 DEBUG Server emoncms.org -> send data: [20, 2981]
2014-01-09 12:40:02,262 DEBUG Data string: &node=20&json={1:2981}
2014-01-09 12:40:02,264 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=20&json={1:2981}
2014-01-09 12:40:02,267 INFO Sending to emoncms.org
2014-01-09 12:40:02,342 DEBUG Send ok
2014-01-09 12:40:02,971 INFO Serial RX:  20 165 11
2014-01-09 12:40:02,974 DEBUG Node: 20
2014-01-09 12:40:02,976 DEBUG Values: [2981]
2014-01-09 12:40:02,979 DEBUG Server emoncms.org -> send data: [20, 2981]
2014-01-09 12:40:02,981 DEBUG Data string: &node=20&json={1:2981}
2014-01-09 12:40:02,984 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=20&json={1:2981}
2014-01-09 12:40:02,986 INFO Sending to emoncms.org
2014-01-09 12:40:03,137 DEBUG Send ok
2014-01-09 12:40:13,413 INFO Serial RX:  10 211 5 156 3 0 0 0 0 148 94 9 1
2014-01-09 12:40:13,416 DEBUG Node: 10
2014-01-09 12:40:13,418 DEBUG Values: [1491, 924, 0, 0, 24212, 265]
2014-01-09 12:40:13,421 DEBUG Server emoncms.org -> send data: [10, 1491, 924, 0, 0, 24212, 265]
2014-01-09 12:40:13,424 DEBUG Data string: &node=10&json={1:1491,2:924,3:0,4:0,5:24212,6:265}
2014-01-09 12:40:13,426 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=10&json={1:1491,2:924,3:0,4:0,5:24212,6:265}
2014-01-09 12:40:13,428 INFO Sending to emoncms.org
2014-01-09 12:40:13,503 DEBUG Send ok
2014-01-09 12:40:24,608 INFO Serial RX:  10 203 5 169 3 0 0 0 0 182 94 9 1
2014-01-09 12:40:24,611 DEBUG Node: 10
2014-01-09 12:40:24,614 DEBUG Values: [1483, 937, 0, 0, 24246, 265]
2014-01-09 12:40:24,616 DEBUG Server emoncms.org -> send data: [10, 1483, 937, 0, 0, 24246, 265]
2014-01-09 12:40:24,619 DEBUG Data string: &node=10&json={1:1483,2:937,3:0,4:0,5:24246,6:265}
2014-01-09 12:40:24,621 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=10&json={1:1483,2:937,3:0,4:0,5:24246,6:265}
2014-01-09 12:40:24,624 INFO Sending to emoncms.org
2014-01-09 12:40:24,706 DEBUG Send ok
2014-01-09 12:40:29,425 INFO Serial RX:  19 244 0 221 0 140 1 26 0
2014-01-09 12:40:29,428 DEBUG Node: 19
2014-01-09 12:40:29,430 DEBUG Values: [244, 221, 396, 26]
2014-01-09 12:40:29,433 DEBUG Server emoncms.org -> send data: [19, 244, 221, 396, 26]
2014-01-09 12:40:29,436 DEBUG Data string: &node=19&json={1:244,2:221,3:396,4:26}
2014-01-09 12:40:29,438 DEBUG URL string: http://emoncms.org/input/post.json?apikey=6e91c721c477051d39b30522a2dXXXX&node=19&json={1:244,2:221,3:396,4:26}
2014-01-09 12:40:29,441 INFO Sending to emoncms.org
2014-01-09 12:40:29,512 DEBUG Send ok
Jérôme's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

Yes, it goes gateway -> GLCD.

Happens here: 

2014-01-09 12:39:39,204 DEBUG Broadcasting time: 12:39

Should work.

Could it be a radio link issue ? Maybe try to get the GLCD closer.

patmolloy's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

Ah ! Thanks :) Good.

I've tried various locations for the GLCD .. at the moment (I am testing) it's < 1m from the gateway. I wondered if that was actually too close, so have tried further away too. No luck so far. Also have rebooted gateway multiple times etc.

The GLCD *is* getting (and showing) the correct overall household power usage, so *is* capable of receiving that data wirelessly. But I guess that is 

Is it possible that the gateway is really not transmitting the time, or that the GLCD is not recieving it (and if it is, simply not displaying).

What to check first, would you recommend. 

Thanks ever so for the help. Really appreciated. Am pleased (so far) that it's not me being an idiot ! 

Poking about I can see the following code in the Arduino Sketch ..

 

void loop()
{
 
  if (rf12_recvDone())
  {
    if (rf12_crc == 0 && (rf12_hdr & RF12_HDR_CTL) == 0)  // and no rf errors
    {
      int node_id = (rf12_hdr & 0x1F);
      if (node_id == 10) {emontx = *(PayloadTX*) rf12_data; last_emontx = millis();}  //Assuming 10 is the emonTx NodeID
     
      if (node_id == 15)   //Assuming 15 is the emonBase node ID
      {
        RTC.adjust(DateTime(2012, 1, 1, rf12_data[1], rf12_data[2], rf12_data[3]));
        last_emonbase = millis();
      }
    }
  }

(Have added underline, bold). Now 10 *is* the NodeID of the emonTX, but what is emonBase node ID? -- is that referring to the Gateway ? There is nothing, as far as I know at 15). The oemgateway.conf says baseid = 19 (but I already have an emonTH on that node)

# This listener manages the RFM2Pi module
[[RFM2Pi]]
    type = OemGatewayRFM2PiListener
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
    [[[runtime_settings]]]
        sgroup = 210
        frequency = 4
        baseid = 19
        sendtimeinterval = 60

 

So, should I set baseid = 25 (for example) in the oemgateway.conf file and also change this line in the Arduino sketch to match ? (i.e. node_id == 25)

if (node_id == 15)   //Assuming 15 is the emonBase node ID

 

Pat

 

patmolloy's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

Yep, that did it. I set them both to 25 and now I have the actual time :)

Yay !

Pat

 

Jérôme's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

Well spotted.

We should settle with a common default base ID for both the gateway and the sketch examples.

I don't remember why I set it at 19 in the config file of the gateway.

patmolloy's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

At least this was on the simpler end of what might have been wrong ! And *easy* to fix :)

 

michelino1977's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

Hello, i am Italian.

Sorry for my english.

It is also possible to transmit the full date the Raspberry?

I would like to display it on emonglcd.

This is the string to be changed, right?

self._ser.write("00,%02d,%02d,00,s" % (now.hour, now.minute))

Many Thanks!

ukmoose's picture

Re: GLCD Not picking up time - using Pre-Loaded Raspberry Pi Gateway from OEM Shop

michelino1977,

Your question is different to the question asked in this thread.  Please could you open a new forum post with a title that explains what you are trying to do?  e.g. "Trying to get GLCD to display date rather than time"

You are more likely to grab the attention of people who can help you.

 

 

Comment viewing options

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