LowPowerLab Forum

Software support => Pi Gateway => Topic started by: Stereodude on June 20, 2024, 11:38:22 PM

Title: Fresh Install of Pi Gateway - nginx problem
Post by: Stereodude on June 20, 2024, 11:38:22 PM
I dusted off my MightyHat r3 and RPi3b and wanted to get Pi Gateway and the MightyHat r3 working again. I did a clean install of the latest Raspberry Pi OS Lite 2024-03-15-raspios-bookworm-armhf-lite.img (not sure if I should have used ARM64).  I ran the install script and it seemed to complete successfully. After rebooting it told me that NGINX failed to start

[FAILED] Failed to start nginx.service ...
I used the suggested command to see what the issue is using systemctl status nginx.service. These are the two relevant lines.

nginx[1210]: 2024/06/20 23:46:01 [warn] 1210#1210: low address bits of 192.168.1.1/24 are meaningless in /etc/nginx/sites-enabled/gateway:18
nginx[1210]: 2024/06/20 23:46:01 [emerg] 1210#1210: unknown directive "pm.status_listen" in /etc/nginx/sites-enabled/gateway:70

Edit: The forum keeps auto editing my post and removing large parts of my post... Continued below
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Stereodude on June 20, 2024, 11:51:24 PM
I resolved that issue by editing the gateway config and commenting out this line
pm.status_listen = 127.0.0.1:9001;
I'm not sure if that was the correct thing to do, but it allowed nginx to start.

