Author Topic: PiGateway v9.1.0 Released  (Read 7857 times)

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6531
  • Country: us
    • LowPowerLab
Re: PiGateway v9.1.0 Released
« Reply #15 on: April 28, 2020, 12:04:58 PM »
The app itself doesnt (currently) know what ID the gateway is, and maybe it should not, it's not its job to have too much knowledge about the RF gateway.
I could implement a fix but it would really have to go in the RF gateway sketch not in the app itself (ie to check if the ID==self, then dont send anything anywhere).
OR we just need to know that for gateway query-ing there is no ID (sorry if this is non obvious).

So for now dont type a node number, the node ID is only for when the destination is NON gateway. If you type 1 the RF gateway will send a packet "UPTIME" to node ID=1 which is itself, so it will never get a response. Its a bit of a LOL right?

The takeaway for now is just type UPTIME in the message when you want to query the gateway.

sparky

  • Sr. Member
  • ****
  • Posts: 293
  • Country: us
Re: PiGateway v9.1.0 Released
« Reply #16 on: April 28, 2020, 05:44:34 PM »
Felix,

Thanks!

Also, just a reminder, the commit you posted to add radiothermostat to the settings file has not been added to the latest code.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6531
  • Country: us
    • LowPowerLab
Re: PiGateway v9.1.0 Released
« Reply #17 on: April 28, 2020, 10:19:10 PM »
Also, just a reminder, the commit you posted to add radiothermostat to the settings file has not been added to the latest code.
Is is in the latest code, just not in the latest release (9.0). To get it, it has to be done either manually, or installing "latest available code" in the setup script.
As I build a list of more fixes I will make a new minor release.

sparky

  • Sr. Member
  • ****
  • Posts: 293
  • Country: us
Re: PiGateway v9.1.0 Released
« Reply #18 on: April 29, 2020, 07:05:42 AM »
Is is in the latest code, just not in the latest release (9.0). To get it, it has to be done either manually, or installing "latest available code" in the setup script.
As I build a list of more fixes I will make a new minor release.

Little confused by your response but no biggie..  All I can say is that yesterday when I sent that response I had just finished re-installing the "latest code" and I had to manually change the setting.json5 file.  If this is what you meant we are good.

If you look here the file has been changed;
https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/settings.json5

But if you look here the file is not changed;
https://github.com/LowPowerLab/RaspberryPi-Gateway/releases/tag/9.1.0

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6531
  • Country: us
    • LowPowerLab
Re: PiGateway v9.1.0 Released
« Reply #19 on: April 30, 2020, 11:23:32 AM »
Clarification: A release is a snapshot of the codebase at that point in time.
The setup script allows you to install the latest release (9.1 snapshot), or the latest available code. Two different things.
I hope that is more clear now.

ssmall

  • Full Member
  • ***
  • Posts: 148
  • Country: us
Re: PiGateway v9.1.0 Released
« Reply #20 on: May 02, 2020, 06:48:08 PM »
I have looked into modifying things to try and get the Garage: Auto Close to work again.  I think I'm on the right track but I have a question.

@Felix is there a way to retrieve a node from the DB and allow the node to exist beyond the scope of the function defined in the  db.findOne call?

Example:

db.findOne({ _id : nodeAtScheduleTime._id }, function (err, nodeRightNow) {

  code to modify nodeRightNow

  return nodeRightNow;
});

Thanks

ssmall

  • Full Member
  • ***
  • Posts: 148
  • Country: us
Re: PiGateway v9.1.0 Released
« Reply #21 on: May 03, 2020, 07:33:08 PM »
Nevermind. I have Garage: Auto Close working again. I am testing out the changes. I will create a PR when I'm done testing.

Cam

  • NewMember
  • *
  • Posts: 2
Re: PiGateway v9.1.0 Released
« Reply #22 on: May 17, 2020, 06:33:46 PM »
I have several virtual nodes that send data to the gateway via a GET request similar to this: https://raspberrypi/httpendpoint/?id=1234&MOTION&F=77.77

Here is an example of a python script that just sends the temperature, the relevant code is:
Code: [Select]
requests.get('https://%s/httpendpoint/?id=%s&F=%s' % (gateway_ip, device_id, temperature), verify=False, auth=(username, password))
These all worked well on 9.0, but has been very inconsistent with many values not being recorded on 9.1.

