Hello everyone,
I'm building a low data IoT device, it calls an API around 100 times a day. A single API call consumes around 500 bytes
(see details on how I measured this below). My expectation is that the daily consumption (in KB) is 500 bytes * 100 / 1024 = ~49KB
for 100 API calls.
To my surprise, after one day of testing, the device used around 1.5MB-2MB
. This is way too much compared to my expectation. My device uses a SIM card so I really have to keep the data usage as low as possible.
I'm suspecting the m5stack firmware is sending some telemetry by default. This makes sense because when I look at UiFlow 2.0, and I click on available devices, I can see that UiFlow know if the device is Online or not. That means at least there is some keepalive call is being done to M5Stack servers for this.
Then I created a simple application that just connects to the WiFi router and just blinks the RGB LED, without any WiFi or internet access, and after some time (few minutes) I see data being used, 30KBs.
Questions
Has anyone else seen this same issue?
And do you know what's the best way to handle it?
Details on how I measured my API usage:
I measured my API call data usage using CURL and a few options to extract the data usage and request/response trace, and the call is around 500 bytes
curl -X POST "http://0.0.0.0:8000/api/example” -H "Authorization: Bearer MY_API_KEY" --write-out "\nSize of response body: %{size_download} bytes\nSize of request body: %{size_upload} bytes\n" --trace curl_trace.log -o /dev/null \ -s
Output:
Size of response: 16 bytes
Size of request: 0 bytes
From the curl_trace.log file the total size estimate:
* Request headers: 174 bytes
* Response headers: 317 bytes
* Response body: 16 bytes
* Thus, the total size for the transaction is:
174 + 317 + 16 = 507 bytes
Device: Atom S3 Lite
Firmware: v2.1.3-ATOMS3-LITE
Language: MicroPython
Thanks,
Carlos