Author Topic: unixtime not showing on graphical display for long numbers  (Read 904 times)

SanG

  • NewMember
  • *
  • Posts: 43
unixtime not showing on graphical display for long numbers
« on: June 17, 2020, 01:56:07 PM »
Hello,

I am trying to read unixtime (e.g. 1592377200) in moteino gateway dashboard. It does show up in node details, however, it does not in the graphical display. Looks like the long numbers are not logged. From a simple test, I found that the maximum number that is logged (and is showing up in the graphical display) is "214748". Note: I am using a long data type for this number. Even a 14-digit number is also displayed in the node details but it is not logged, it says "no log data". I tried a lot of things but no luck yet. I don't know if I am missing something in regexp or it has something to do with the data type or something else. FYI: I am using the following regexp:
Code: [Select]
regexp: /\buTime([\w\.]+)\b/i,
Any help will be appreciated.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: unixtime not showing on graphical display for long numbers
« Reply #1 on: June 17, 2020, 02:55:29 PM »
The logger data part is 4 bytes. But the data point is multiplied by 10K in and divided by 10K coming out, to allow for some decimals. This was put up in the logger comments where the data point format and size is explained.

So logging unix timestamps is not appropriate, too large a number (too large after the 10K multiplication).
But you're logging timestamped timestamps? How does logging unix timestamps make sense? The data points are themselves timestamped.
Anyway, you could log a number that large if you divided it by 10K before you pass it to the logger. Or just send it with 4 decimals. Or divide it by 10K with the metric valuation function:

Code: [Select]
valuation:function(value) { return value/10000 }

FWIW \w will match more than just digits, I would use \d instead, like other examples, for instance weathershield.
« Last Edit: June 17, 2020, 03:16:13 PM by Felix »

SanG

  • NewMember
  • *
  • Posts: 43
Re: unixtime not showing on graphical display for long numbers
« Reply #2 on: June 17, 2020, 03:14:54 PM »
Thank you Felix for your insight. Oh, I forgot to mention that I am working on a project where we are using DS1307 RTC with gateway moteino. This moteino is supposed to control the switching of pumps/valves, to receive nodes data as well as timestamp them based on RTC. We are trying to log all these data including RTC timestamp. This project requires to have timestamp from RTC but not from the one provided by moteino. If we cannot log Unix timestamps, is there a way it can be possible via a different approach?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: unixtime not showing on graphical display for long numbers
« Reply #3 on: June 17, 2020, 03:16:42 PM »
See my updated post, you can manipulate the value after you receive it with the valuation function.

SanG

  • NewMember
  • *
  • Posts: 43
Re: unixtime not showing on graphical display for long numbers
« Reply #4 on: June 17, 2020, 03:42:50 PM »
I will try that. Thank you.