It appears that every time a GET request is sent (every 5 minutes), the gateway is disconnected, app reboots, and I get the following message in the browser before it reconnects: "App server was disconnected. Waiting for new connection..."

The log looks like this:
Quote
[05-17-20 18:12:21.674] [LOG]    post: /home/pi/gateway/data/db/0120_F.bin [1589753541,76.55]
/home/pi/gateway/gateway.js:1142
          db.update({ _id: id }, { $set : entry}, {}, function (err, numReplaced) { console.info(`[${id}] DB-Updated: httpEndPointHandler(${queryString}):entry=${JSON.stringify(entry)}`) });
                                                                                                                                            ^
TypeError: Cannot convert object to primitive value
    at /home/pi/gateway/gateway.js:1142:141
    at newArguments.(anonymous function) (/home/pi/gateway/node_modules/nedb/lib/executor.js:29:17)
    at /home/pi/gateway/node_modules/nedb/lib/datastore.js:642:18
    at /home/pi/gateway/node_modules/nedb/lib/persistence.js:201:12
    at FSReqCallback.args [as oncomplete] (fs.js:145:20)
[05-17-20 18:12:25.968] [INFO]   *********************************************************************
[05-17-20 18:12:25.977] [INFO]   ************************* GATEWAY APP START *************************
[05-17-20 18:12:25.978] [INFO]   *********************************************************************

Anyone have ideas why the TypeError and app reboot is happening or how to further investigate it?

Thanks.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6531
  • Country: us
    • LowPowerLab
Re: PiGateway v9.1.0 Released
« Reply #23 on: May 18, 2020, 02:47:52 PM »
Cam,
I submitted a fix, please replace your gateway.js and this should take care of it.
« Last Edit: May 18, 2020, 03:29:44 PM by Felix »

Cam

  • NewMember
  • *
  • Posts: 2
Re: PiGateway v9.1.0 Released
« Reply #24 on: May 18, 2020, 09:26:02 PM »
That did it - it works great now. Thanks!

sparky

  • Sr. Member
  • ****
  • Posts: 293
  • Country: us
Re: PiGateway v9.1.0 Released
« Reply #25 on: June 01, 2020, 09:51:13 AM »
Felix,

Now thats its sprinkler season I ran into an issue where my programs stop well before the 61 bytes max string length.  After noticing the issue I tried your IOShield example, specifically the "Run Z1-8 5min", and the program stopped after completing zone 3.

This issue just started with the new version of your PiGateway, V9.1.0

Thanks! 

Edit:

Below is all that was in the log regarding this issue.  Note that although zone #1 came on when I ran "Run Z1-8 5min" it just didn't show up as running in the UI nor did it show up in the log.

Code: [Select]
[06-01-20 12:46:09.295] [LOG]    /dev/ttyUSB0>:[2] ZONE:2 SS:-68
[06-01-20 12:46:09.299] [LOG]    post: /home/pi/gateway/data/db/0002_ZONE.bin[1591029969,2]
[06-01-20 12:46:09.301] [LOG]    post: /home/pi/gateway/data/db/0002_RSSI.bin[1591029969,-68]
[06-01-20 12:46:09.306] [INFO]   [2] DB-Updated: processSerialData('[2] ZONE:2 SS:-68\r',undefined):entry={"_id":2,"updated":1591029969299,"type":"SprinklerMote","label":"Sprinkler Controller","descr":"[2]","metrics":{"START":{"label":"START","value":"Started","updated":1591011355564},"RSSI":{"label":"RSSI","value":-68,"unit":"db","updated":1591029969299,"graph":1,"pin":0},"ZONE":{"label":"ZONE","value":2,"updated":1591029969299,"pin":1589654523313,"graph":1}}}

[06-01-20 12:51:09.242] [LOG]    /dev/ttyUSB0>:[2] ZONE:3 SS:-68
[06-01-20 12:51:09.246] [LOG]    post: /home/pi/gateway/data/db/0002_ZONE.bin[1591030269,3]
[06-01-20 12:51:09.248] [LOG]    post: /home/pi/gateway/data/db/0002_RSSI.bin[1591030269,-68]
[06-01-20 12:51:09.253] [INFO]   [2] DB-Updated: processSerialData('[2] ZONE:3 SS:-68\r',undefined):entry={"_id":2,"updated":1591030269245,"type":"SprinklerMote","label":"Sprinkler Controller","descr":"[2]","metrics":{"START":{"label":"START","value":"Started","updated":1591011355564},"RSSI":{"label":"RSSI","value":-68,"unit":"db","updated":1591030269245,"graph":1,"pin":0},"ZONE":{"label":"ZONE","value":3,"updated":1591030269245,"pin":1589654523313,"graph":1}}}