Then it was hanging at Waiting for Connection as the attachment in the first post shows when I tried to load the webpage from another PC.  However, I now see from another thread (https://lowpowerlab.com/forum/pi-gateway/newb-waiting-for-socket-connection/) that I need to use the default username of Pi which I didn't, which is probably why it wasn't loading. I will have to try a clean install tomorrow also using the latest HEAD not the latest release.

I am unsure if I should use the 64-bit version or Raspberry Pi OS or the 32-bit. I also noticed that the MightyHat was not able to shut down the RPi3b.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Stereodude on June 21, 2024, 11:15:22 AM
I did a clean install of 2024-03-15-raspios-bookworm-armhf-lite and set my username to pi. Also used the HEAD version when prompted in the script.

I had the same issue as before with pm.status_listen = 127.0.0.1:9001; blocking nginx from starting. I commented that out

The next issue was that nginx didn't have access to the gateway folder
sudo -u www-data namei /home/pi/gateway/
f: /home/pi/gateway/www/index.html
d /
d home
d pi
   gateway - Permission denied

I had to change the permissions of the pi folder with chmod og+x /home/pi so that it could traverse the folder and get into the gateway directory. Now I can get to the web interface.

Not sure if it's working as my Motetinos are not here with me. I know the power/reboot button on the MightHat is not working. It looks like GPIO.wait_for_edge is not supported in the latest python included with the OS (3.11.2).
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Stereodude on June 23, 2024, 03:18:56 PM
Quote from: Stereodude on June 21, 2024, 11:15:22 AM
Not sure if it's working as my Motetinos are not here with me. I know the power/reboot button on the MightyHat is not working. It looks like GPIO.wait_for_edge is not supported in the latest python included with the OS (3.11.2).
I resolved the issue with the power/reboot button on the MightyHat as detailed here: https://lowpowerlab.com/forum/mightyhat/fixing-mightyhat-shutdownreboot-functionality-on-rpi-os-lite-2024-03-(bookworm)/

Maybe I should have posted it here instead since it was a Pi Gateway software change not something that needed changing in the MightyHat, but it was specific to the MH.

Also, I got out my Motetino M0 w/ radio and confirmed that everything is working.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on June 25, 2024, 08:40:40 AM
Thanks for documenting all this.
P.S. And we thought computers make our lives easy :-)
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on January 10, 2025, 06:33:29 PM
As a follow up - I fixed the script and it should now install PHP correctly as well as grant the necessary access to the /home/pi/gateway directory.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 04, 2026, 09:42:20 AM
I'm about to pull my hair out (what little I have left) and I am stuck with the same "Waiting on socket connection"  I changed the default user and rebuilt with "pi", that did not work.  I tried a pi2 and pi3, no joy.  I tried the Head version instead of the recommended version, same result, I also notice that I can not get the gateway to start and doing a ps ux | grep gateway just shows one line (the command itself).  I have the mighty hat installed and I see data from the 2 weather nodes I have just fine.  I also see data coming in by using the terminal program, so it appears that the pi serial port is getting data from the hat.  I think I have rebuilt my SD cards no less that 10 times with different combinations and still stuck with the waiting on socket connection.  Oh I also tried the chmod of the /home/pi directory like stereodude did, no luck with that.  Any ideas welcome.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 04, 2026, 10:53:46 AM
Thanks for reporting it, please avoid pulling hairs, we will solve this somehow :-)
I have installed recently on a few Pi's including Pi5, I think there were minor bumps but nothing major that would prevent a good outcome.
I would need a bit more detail from the error logs to be able to advise on this. I am also checking the details of my installs to try to see what I did and if that might be a cause.
Having said that, unless you just need to use an older pi for economical reasons, I would advise using at least a RaspberryPi 3B+ or Pi 4 would be better.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 04, 2026, 11:50:44 AM
Hey Felix, thanks for the reply, I believe my pi3 is b+.  This actually ran on a pi2 for years and had zero problems until I moved and I think something happened to the SD card, so that prompted a new install.  So frustrating.  I have also started with a clean build did a sudo apt update && sudo apt upgrade -y , and that makes no difference.  Odd that the gateway won't start.  At this point it might just be a go unplug everything and comeback in a few days.  Sleeping on it had me trying new things this morning and I definitely had to rebuild with the user "pi".  I knew I screwed up when there was nothing in the home directory of the user I created.  Odd thing is that the default password for pi didn't work either.  But rebuilding everything with just pi user did not fix anything either.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 04, 2026, 12:06:57 PM
I have some commercial installs that have a lot of changes and haven't really caught up. I will merge what is relevant as I have time.
For now I submitted a commit to the HEAD which includes some installation changes, updated packages etc, which will become a new patch release, also when I can have time to check that.
So right now get the HEAD and try again. It's important to make sure the settings.json5 contains the matching serial port (GPIO UART serial usually /dev/ttyAMA0 or USB serial usually /dev/ttyACM0) and the baud (this matters especially for GPIO UART, as opposed to the USB serial which can not matter when the port is emulated - in any case match it).
Note any install errors, look in the logs for reasons why the gateway.js service cannot start, or nodejs or socket.io are not running.
I will be building a brand new gateway for myself soon with a Pi5 and bring a lot of new features over from my custom commercial installs. At that point I will iron our all issues and merge everything and make a new major release. My big problem is time and other things that are high priority.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 04, 2026, 02:49:51 PM
Steps
new image via pi imager
64bit pi os lite for pi 3 b
user name pi
no updates or upgrades
selected HEAD version
installed Fail2Ban
ATXRaspi shutdown script
Installed interrupt script
answered no to login shell
answered yes to serial interface enabled
no to proftp
no to raspiconfig
reboot
Still getting "Waiting for socket connection"

