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.

Closes #412

amara-osei added 2 commits yesterday
Add ReadingIn/ReadingBatch schemas19439fb
Add batch ingestion endpoint18439e2

Review required

Review the changes, then submit to get graded.

Some checks haven’t completed yet

1 check: dojo / review-grader

Keyboard shortcuts

Site-wide

Focus the search bar
/
Show this dialog
?

Pull request

Move to the next file
j
Move to the previous file
k
Filter changed files
t
Comment on the selected lines
c
Select a range of lines
Shiftclick