Von English mit KI übersetzt ·
Brian hat recht, und außerdem fehlt dir das Organisationspräfix. Ich habe letztes Jahr fast dasselbe für einen Kühlraum eingerichtet.1. API Keys (Developer menu) > New API Key. Unter Module permissions nur Lesezugriff auf Telemetrie vergeben, sonst nichts. Eine IP-Allowlist auf die Adresse des Büros setzen und das Ablaufdatum notieren, Standard sind 90 Tage, maximal ein Jahr. Eine Erinnerung in den Kalender eintragen, unserer ist an einem Samstag abgelaufen.2. Alle Verwaltungspfade liegen unter dem Tenant:
GET https://<host>/tenant/<tenantId>/api/telemetry/latest?kind=iot_device&entityId=<deviceId>&keys=level_pct
Authorization: Bearer sk_live_...
Die Antwort sieht etwa so aus: {„latest“: {„level_pct“: {„ts“: …, „value“: 91.2}}}. Vergleiche den ts mit dem vorherigen Wert, damit du bei demselben Messwert nicht zweimal piepst.3. Auf 429 reagieren und die Sekunden aus Retry-After abwarten. Etwa alle 30 s abfragen, der Tank läuft nicht in 5 s voll.Der andere Weg, wenn du es sofort willst: Mach den Pi selbst zu einem Gerät, lass eine Regel am Tank ihm einen Befehl senden, wenn level_pct über 90 steigt, und der Pi wartet auf GET /api/v1/rpc mit seinem eigenen Gerätetoken. Mehr bewegliche Teile, kein Polling. Für einen Summer würde ich den API Key nehmen. Die Konventionen stehen unter 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.

