node-red-contrib-smartthings icon indicating copy to clipboard operation
node-red-contrib-smartthings copied to clipboard

Timestamp in payload

Open sdalu opened this issue 3 years ago • 2 comments
trafficstars

Returned data in the payload doesn't contains the timestamp of the measurement, which information by looking at the raw data (of the status node) seems to be available.

It would be useful to have it available in standard node, so data can be collected and stored in a database with the timestamp of the measurement instead of the timestamp of the database insertion time.

I guess new payload would looks like:

{
  "topic": "update",
  "payload": {
    "deviceId": "85272aa2-78db-4e80-8585-849469710190",
    "deviceType": "contact",
    "name": "Door watcher",
    "timestamp": "2022-06-08T22:42:02.606Z",
    "value": 0
  },
  "_msgid": "e6809b7c800f5a87"
}

sdalu avatar Jun 09 '22 17:06 sdalu

@otaviojr I see that you have started to add some timestamp. But it seems you are generating it using new Date().toISOString(). As a timestamp appear in the status node (as for example: status.components.main.contactSensor.contact.timestamp) I thought it was provided by the smartthing callback. That's the one provided by smartthing that would be useful. If none are provided by smartthings, I'm sorry to have open this issue.

sdalu avatar Jun 09 '22 20:06 sdalu

Yep, for now, my problem is that only the status appears to have the timestamp. The event Smartthings send to us via webhook doesn't. I will get a better look into it.

Regards

otaviojr avatar Jun 09 '22 20:06 otaviojr