Before writing device code
Write down five decisions before opening the firmware project:
The transport is only one part of the job. Identity, timestamp behaviour, units, buffering and credential ownership determine whether the data remains useful after the pilot.
Write down five decisions before opening the firmware project:
A reading needs a value and a reliable relationship to time. Add context only when it changes the interpretation, such as location, operating mode or quality state.
{
"temperature": {
"value": 27.4,
"timestamp": 1721456400000,
"context": { "unit": "degC", "quality": "good" }
}
}Use device time only when the device clock is maintained. If the network or platform assigns time, document that choice so delayed packets are not mistaken for current measurements.
The legacy device API uses a token supplied with the request. The current token and base URL come from the authenticated portal or project onboarding record. Do not embed example credentials from documentation in firmware.
X-Auth-Token: {PROJECT_TOKEN}
Content-Type: application/jsonUse separate credentials for development and production. Record which product batch or gateway owns each credential.
HTTPS suits devices that wake, send a bounded payload and disconnect. It is also the simplest commissioning path because requests and responses can be inspected directly.
POST {BASE_URL}/api/v1.0/update-Device
X-Auth-Token: {PROJECT_TOKEN}
Content-Type: application/json
{"temperature": 27.4, "pressure": 5.2}The exact production endpoint must be confirmed against the project environment before firmware release. The legacy documentation contains multiple historical URL forms and should not be treated as a release specification.
MQTT suits long-lived sessions, constrained links and publish/subscribe workflows. Choose the quality-of-service level from the consequence of duplication or loss, not from a preference for the highest number.
Use when the next reading makes an occasional lost packet irrelevant.
Use when delivery matters and the consumer can tolerate or remove duplicates.
Use only when exactly-once handling justifies the extra protocol work.
Use 30 minutes to test the fit around one product and one blocked decision. If there is a fit, we will outline the two-week Product Blueprint.