Temperatura

Use este formato para enviar leituras de temperatura ambiente em °C.

Faixa e unidade

  • type: "degC"
  • value: -100.0 a 100.0

Campos

  • value: número em graus Celsius.
  • type: sempre "degC".
  • timestamp: data/hora em ISO 8601 (UTC recomendado).
  • location: { "type": "point", "value": [lon, lat] }.
  • description (opcional): contexto da leitura.

Exemplo de payload

{
  "temperature": {
    "value": 18.6,
    "type": "degC",
    "description": "Sensor interno próximo à porta",
    "location": {
      "type": "point",
      "value": [-46.7225, -23.5612]
    },
    "timestamp": "2025-12-18T12:15:00Z"
  }
}

Exemplo rápido em Python (requests)

import os
import requests, datetime

API_BASE = os.environ["NEXT_PUBLIC_API_BASE_URL"]
TOKEN = "SEU_TOKEN_DO_DISPOSITIVO"

payload = {
    "temperature": {
        "value": 18.6,
        "type": "degC",
        "description": "Sensor interno próximo à porta",
        "location": {"type": "point", "value": [-46.7225, -23.5612]},
        "timestamp": datetime.datetime.now(datetime.timezone.utc).isoformat(),
    }
}

requests.post(
    f"{API_BASE}/v1/secure/measures",
    headers={"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"},
    json=payload,
    timeout=10,
)

Leituras fora da faixa -100.0 a 100.0 são rejeitadas pela API.