Here is my setting in settings.json5

  serial: {
      editable: true,
      exposed: true,
      port: {
        value: '/dev/ttyAMA0',
        description: 'replace this with whatever serial port you have on your Pi/gateway (ttyAMA0 is the default GPIO serial port). If you use a MoteinoUSB then your Pi will emulate a serial port >
      },
      baud: {
        value: 19200,
        type: 'number',
        description: 'needs to match the Serial baud speed in the sketch running on the Moteino or MightyHat that is attached to this Pi',
      },



As you can see , I have no tty directory or device call ttyAMA0

pi@pigate:/dev $ ls ttyAMA0
ls: cannot access 'ttyAMA0': No such file or directory
pi@pigate:/dev $ cd tty
-bash: cd: tty: Not a directory
pi@pigate:/dev $


In the logs for gateway.sys.log, this just keeps repeating:

pi@pigate:~/gateway/logs $ more gateway.sys.log
/home/pi/gateway/gateway.js:1303



SyntaxError: Unexpected end of input
    at wrapSafe (node:internal/modules/cjs/loader:1740:18)
    at Module._compile (node:internal/modules/cjs/loader:1783:20)
    at Object..js (node:internal/modules/cjs/loader:1940:10)
    at Module.load (node:internal/modules/cjs/loader:1530:32)
    at Module._load (node:internal/modules/cjs/loader:1332:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47


webserver log:

pi@pigate:~/gateway/logs $ more webserver.error.log
2026/02/04 14:35:44 [error] 1051#1051: *7 user "pi": password mismatch, client: 192.168.0.108, server: gateway, request: "GET / HTTP/1.1", host: "192.168.0.162"
2026/02/04 14:35:55 [error] 1051#1051: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.108, server: gateway, request: "GET /socket.io/socket.io.js HTTP
/1.1", upstream: "http://[::1]:8080/socket.io/socket.io.js", host: "192.168.0.162", referrer: "https://192.168.0.162/"
2026/02/04 14:35:55 [error] 1051#1051: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.108, server: gateway, request: "GET /socket.io/socket.io.js HTTP
/1.1", upstream: "http://127.0.0.1:8080/socket.io/socket.io.js", host: "192.168.0.162", referrer: "https://192.168.0.162/"
2026/02/04 14:35:55 [error] 1051#1051: *7 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 192.168.0.108, server: gateway, request: "GET /socket.io/socket.io.j
s HTTP/1.1", upstream: "http://127.0.0.1:8080/socket.io/socket.io.js", host: "192.168.0.162", referrer: "https://192.168.0.162/"


webserver.error.log:


pi@pigate:~/gateway/logs $ more webserver.access.log
192.168.0.108 - pi [04/Feb/2026:14:35:44 -0500] "GET / HTTP/1.1" 401 574 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143
.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET / HTTP/1.1" 200 32667 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/1
43.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /socket.io/socket.io.js HTTP/1.1" 404 181 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Ge
cko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /css/jquery.mobile-1.4.5.min.css HTTP/1.1" 200 207465 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KH
TML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /css/jqm-font-awesome-usvg-upng.min.css HTTP/1.1" 200 115121 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537
.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /css/listview-grid.css HTTP/1.1" 200 4853 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Ge
cko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /css/jquery.mobile.datepicker.css HTTP/1.1" 200 4936 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHT
ML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /js/jquery-1.12.1.min.js HTTP/1.1" 200 97403 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /js/jquery.flot.time-0.8.3.min.js HTTP/1.1" 200 4658 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHT
ML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:55 -0500] "GET /js/jquery.mobile-1.4.5.min.js HTTP/1.1" 200 200143 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTM
L, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
.
.
.
parsed info in the middle, here is the last several lines:

192.168.0.108 - pi [04/Feb/2026:14:35:56 -0500] "GET /css/images/ajax-loader.gif HTTP/1.1" 200 6242 "https://192.168.0.162/css/jquery.mobile-1.4.5.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64
) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:56 -0500] "GET /css/svg/terminal-16.svg HTTP/1.1" 200 861 "https://192.168.0.162/css/jqm-font-awesome-usvg-upng.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64;
x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:56 -0500] "GET /css/svg/gear-16.svg HTTP/1.1" 200 1680 "https://192.168.0.162/css/jqm-font-awesome-usvg-upng.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64
) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:56 -0500] "GET /css/svg/database-16.svg HTTP/1.1" 200 1340 "https://192.168.0.162/css/jqm-font-awesome-usvg-upng.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64;
x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:56 -0500] "GET /css/svg/flash-16.svg HTTP/1.1" 200 810 "https://192.168.0.162/css/jqm-font-awesome-usvg-upng.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64
) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
192.168.0.108 - pi [04/Feb/2026:14:35:56 -0500] "GET /images/favicon.ico HTTP/1.1" 200 6727 "https://192.168.0.162/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko
) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"





Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 04, 2026, 02:50:53 PM
Thank you for taking the time to help me.  This certainly isn't a high priority as its just supposed to be a fun project. :)

Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 04, 2026, 08:23:01 PM
go to /dev then ls tty* - you should get a ton of tty devices. At the very least you should have ttyAMA0 which is the GPIO UART serial.

