One node gets data from another [solved]

Started by Lensdigital, February 04, 2016, 09:46:25 AM

Lensdigital

I just started to see this weird issue, when status from one node gets picked up by another one randomly...
For example I have "Bedroom" sensor that only transmits temperature/humidity. Not every time but occasionally it pickes up status from Mailbox which is completely different NODE ID...

// Weather sensor
FH : { name:'FH', regexp:/FH\:(-?\d+)/i, value:'', valuation:function(value) {return value/100;}, unit:'°', pin:1, graph:1, graphValSuffix:'F', graphOptions:{ legendLbl:'Temperature' }},
  F : { name:'F', regexp:/F\:(-?\d+)/i, value:'', unit:'F°', pin:1, graph:1, graphValSuffix:'F', graphOptions:{ legendLbl:'Temperature' }},
  C : { name:'C', regexp:/C\:([-\d\.]+)/i, value:'', unit:'C°', pin:1, graph:1, graphValSuffix:'C', graphOptions:{ legendLbl:'Temperature' }},
  H : { name:'H', regexp:/H\:([\d\.]+)/i, value:'', unit:'%', pin:1, graph:1, graphOptions:{ legendLbl:'Humidity'}},
  P : { name:'P', regexp:/P\:([\d\.]+)/i, value:'', unit:'"', pin:1, },
// Mailbox
MBox_closed : { name:'MBox', regexp:/MBOX\:C/i, value:'CLOSED', pin:1, graph:1, logValue:1, graphOptions:{ legendLbl:'Mailbox', lines: { show:false, fill:false }, points: { show: true, radius: 5, lineWidth:1 }, grid: { backgroundColor: {colors:['#000', '#03c', '#08c']}}, yaxis: { ticks: 0 }}},

Felix

This won't happen unless you somehow mix the IDs, which you say you did not.
But I want to see the actual serial messages coming to gateway.js from your Pi gateway moteino.
Go dig the logs for the serial message that created that unwanted "CLOSED" on your bedroom, something like this:

[timestamp when this happened] [LOG]   >: [id of bedroom?] MBOX:C

Lensdigital

Quote from: Felix on February 04, 2016, 11:44:09 AM
Go dig the logs for the serial message that created that unwanted "CLOSED" on your bedroom, something like this:

[timestamp when this happened] [LOG]   >: [id of bedroom?] MBOX:C
Great idea! I lost logs after restarted gateway, but I'll check it next time this happens.

Felix

Quote from: Lensdigital on February 04, 2016, 05:19:37 PM
Great idea! I lost logs after restarted gateway, but I'll check it next time this happens.
Not sure how logs could get lost without your intervention, that was never a bug that I know of.
But I would encourage you to upgrade to the latest gateway app sources.

Lensdigital

#4
Quote from: Felix on February 04, 2016, 07:08:50 PM
Quote from: Lensdigital on February 04, 2016, 05:19:37 PM
Great idea! I lost logs after restarted gateway, but I'll check it next time this happens.
Not sure how logs could get lost without your intervention, that was never a bug that I know of.
But I would encourage you to upgrade to the latest gateway app sources.
My bad. I assumed log gets rewrite after restart because "grep" didn't return anything. It's just grep in Raspbian is so different from other Linux/Unix flavors I used to... Without specify -a it doesn't show any results (i.e. grep Mbox gateway.sys.log) . I need to figure out how to use it :)
Anyway I see that it does matches wrong SENDER ID and I suspect it's a bug in my gateway sketch.  I store SenderID in variable, and it seems when two pockets from different nodes come almost at the same time, buffer and SenderID get intermixed. So yea it's problem in my code :)  I can tell by RSSI also that it didn't come from Mailbox...
[02-03-16_20:56:00.547] [LOG]   >: [11] MBOX:C BAT:2.83   [RSSI:-67]
[02-04-16_15:12:14.021] [LOG]   >: [91] MBOX:O BAT:2.92   [RSSI:-86]

I think I might need to clear buffer each time...
memset(buffer, 0, sizeof(buffer));