fablabbcn / smartcitizen-api

The Smart Citizen Engine
https://developer.smartcitizen.me
GNU Affero General Public License v3.0
10 stars 4 forks source link

Device `hardware_info` not populated at start #314

Closed oscgonfer closed 2 weeks ago

oscgonfer commented 3 months ago

So, I have configured a device a couple of times following the onboarding process, and I have noticed that the device hardware has not been populated as expected.

The Device is https://api.smartcitizen.me/v0/devices/17198

Below are the payloads we received via MQTT (first one is, hello, second one is hardware_info):

<token>:Hello
{"time":"2024-03-26T07:51:17Z","hw_ver":"2.1","id":"6E96FA155055344E312E3120FF0D0A2B","sam_ver":"0.9.8-34e2324-dev","sam_bd":"2024-03-12T16:34:53Z","mac":"XXXX","esp_ver":"0.9.8-34e2324-dev","esp_bd":"2024-03-12T16:34:59Z","rcause":"SYST"}
{t:2024-03-26T07:51:18Z,10:8,221:1,220:-56,14:0,55:25.88,56:46.38,53:65.52,58:96.89,113:0.00,112:400.00,89:0,87:0,88:0,165:86,166:56,167:0,168:0,169:0,170:0}
{t:2024-03-26T07:52:18Z,10:7,221:1,14:0,55:25.92,56:46.23,53:55.46,58:96.90,113:0.00,112:403.00}

And in the endpoint we can see (when I wrote the issue) that the device has no hardware:

    "created_at": "2024-03-26T07:55:23Z",
    "data": {},
    "description": "Smart Citizen Kit",
    "device_token": "token",
    "hardware": {
        "last_status_message": null,
        "name": "Unknown",
        "slug": "unknown",
        "type": "Unknown",
        "version": null
    },
    "id": 17198,
...
}

I assume that the last_status_message got in before the device was created?

This results in: https://smartcitizen.me/kits/17198

imagen

timcowlishaw commented 2 weeks ago

Fixed!