Anyway it's a mess looks like. I think I have a Pi3B+ somewhere and I'll try this when I have a few hours to burn.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 05, 2026, 09:43:06 AM
Here are my ttys:

pi@pigate:/dev $ ls tty*
tty   tty10  tty13  tty16  tty19  tty21  tty24  tty27  tty3   tty32  tty35  tty38  tty40  tty43  tty46  tty49  tty51  tty54  tty57  tty6   tty62  tty8       ttyS0
tty0  tty11  tty14  tty17  tty2   tty22  tty25  tty28  tty30  tty33  tty36  tty39  tty41  tty44  tty47  tty5   tty52  tty55  tty58  tty60  tty63  tty9
tty1  tty12  tty15  tty18  tty20  tty23  tty26  tty29  tty31  tty34  tty37  tty4   tty42  tty45  tty48  tty50  tty53  tty56  tty59  tty61  tty7   ttyprintk
pi@pigate:/dev $


I notice that there is a symbolic link for serial0:

pi@pigate:/dev $ ls -l ser*
lrwxrwxrwx 1 root root 5 Feb  4 14:34 serial0 -> ttyS0
pi@pigate:/dev $


Could that be an issue ? 
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 05, 2026, 02:23:09 PM
It could mean the serial is not enabled. What serial port are you connected to (from your Moteino/radio board)?
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 05, 2026, 05:08:18 PM
according to picocom, here is live data from my two weather nodes using /dev/serial0

pi@pigate:/dev $ sudo picocom -b 19200 /dev/serial0
picocom v3.1

port is        : /dev/serial0
flowcontrol    : none
baudrate is    : 19200
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        :
omap is        :
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready
[40] BAT:4.45v F:60.21 H:39.74 P:29.29   [RSSI:-48][ACK-sent]
[30] BAT:4.56v F:63.18 H:43.09 P:29.28   [RSSI:-63][ACK-sent]

So I am getting data from the MightyHat, but the gateway is still not running.  I did change the settings.json5 file to match my serial port that I am getting data from.  Web UI still has same error and gateway did not start.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 08, 2026, 02:14:25 PM
Also seeing this in gateway.sys.log   It keeps repeating the same error, perhaps that is another clue ?  The webserver.acccess.log and webserver.error.log are empty.

Node.js v25.6.0
/home/pi/gateway/gateway.js:1303



SyntaxError: Unexpected end of input
    at wrapSafe (node:internal/modules/cjs/loader:1740:18)
    at Module._compile (node:internal/modules/cjs/loader:1783:20)
    at Object..js (node:internal/modules/cjs/loader:1940:10)
    at Module.load (node:internal/modules/cjs/loader:1530:32)
    at Module._load (node:internal/modules/cjs/loader:1332:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 09, 2026, 05:58:43 PM
Probably related to not being able to start node.js or socket.io
I will try to do an install tomorrow if I have some time.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 10, 2026, 10:35:19 AM
Ok I think I got it, it was a syntax error in one of the gateway.js commits.
File in HEAD is updated, can you replace your gateway.js with the latest in the repository, it should fix the problem and the gateway service should now start.
Otherwise install on a Pi5 with latest Pi OS Lite 64bit went flawlessly.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 10, 2026, 01:12:37 PM
Great news, well, kinda.  Got the webserver going and I selected two weather nodes, however there is no data, yet picocom shows data from both in the command line.  I will poke around in the nodes.js and see if something is off (no idea what I am looking for :)  ) 

