Author Topic: Gateway App 9.1.0 Keeps Disconnecting from Webserver - New Setup  (Read 1084 times)

ermc80

  • NewMember
  • *
  • Posts: 3
First off I'm a huge fan of Felix and the LowPowerLab community.  I'm finally getting around to setting up my Pi Gateway and two RFM69HW's that I bought a few years back.  Here's my setup:

-RaspberryPi 3 running the - IOT Gateway 9.1.0 with Node version 11.15.0. 
-I have 2 RFM69HW's - One is connected via FTDI and has the PiGateway.ino sketch setup and the other is setup as the receiver with the sketch listed in the documentation - https://github.com/LowPowerLab/RFM69/blob/master/Examples/Gateway/Gateway.ino
-The receiver moteino is connected to a bread board and a 4 AA battery bank to the appropriate pins (happy to send a pic if needed)
-I've changed the baud rate on the gateway to 115200 to match my slightly older moteino
-I've updated my serial to USB to match the FTDI usb connection

Before I start adding any components and writing my own sketches I wanted to make sure my IOT / Moteino ecosystem was setup correctly.  I've read the forums and watch several videos.  When I try to add the node via the GateWay I'm not really seeing anything in the logs and randomly and nearly constantly the web app will reboot.

Any thoughts on what I'm missing - excerpt of the gateway log showing disconnect and reconnect:

Code: [Select]
[07-11-20_16:29:28.254] [INFO]   AUTHORIZING CONNECTION FROM ::1:44224
[07-11-20_16:29:28.255] [INFO]   NEW CONNECTION FROM 127.0.0.1
[07-11-20_16:29:37.764] [INFO]   AUTHORIZING CONNECTION FROM ::1:44242
[07-11-20_16:29:37.766] [INFO]   NEW CONNECTION FROM 192.168.172.173
[07-11-20_16:29:59.452] [INFO]   AUTHORIZING CONNECTION FROM ::1:44248
[07-11-20_16:29:59.454] [INFO]   NEW CONNECTION FROM 127.0.0.1
[07-11-20_16:30:08.667] [INFO]   AUTHORIZING CONNECTION FROM ::1:44266
[07-11-20_16:30:08.669] [INFO]   NEW CONNECTION FROM 192.168.172.173
[07-11-20_16:30:30.575] [INFO]   AUTHORIZING CONNECTION FROM ::1:44272
[07-11-20_16:30:30.577] [INFO]   NEW CONNECTION FROM 127.0.0.1
[07-11-20_16:30:39.645] [INFO]   AUTHORIZING CONNECTION FROM ::1:44290
[07-11-20_16:30:39.647] [INFO]   NEW CONNECTION FROM 192.168.172.173
[07-11-20_16:31:01.386] [INFO]   AUTHORIZING CONNECTION FROM ::1:44296
[07-11-20_16:31:01.388] [INFO]   NEW CONNECTION FROM 127.0.0.1
[07-11-20_16:31:10.234] [INFO]   AUTHORIZING CONNECTION FROM ::1:44314
[07-11-20_16:31:10.236] [INFO]   NEW CONNECTION FROM 192.168.172.173
[07-11-20_16:31:32.713] [INFO]   AUTHORIZING CONNECTION FROM ::1:44320
[07-11-20_16:31:32.715] [INFO]   NEW CONNECTION FROM 127.0.0.1
[07-11-20_16:31:41.435] [INFO]   AUTHORIZING CONNECTION FROM ::1:44338
[07-11-20_16:31:41.436] [INFO]   NEW CONNECTION FROM 192.168.172.173

I did see some promising data in the logs for a moment but can't get that data to happen again :-)

Code: [Select]
07-11-20_14:58:52.987] [LOG]    NODEDATA PARTIAL NOMATCH>: 123
[07-11-20_14:58:52.988] [LOG]    NODEDATA PARTIAL NOMATCH>: ABCD.
[07-11-20_14:58:52.990] [INFO]      [5] DB-Insert new _id:5
[07-11-20_14:58:53.223] [LOG]    /dev/ttyUSB0>:Sending[9]: 123 ABCDE nothing...
[07-11-20_14:58:53.227] [LOG]    NODEDATA PARTIAL NOMATCH>: :
[07-11-20_14:58:53.228] [LOG]    NODEDATA PARTIAL NOMATCH>: 123
[07-11-20_14:58:53.231] [LOG]    NODEDATA PARTIAL NOMATCH>: nothing...
[07-11-20_14:58:53.234] [INFO]      [9] DB-Insert new _id:9
[07-11-20_14:58:53.767] [LOG]    /dev/ttyUSB0>:Sending[11]: 123 ABCDEFG3 ABCDEFGHI nothing...
[07-11-20_14:58:54.307] [LOG]    NODEDATA PARTIAL NOMATCH>: :
[07-11-20_14:58:54.309] [LOG]    NODEDATA PARTIAL NOMATCH>: 123
[07-11-20_14:58:54.311] [LOG]    NODEDATA PARTIAL NOMATCH>: nothing...
[07-11-20_14:58:54.313] [INFO]      [11] DB-Insert new _id:11
[07-11-20_14:58:54.640] [LOG]    /dev/ttyUSB0>:Sending[15]: 123 ABCDEFGHIJKing[20]: 123 ABCDEFGHIJKLMNOPg delay to 700ms
[07-11-20_14:58:54.641] [LOG]    /dev/ttyUSB0>:
[07-11-20_14:58:54.642] [LOG]    GENERAL NOMATCH>: \r
[07-11-20_14:58:54.646] [LOG]    NODEDATA PARTIAL NOMATCH>: :
[07-11-20_14:58:54.647] [LOG]    NODEDATA PARTIAL NOMATCH>: 123
[07-11-20_14:58:54.648] [LOG]    NODEDATA PARTIAL NOMATCH>: ABCDEFGHIJKing[20]:
[07-11-20_14:58:54.649] [LOG]    NODEDATA PARTIAL NOMATCH>: 123
[07-11-20_14:58:54.650] [LOG]    NODEDATA PARTIAL NOMATCH>: 700ms

