Populate the meta in location history API through nRFCloud

Hey everyone!

We're making use of nRFCloud on our nRF9160-based system.
I'm trying to populate the meta in the location history API.

The response is always empty, like this:

{
    "deviceId": "nrf-352656101081837",
    "serviceType": "GPS",
    "insertedAt": "2022-12-06T13:35:20.785Z",
    "uncertainty": "24.000000",
    "lat": "68.000000",
    "lon": "17.000000",
    "meta": {}
}
I'm sending the data like this, as shown by the list messages API
{
    "topic": "prod/XX/XX",
    "deviceId": "nrf-XX",
    "receivedAt": "2022-12-06T09:27:13.804Z",
    "message": {
        "messageType": "DATA",
        "data": {
            "acc": 24.000000,
            "lng": 17.000000,
            "lat": 68.000000,
            "meta": {
                "bat": 4167
            }
        }
        "appId": "GNSS"
    },
    "tenantId": "XX"
}
As you see, I'm trying to pack the battery level in the same message, and I want to retrieve this data along with the location when using the location history API. 
The actual message I encode and send is as such:
{"appId": "GNSS","messageType": "DATA", "data": {"lng": 17.000000.,"lat": 68.000000,"acc": 24.000000, "meta":{"bat":4363}}}
My question is: How can I pack this battery data in the location history meta?
Thank you all for all and any suggestions!
Kind regards,
Torje
Parents
  • Hi, 

    The issue is with the formatting of the message data. Put the "bat" property inline like this:

    {
        "topic": "prod/XX/XX",
        "deviceId": "nrf-XX",
        "receivedAt": "2022-12-06T09:27:13.804Z",
        "message": {
            "messageType": "DATA",
            "data": {
                "acc": 24.000000,
                "lng": 17.000000,
                "lat": 68.000000,
                "bat": 4167
            }
            "appId": "GNSS"
        },
        "tenantId": "XX"
    }

    Regards,
    Amanda H.

  • Hello Amanda,

    And thank you for replying.

    I have tried this as well, shown by the message API as such:

            {
                "topic""prod/xx/xx",
                "deviceId""nrf-xx",
                "receivedAt""2022-12-07T11:37:56.846Z",
                "message": {
                    "messageType""DATA",
                    "data": {
                        "acc": 10.000000,
                        "lng"17.000000,
                        "bat"4171,
                        "lat"68.000000
                    },
                    "appId""GNSS"
                },
                "tenantId""xx"
            },
    This gives the following when calling the location history API:
            {
                "deviceId""nrf-xx",
                "serviceType""GPS",
                "insertedAt""2022-12-07T11:37:57.015Z",
                "uncertainty""10.000000",
                "lat""68.000000",
                "lon""17.000000",
                "meta": {}
            },
    Still missing the battery information. If you have any other suggestions, they are very welcomed!
    Thanks again
    Kind regards,
    Torje
  • Update: I also tried to fill the battery data as "alt", as per the schema, to see if they arrived. The meta-field is still empty from location history API

Reply Children
  • Hi Torje,

    My name is Cole, I'm a backend engineer working on nRF Cloud. I am investigating this issue and unclear how it could be happening. You should be seeing the bat property being saved to the meta field by simply including it in the main payload, as stated above.

    I cannot reproduce the issue using the data provided. Will you please send me your device id and team id in a direct message? I would like to look into the data. 

    Best regards,

    Cole

Related