Traducido del English por IA ·
Brian tiene razón, y además te falta el prefijo de la organización. Monté casi lo mismo para una cámara de refrigeración el año pasado.1. API Keys (Developer menu) > New API Key. En Module permissions dale solo telemetría de lectura, nada más. Configura una lista blanca de IP con la dirección de la oficina y anota la caducidad: por defecto son 90 días, un año como máximo. Pon un recordatorio en el calendario, el nuestro caducó un sábado.2. Todas las rutas de gestión cuelgan del tenant:
GET https://<host>/tenant/<tenantId>/api/telemetry/latest?kind=iot_device&entityId=<deviceId>&keys=level_pct
Authorization: Bearer sk_live_...
La respuesta tiene este aspecto: {«latest»: {«level_pct»: {«ts»: …, «value»: 91.2}}}. Compara el ts con el anterior para no hacer sonar el zumbador dos veces con la misma lectura.3. Gestiona el 429 y espera los segundos de Retry-After. Consulta cada 30 s más o menos, el tanque no se llena en 5.La otra vía, si quieres que sea instantánea: convierte la Pi en un dispositivo, haz que una regla en el tanque le envíe un comando cuando level_pct supere 90, y deja que la Pi espere en GET /api/v1/rpc con su propio token de dispositivo. Más piezas móviles, sin polling. Para un zumbador me quedaría con la API key. Las convenciones están en REST API basics.
Brian’s right, and you’re also missing the organisation prefix. I set up nearly the same thing for a chiller room last year.
1. API Keys (Developer menu) > New API Key. Under Module permissions give it read-only telemetry, nothing else. Set an IP allowlist to the office’s address, and note the expiry, default is 90 days, a year at most. Put a reminder in the calendar, ours expired on a Saturday.
2. Every management path sits under the tenant:
GET https://<host>/tenant/<tenantId>/api/telemetry/latest?kind=iot_device&entityId=<deviceId>&keys=level_pct
Authorization: Bearer sk_live_...
Answer looks like {«latest»: {«level_pct»: {«ts»: …, «value»: 91.2}}}. Compare the ts with the previous one so you don’t buzz twice on the same reading.
3. Handle 429 and wait the Retry-After seconds. Poll every 30 s or so, the tank doesn’t fill in 5.
The other route, if you want it instant: make the Pi a device itself, have a rule on the tank send it a command when level_pct rises above 90, and let the Pi wait on GET /api/v1/rpc with its own device token. More moving parts, no polling. For a buzzer I’d take the API key. Conventions are on REST API basics.