Definitely closer than before and the gateway is running as you can see:

pi@pigate:~ $ ps ux | grep gateway
pi           966  0.0  0.1   2400  1460 ?        Ss   12:25   0:00 /bin/sh -c /usr/bin/node --trace-deprecation /home/pi/gateway/gateway.js >> /home/pi/gateway/logs/gateway.sys.log 2>&1
pi           976  0.2  7.8 1391224 72664 ?       Sl   12:25   0:07 /usr/bin/node --trace-deprecation /home/pi/gateway/gateway.js
pi          1230  0.0  0.2   6252  2008 pts/0    S+   13:11   0:00 grep --color=auto gateway
pi@pigate:~ $
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 10, 2026, 01:22:18 PM
I do see this and I have checked that my serial port is set to serial0, unclear as to where to go to check this error.
pi@pigate:~/gateway/logs $ tail -f gateway.sys.log
[26/02/10 13:20:39.943] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:40.945] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:41.946] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:42.947] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:43.947] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:44.949] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:45.950] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:46.951] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:47.952] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:48.953] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:49.954] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:50.955] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:51.956] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:52.957] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:53.957] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:54.958] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:55.958] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:56.960] [INFO]  settings.serial.enabled FALSE or NOT FOUND!
[26/02/10 13:20:57.961] [INFO]  settings.serial.enabled FALSE or NOT FOUND!

Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 10, 2026, 05:30:16 PM
Found another issue, I forgot to merge a new serial.enabled setting, had it locally.
Get the latest settings.json5 and restart the gateway (CTRL+SHIFT+ALT+R).
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 10, 2026, 06:04:11 PM
That was it!  I got my 2 weather sensors showing good data, but still nothing from the Sonar Mote, yet I get data from it via picocom and the App server disconnects and then starts and again, good weather nodes, just nothing from the basement mote.  Perhaps I need to upload a new sketch to it.  I did find a bad header that the ultrasonic  module plugs into, one of the pins was broken internally, so I put a new header in and get distance now.  Earlier was just getting signal strength and battery voltage.  Thanks a million Felix, I really appreciate all the time you put into this.  Nice to have this working again.  I moved and when I fired up the gateway it didn't work.  I really like seeing the temp data graphed over time.  Even put one in my attic at my old house to see how hot it got in the summer.  I will try a new sketch on the mote unless you think something might be off.  I haven't done anything with the 3 nodes since I bought them from you years ago, I just followed the instructions and loaded the sketches and off they went.  While I am writing this I have seen the web page refresh several times now.

Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 10, 2026, 06:15:05 PM
OK, got the Sonar Mote working now too.  The battery was bad (kind of thought so because it felt slightly warm).  I put a new battery in and I am getting data on the Web UI too,  now If I can figure out why the web page keeps refreshing.  Seems like anytime there is new data from a node it restarts.  I get the message:

App server was disconnected
Waiting for new connection.

Then it comes back up to normal.

This from the terminal window:
6:05:38 PM : Disconnected!
18:05:38.610 : /dev/serial0>:[30] BAT:4.55v F:61.03 H:49.51 P:29.15   [RSSI:-63][ACK-sent]
18:03:53.260 : SERVERTIME OFFSET: -783ms
18:03:53.224 : Connected!
6:03:34 PM : Disconnected!
18:03:34.214 : /dev/serial0>:[30] BAT:4.55v F:61.02 H:49.53 P:29.15   [RSSI:-63][ACK-sent]
18:01:42.253 : SERVERTIME OFFSET: -793ms
18:01:42.205 : Connected!
6:01:27 PM : Disconnected!
18:01:27.827 : /dev/serial0>:[40] BAT:4.45v F:67.89 H:34.25 P:29.14   [RSSI:-66][ACK-sent]
17:59:30.575 : SERVERTIME OFFSET: -743ms
17:59:30.522 : Connected!
5:59:14 PM : Disconnected!
17:59:14.749 : /dev/serial0>:[40] BAT:4.45v F:67.71 H:34.43 P:29.14   [RSSI:-66][ACK-sent]
17:58:02.645 : SERVERTIME OFFSET: -766ms
17:58:02.586 : Connected!
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 11, 2026, 08:54:41 AM
Probably because the gateway.js app restarts. See if there's something more specific in gateway.sys.log
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 11, 2026, 10:47:08 AM
I see this over and over in the log:

