Strange corruption in a metric being displayed.

Started by HeneryH, June 10, 2019, 12:56:51 PM

HeneryH

I added a Dallas Temp sensor onto my Mote that also has the BME.  When I read the values, this is what I get

Note 'Z' is my new test metric.  Note that the screen shots were at slightly different times so the temp has changed over the course of capturing data below.

At the Mote serial port.
BAT:4.86v F:79.61 Z:81.5 H:40.45 P:29.73 (packet length:40)


In the serial console of the Pi
[06-10-19_12:50:08.708] [LOG]    >: [40] BAT:4.86v F:79.61 Z:80.6 H:40.17 P:29.73   [RSSI:-26][ACK-sent]
[06-10-19_12:50:08.712] [LOG]    post: /home/pi/gateway/data/db/0040_V.bin[1560185408,4.86]


But this is what I get in my display:


I've tried varying the number of decimal places but no change.  I've tried jamming a null at the end of the string to make sure it was terminated.

Here is my new metric definition for Z which is an exact copy of 'F' except renamed to 'Z'
exports.metrics = {
  Z : { name:'Z', regexp:/\bZ\:(-?\d+\.\d+)\b/i, value:'', duplicateInterval:3600, unit:'°', pin:1, graph:1, graphValSuff
fix:'Z', graphOptions:{ legendLbl:'Temperature', lines: { lineWidth:1 } }},

};


Any advice?
Thanks

HeneryH

Here are the logs all for the same data point...

Metric "Z" is the new metric I temporarily created to help debug.

From the Serial Port of the Mote
Requesting temperatures...DONE
Temp C: 23.50 Temp F: 74.30
BAT:4.86v F:75.61 Z:74.30 H:49.12 P:29.90 (packet length:41)


From the Gateway Log
[06-12-19_12:13:22.836] [LOG]    >: [40] BAT:4.86v F:75.61 Z:74.30 H:49.12 P:29.90   [RSSI:-27][ACK-sent]
[06-12-19_12:13:22.858] [LOG]    post: /home/pi/gateway/data/db/0040_V.bin[1560356002,4.86]
[06-12-19_12:13:22.864] [LOG]    post: /home/pi/gateway/data/db/0040_F.bin[1560356002,75.61]
[06-12-19_12:13:22.870] [LOG]    post: /home/pi/gateway/data/db/0040_Z.bin[1560356002,74.3]
[06-12-19_12:13:22.873] [LOG]    post: /home/pi/gateway/data/db/0040_H.bin[1560356002,49.12]
[06-12-19_12:13:22.876] [LOG]    post: /home/pi/gateway/data/db/0040_RSSI.bin[1560356002,-27]
[06-12-19_12:13:22.883] [LOG]       [40] DB-Insert new _id:40


But this displays:

HeneryH

#2
Very strange.  When I copy the metric definition from the Github web page metrics file into my user metric file, the corruption extra character formatting shows up.

When I copy the same line from vi on the pi, then it looks OK.

Something about unicode blah blah.  When I get extra time I may look into this further.

https://stackoverflow.com/questions/18065510/getting-a-%C3%82-character-before-the-degree-symbol