Get timestamp from the JSON payload

BERNARD Thomas 166 Reputation points
2022-02-01T09:13:50.957+00:00

Is it possible the override the timestamp of the telemetry payload ?

When I check raw data from my device in IOT Central application, I see 2 timestamp:

  • The first (timestamp) is provided by my device on its telemetry payload, but it is not used by the application
  • The second (_timestamp) is automatically added by the IOT Central application (I think this is the data reception timestamp)

170107-image.png

I want to use only my device's timestamp in the application, because this is the only real accurate value.

Is there anybody who know how to do that ?

Thanks in advance for the help !

Thomas

Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
368 questions
{count} votes

Accepted answer
  1. Roman Kiss 2,246 Reputation points
    2022-02-07T11:04:12.57+00:00

    Hi Thomas,

    The following is my example for sending a telemetry data (using the current protocol MQTT version 3.1.1) to the IoT Central App:

    device3, modelId=dtmi:com:example:TemperatureController;2
    topic:

    devices/device3/messages/events/$.ct=application%2Fjson&$.ce=utf-8&iothub-creation-time-utc=2022-02-07T09:29:05.681Z  
    

    payload:

    {  
      "workingSet":38.36  
    }  
    

    IoT Central App, Raw data:

    171901-image.png

    Thanks
    Roman

    4 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Marco Parenzan 0 Reputation points
    2023-07-18T09:14:34.1533333+00:00

    Hello everyone.

    Today I have found this interesting thread, I have this issue.

    I have the _eventcreationtime in my Device.

    But when I need to export the message with DataExport, the _eventcreationtime is missing from any input message in the data transformation task.

    {
        "applicationId": "93788c9e-c8de-4068-9bf0-aca8f3e8d326",
        "enqueuedTime": "1903-08-20T14:02:24.939918961Z",
        "messageSource": "telemetry",
        "telemetry": [],
        "device": {
            "id": "p31quw9z6b6z",
            "name": "wireless firewall",
            "templateId": "dtmi:qlayblehl:mtaifsjhnm",
            "templateName": "sentryv3analytics",
            "properties": {
                "reported": []
            },
            "cloudProperties": [],
            "simulated": true,
            "approved": false,
            "blocked": false,
            "provisioned": true,
            "organizations": [
                "leaf-organization"
            ],
            "organizationPaths": [
                [
                    {
                        "id": "root-organization",
                        "displayName": "Root Organization"
                    },
                    {
                        "id": "leaf-organization",
                        "displayName": "Leaf Organization"
                    }
                ]
            ]
        }
    }
    

    In that way, outside IoT Central, this information is not available.

    Any idea?

    Thanks in advance.

    Marco Parenzan


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.