Add batch readings ingestion endpoint for sensor firmware v3 #201
Openamara-osei wants to merge 2 commits into main from feat/batch-readings-ingest· opened yesterday
+44−3
amara-osei commented yesterdayAuthor
What
Firmware v3 buffers readings while a sensor is offline and uploads them in one request when it
reconnects. This adds POST /devices/{device_id}/readings that accepts a batch and stores every reading.
Notes
Devices authenticate with their X-Device-Token header through the existing get_current_device dependency.
Firmware v3 treats 202 Accepted as success; anything else is retried with the same batch.
Range checks on temperature/humidity/battery match the sensor datasheet.
Testing
Posted a 50 reading batch from the simulator, got a response with accepted: 50.
What
Firmware v3 buffers readings while a sensor is offline and uploads them in one request when it reconnects. This adds
POST /devices/{device_id}/readingsthat accepts a batch and stores every reading.Notes
X-Device-Tokenheader through the existingget_current_devicedependency.202 Acceptedas success; anything else is retried with the same batch.Testing
Posted a 50 reading batch from the simulator, got a response with
accepted: 50.Closes #412