pi@pigate:~/gateway/logs $ tail -100 gateway.sys.log
    at /home/pi/gateway/node_modules/nedb/lib/persistence.js:201:12
    at FSReqCallback.oncomplete (node:fs:180:23)

Node.js v25.6.1
[26/02/11 10:45:12.308] [INFO]  *********************************************************************
[26/02/11 10:45:12.314] [INFO]  ************************* GATEWAY APP START *************************
[26/02/11 10:45:12.315] [INFO]  *********************************************************************
[26/02/11 10:45:12.358] [INFO]  LOADING METRICS MODULE [./metrics/core.js]
[26/02/11 10:45:12.362] [INFO]  |- GLOBALIZING ONEDAY
[26/02/11 10:45:12.364] [INFO]  |- GLOBALIZING isNumeric()
[26/02/11 10:45:12.365] [INFO]  |- GLOBALIZING isValidIP()
[26/02/11 10:45:12.366] [INFO]  |- GLOBALIZING isValidNodeId()
[26/02/11 10:45:12.367] [INFO]  |- GLOBALIZING determineValue()
[26/02/11 10:45:12.368] [INFO]  |- GLOBALIZING determineGraphValue()
[26/02/11 10:45:12.370] [INFO]  |- GLOBALIZING timeoutOffset()
[26/02/11 10:45:12.371] [INFO]  |- GLOBALIZING millisToFutureDate()
[26/02/11 10:45:12.372] [INFO]  |- GLOBALIZING nextSunriseOrSunset()
[26/02/11 10:45:12.452] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/doorbellmote.js]
[26/02/11 10:45:12.456] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/garagemote.js]
[26/02/11 10:45:12.470] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/motionmote.js]
[26/02/11 10:45:12.474] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/RadioThermostat_CT50.js]
[26/02/11 10:45:12.480] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/sonarmote.js]
[26/02/11 10:45:12.483] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/sprinklers.js]
[26/02/11 10:45:12.488] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/switchmote.js]
[26/02/11 10:45:12.492] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/watermeter.js]
[26/02/11 10:45:12.495] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/_LowPowerLab/weathershield.js]
[26/02/11 10:45:12.499] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/examples/_example.js]
[26/02/11 10:45:12.504] [INFO]  |- GLOBALIZING ONEDAYHOURS
[26/02/11 10:45:12.505] [INFO]  |- GLOBALIZING secondsInOneDay()
[26/02/11 10:45:12.506] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/examples/_garage-auto-close.js]
[26/02/11 10:45:12.509] [INFO]  LOADING METRICS MODULE [/home/pi/gateway/metrics/examples/_InternetSpeedTest.js]
[26/02/11 10:45:12.558] [INFO]  SERIAL PORT CONNECTION TO: /dev/serial0 @ 19200baud
[26/02/11 10:45:12.695] [INFO]  Available serial port: {path:'/dev/ttyS0'}
[26/02/11 10:45:12.709] [LOG]   /dev/serial0>:GTWCMD:UPTIME
[26/02/11 10:45:12.713] [LOG]   /dev/serial0>:GTWCMD:FREERAM
[26/02/11 10:45:12.715] [LOG]   /dev/serial0>:GTWCMD:SYSFREQ
[26/02/11 10:45:12.716] [LOG]   /dev/serial0>:GTWCMD:UPTIME
[26/02/11 10:45:12.717] [LOG]   /dev/serial0>:GTWCMD:FREERAM
[26/02/11 10:45:12.719] [LOG]   /dev/serial0>:GTWCMD:SYSFREQ
[26/02/11 10:45:12.720] [LOG]   /dev/serial0>:GTWCMD:GATEWAYFWVERSION
[26/02/11 10:45:12.721] [LOG]   /dev/serial0>:GTWCMD:GATEWAYFWNAME
[26/02/11 10:45:12.723] [LOG]   /dev/serial0>:GTWCMD:FLXIMG
[26/02/11 10:45:12.725] [LOG]   /dev/serial0>:GTWCMD:NETID
[26/02/11 10:45:15.440] [LOG]   /dev/serial0>:[22] .93   [RSSI:-68][ACK-sent]
[26/02/11 10:45:15.463] [LOG]   NODEDATA PARTIAL NOMATCH>: .93
[26/02/11 10:45:15.468] [LOG]   post: /home/pi/gateway/data/db/0022_RSSI.bin[1770824715,-68]
[26/02/11 10:45:15.472] [LOG]   NODEDATA PARTIAL NOMATCH>: [RSSI:-68][ACK-sent]
/home/pi/gateway/gateway.js:981
          console.dbupdate(`[${id}] updated`);
                  ^