[06-01-20 12:56:09.178] [LOG]    /dev/ttyUSB0>:[2] ZONES:OFF SS:-69
[06-01-20 12:56:09.183] [LOG]    post: /home/pi/gateway/data/db/0002_ZONE.bin[1591030569,0]
[06-01-20 12:56:09.184] [LOG]    post: /home/pi/gateway/data/db/0002_RSSI.bin[1591030569,-69]
[06-01-20 12:56:09.190] [INFO]   [2] DB-Updated: processSerialData('[2] ZONES:OFF SS:-69\r',undefined):entry={"_id":2,"updated":1591030569182,"type":"SprinklerMote","label":"Sprinkler Controller","descr":"[2]","metrics":{"START":{"label":"START","value":"Started","updated":1591011355564},"RSSI":{"label":"RSSI","value":-69,"unit":"db","updated":1591030569182,"graph":1,"pin":0},"ZONE":{"label":"ZONE","value":"OFF","updated":1591030569182,"pin":1589654523313,"graph":1}}}
« Last Edit: June 01, 2020, 01:28:25 PM by sparky »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6531
  • Country: us
    • LowPowerLab
Re: PiGateway v9.1.0 Released
« Reply #26 on: June 02, 2020, 08:08:20 AM »
Hi sparky,
I can't be sure why it would not show Z1 running. That sounds like the sprinkler mote packet never made it to the gateway.
For the rest of it, I will need to see your sprinkler event string that you send for the entire 8 zone.
A 9 zone should be accomodated within 57 chars, ex: PRG 1:300 2:300 3:300 4:300 5:300 6:300 7:300 8:300 9:300
Any way you could add some debug code to your sprinkler mote and see what it actually receives? Is it a truncated string?

sparky

  • Sr. Member
  • ****
  • Posts: 293
  • Country: us
Re: PiGateway v9.1.0 Released
« Reply #27 on: June 02, 2020, 10:46:38 AM »
Quote
I can't be sure why it would not show Z1 running. That sounds like the sprinkler mote packet never made it to the gateway.

It's weird, it doesn't do it all the time but in the example I posted was one of the times


Quote
For the rest of it, I will need to see your sprinkler event string that you send for the entire 8 zone.
A 9 zone should be accomodated within 57 chars, ex: PRG 1:300 2:300 3:300 4:300 5:300 6:300 7:300 8:300 9:300

This particular event string of mine stopped after completing Z12;

Code: [Select]
MP : { states: [{ label:'Run Street', action:'PRG 10:600 12:600 13:600'}]},

and this one from your IOShield example stopped after completing Z3;

Code: [Select]
MN : { states: [{ label:'Run Z1-8 5min', action:'PRG 1:300 2:300 3:300 4:200 5:300 5:300 6:300 7:300 8:300'}]},

Quote
Any way you could add some debug code to your sprinkler mote and see what it actually receives? Is it a truncated string?

I'm not experienced enough to do this, don't even know where to start..  :-X

I was hoping you fired up your sprinklers and ran into the same issue.  ;D  Other than the new Gateway ver,  everything is the same code wise.  Let me know if you need any more info. Thank you!

ssmall

  • Full Member
  • ***
  • Posts: 148
  • Country: us
Re: PiGateway v9.1.0 Released
« Reply #28 on: June 02, 2020, 08:39:07 PM »
I am seeing the same issue.

Here is the string defined in the action that should be sent by the gateway:
PRG 1:900 2:1350 3:900 4:1800 5:1800 6:1050

This the string received by the mote:
PRG 1:900 2:1350 3:90

If I use the PiGateway_Basic sketch the string is not truncated and all zones are extracted.
« Last Edit: June 03, 2020, 01:07:55 PM by ssmall »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6531
  • Country: us
    • LowPowerLab
Re: PiGateway v9.1.0 Released
« Reply #29 on: June 03, 2020, 07:40:20 PM »
Will need to look into this. When I turn my sprinklers and it fails?  ;D
If someone else wants to do more debugging that would be great.