webserver.error.log
Code: [Select]
2020/07/11 15:04:39 [error] 738#0: *50 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: gateway, request: "GE$
2020/07/11 15:04:40 [error] 738#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.172.173, server: gateway, request: "GET$
2020/07/11 15:04:40 [error] 738#0: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 192.168.172.173, server: gateway, request$
2020/07/11 15:04:41 [error] 738#0: *50 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: gateway, request: "GET /soc$
2020/07/11 15:04:41 [error] 738#0: *50 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 127.0.0.1, server: gateway, request: "GE$
2020/07/11 15:05:01 [error] 738#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.172.173, server: gateway, request: "GET$
2020/07/11 15:05:01 [error] 738#0: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 192.168.172.173, server: gateway, request$
2020/07/11 15:05:23 [error] 738#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.172.173, server: gateway, request: "GET$
2020/07/11 15:05:23 [error] 738#0: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 192.168.172.173, server: gateway, request$
2020/07/11 15:05:39 [error] 738#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.172.173, server: gateway, request: "GET$
2020/07/11 15:05:39 [error] 738#0: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 192.168.172.173, server: gateway, request$
2020/07/11 15:05:59 [error] 738#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.172.173, server: gateway, request: "GET$
2020/07/11 15:05:59 [error] 738#0: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 192.168.172.173, server: gateway, request$

Any help will be much appreciate.





sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: Gateway App 9.1.0 Keeps Disconnecting from Webserver - New Setup
« Reply #1 on: July 11, 2020, 06:08:08 PM »
Does your PiGateway sketch serial baud rate match your Pi/host computer serial port baud rate?  I have my PiGateway sketch set at 19200 and all my nodes are set at 115200. 

ermc80

  • NewMember
  • *
  • Posts: 3
Re: Gateway App 9.1.0 Keeps Disconnecting from Webserver - New Setup
« Reply #2 on: July 11, 2020, 06:36:48 PM »
Thank you for the fast reply.  I made the gateway, the node setting, and the receiver all 115200.  The PiGateway was 19200 and I changed it to match the rest.  What should they be 19200 or 115200?

sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: Gateway App 9.1.0 Keeps Disconnecting from Webserver - New Setup
« Reply #3 on: July 11, 2020, 06:54:22 PM »
The baud rate in your settings.json5 file needs to match your PiGateway sketch.  I have mine set at 19200 which I believe Felix has suggested.  All my nodes are set to 115200.

Here is a comment from Felix regarding the lower baud rate;

"That was changed to 19200 a while ago, I think consensus from me and other folks was that it helped with reducing any too fast marshalling of serial messages between the Pi and RF gateway."


« Last Edit: July 11, 2020, 07:03:54 PM by sparky »

ermc80

  • NewMember
  • *
  • Posts: 3
Re: Gateway App 9.1.0 Keeps Disconnecting from Webserver - New Setup
« Reply #4 on: July 11, 2020, 07:04:15 PM »
I’ll make that update and try again.  If that don’t work I’ll try to reinstall the gateway.

sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: Gateway App 9.1.0 Keeps Disconnecting from Webserver - New Setup
« Reply #5 on: July 11, 2020, 07:25:16 PM »
Others will be able to tell alot from your error log.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Gateway App 9.1.0 Keeps Disconnecting from Webserver - New Setup
« Reply #6 on: July 13, 2020, 09:21:29 AM »
ermc80,
From your logs, you are probably not using the correct sketches. For the gateway you have to use this sketch:
https://github.com/LowPowerLab/RFM69/blob/master/Examples/PiGateway/PiGateway.ino

For a remote node, it looks like you're using the example Node sketch, which is just a general purpose sender, not appropriate for use with the PiGateway, it does not send any valid data. You have to use something that conforms to a meaningful data token format, as defined in the metrics files: variable:value or just value.

Even so your browser should not disconnect/reload, it would simply reject all the incoming data as non-matches, as seen in your logs. As to why it crashes, I cannot be sure. I would first spend the time to load the correct sketches, then have a node that transmits valid data. Look in the examples of the RFM69 library, there are many such examples such as the MotionMote or SwitchMote or WeatherNode: https://github.com/LowPowerLab/RFM69/tree/master/Examples