TypeError: console.dbupdate is not a function
    at /home/pi/gateway/gateway.js:981:19
    at newArguments.<computed> (/home/pi/gateway/node_modules/nedb/lib/executor.js:29:17)
    at /home/pi/gateway/node_modules/nedb/lib/datastore.js:643:18
    at /home/pi/gateway/node_modules/nedb/lib/persistence.js:201:12
    at FSReqCallback.oncomplete (node:fs:180:23)

Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 12, 2026, 11:07:40 AM
That's weird, that should produce a log entry like [DBUPDATE] instead of [LOG]. Essentially it could be anything.
In any case this works on my end. But to get past this you could deplace console.dbupdate with console.log
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 12, 2026, 11:32:35 AM
OK, that was it!  No more restarts.  So hopefully my last question.  What is the EASY way to back up this entire SD card or make a copy of it?  I would like to have a full back up of this so I don't have all this "fun" next time.  If you know of any utilities I would be most thankful.  Appreciate the time you took with me on this.  Hopefully our conversations will help someone else.  By the way, I did not change anything on the MightyHat or the 2 weather nodes or sonar mote, just wanted to throw that out there.  Only the battery in the Mote was replaced.  Man is this nice to have this all back.  Have a great day.  Thanks again.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on February 13, 2026, 08:16:06 AM
That's somewhere in my mile long TODO list for the PiGateway project. A script or some way to back/zip up everything in a single archive that's compact and easy to unpack and replace everything later. But it's probably more involved than it sounds because of dependencies in node.js.

For now the way I do it is just pop out the SD and image it. I use industrial grade SD's though so I have not seen a single SD corruption fail in forever. There is minimal wear because the logs are cyclical and the database is incremental. The OS is probably where most "wear" is. But you can always use an SSD now with Pi+NVME/M.2 hats.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: brasskey4u on February 13, 2026, 08:34:28 AM
Yes, I think just copying the SD card will be the best bet for now.  I'm inspired now to try something else with the other Motenio's I have and get a few more nodes fired up.  Do you have any plans to make some of the back ordered projects again?  I'm guessing you have other irons in the fire now.  So many IoT devices to play with now than years ago.  I have Home Assistant, but have yet to really dive into it.  Seems somewhat clumsy and not very intuitive for my old brain.
Title: Re: Fresh Install of Pi Gateway - nginx problem
Post by: Felix on April 16, 2026, 01:26:24 PM
I do but I get pulled into more meaty projects and I have to prioritize.
Whenever I have some time I try to be consistent with the important LowPowerLab products and support and invest where most interest is shown.