PiGateway v9.1.0 Released

Started by Felix, April 19, 2020, 09:45:11 PM

ssmall

It looks like the PiGateway.ino has been modified in the last few days, so it differs from my version which is older.  However, I think the issue is still the same.
The dataPartvariable[MAX_BUFFER_LENGTH] declared in the processCommand method is too small to hold sprinkler strings.  MAX_BUFFER_LENGTH is defined at 25 in my sketch.  sprinkler strings are typically longer than that.

    targetId = atoi(dataPart);       // attempt to extract nodeID part
    ptr = strtok(NULL, "");          // get command part to the end of the string
    sprintf(dataPart, "%s", ptr);

The dataPart string in the sprintf is too small to handle the sprinkler string.

Felix

Good catch, it's fixed, get latest, retry and let me know if all is good.

sparky

All is good.

Just completed 3 zones without it stopping.

Thanks to both of you!!

ssmall

I would like to report a bug in the PiGateway.  When an active scheduled event is deleted via the web interface the event is removed but it appears that the event is still scheduled and still runs after the event is removed.  The following error occurs:

/home/pi/gateway/gateway.js:1195
  node.events[eventKey].executeDateTime = new Date(Date.now() + nextRunTimeout); //actual datetime when this is scheduled to execute
                                        ^

TypeError: Cannot set property 'executeDateTime' of undefined
    at global.schedule (/home/pi/gateway/gateway.js:1195:41)
    at /home/pi/gateway/gateway.js:1230:5
    at newArguments.(anonymous function) (/home/pi/gateway/node_modules/nedb/lib/executor.js:29:17)
    at Cursor.execFn (/home/pi/gateway/node_modules/nedb/lib/datastore.js:518:14)
    at callback (/home/pi/gateway/node_modules/nedb/lib/cursor.js:126:19)
    at /home/pi/gateway/node_modules/nedb/lib/cursor.js:193:12
    at /home/pi/gateway/node_modules/nedb/lib/datastore.js:329:14
    at Object.async.eachSeries (/home/pi/gateway/node_modules/nedb/node_modules/async/lib/async.js:130:20)
    at /home/pi/gateway/node_modules/nedb/lib/datastore.js:323:11
    at fn (/home/pi/gateway/node_modules/nedb/node_modules/async/lib/async.js:582:34)

This error does not happen if the scheduled event is first disabled and then deleted.
It happens on a given node's page that has a scheduled event setup for the node.  The event has to be active, then delete the event.

Felix

Thanks, I will look into it when I have a chance.

ssmall

I tried sending a request to one of my nodes to see if I could see the request in the ack using the new Gateway.ino sketch.  It wasn't working so I looked in the gateway logs and I am seeing the following:

[10-13-20 17:18:34.170] [INFO]   REQUEST SENT: REQUESTQUEUE:3:PGM\n
[10-13-20 17:18:34.170] [INFO]      [3] Added request:PGM
[10-13-20 17:18:34.174] [INFO]   SUBMITNODEREQUEST DB-Replaced:1
[10-13-20 17:18:34.355] [LOG]    /dev/ttyAMA0>:[0] 3:PGM:INV:ID-OUT-OF-RANGE
[10-13-20 17:18:34.356] [LOG]    NODEDATA PARTIAL NOMATCH>: 3:PGM:INV:ID-OUT-OF-RANGE

It looks like the Gateway sketch is having an issue parsing the nodeId

jamacaulay

Am having trouble of late getting a new install working.  I've tried multiple versions of the raspberry pi O/S, different SD cards, even different pi's, and it gets stuck on "Waiting for socket connection..."  I have documented all my specific steps from last time I did a fresh install and worked.  One thing I noticed this time is errors in the output I don't believe I have ever seen before.  I will attach the session output here if anyone wouldn't mind having a look.  Thanks in advance.

Felix

The log you show shows nodeJs errors out while trying to build nodeserialport.
Are you using the latest Pi distribution and gatewaysetup.sh?

jamacaulay

Am running the commands based on your guide and as below.  I assume these would grab the latest?

sudo wget https://raw.githubusercontent.com/LowPowerLab/RaspberryPi-Gateway/master/.setup/gatewaysetup.sh
sudo bash gatewaysetup.sh && sudo rm gatewaysetup.sh

Have tried 3 different Pi OS versions:  2020-08-20, 2020-05-27 (buster lite) and 2019-04-08 (stretch lite).

Felix

Yes thats latest, and was tested on the buster 8-20 image, works.
What Pi do you have?

jamacaulay

I tested a Pi Zero and a 2B.  Same results for both.

Felix


jamacaulay

Brand spanking new Pi 4 purchased.  Same result.  Waiting for socket connection..

Any advice would be appreciated.

jamacaulay

Attaching the session output from the latest install on the Pi4 on the latest release of OS Lite.  There are errors in the output that I don't think were there before I started experiencing problems.

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:329:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Linux 5.4.51-v7l+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/gateway/node_modules/@serialport/bindings
gyp ERR! node -v v15.2.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @serialport/[email protected] install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @serialport/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Felix

serialnode fails to build. What is the command you use to start the PiGateway setup process?
I just tested on a Pi3B+ again again, and its smooth as silk, no errors, GUI boots right up, empty node list as you'd expect.
BUT i think the problem might be you're loading the [recommended] latest stable release instead of the latest available code, please try that instead.
I should make a new release...

EDIT: I made a new release now 9.2.0 so pulling either HEAD or latest release should be good now.