Yapay zekâ tarafından English dilinden çevrildi ·
Brian haklı, ayrıca kuruluş ön ekini de eksik bırakmışsın. Geçen yıl bir soğutma odası için hemen hemen aynı şeyi kurdum.1. API Keys (Developer menu) > New API Key. Module permissions altında yalnızca telemetri için salt okunur yetki ver, başka bir şey verme. Bir IP izin listesini ofisin adresine ayarla ve son kullanma tarihini not al; varsayılan 90 gün, en fazla bir yıl. Takvimine bir hatırlatıcı koy, bizimki bir Cumartesi günü süresi doldu.2. Tüm yönetim yolları tenant altında bulunur:
GET https://<host>/tenant/<tenantId>/api/telemetry/latest?kind=iot_device&entityId=<deviceId>&keys=level_pct
Authorization: Bearer sk_live_...
Yanıt şuna benzer: {“latest”: {“level_pct”: {“ts”: …, “value”: 91.2}}}. Aynı okumada iki kez buzzer çalmamak için ts değerini bir önceki ile karşılaştır.3. 429 durumunu ele al ve Retry-After saniye kadar bekle. Yaklaşık 30 sn’de bir sorgula, tank 5 saniyede dolmaz.Anlık olmasını istersen diğer yol: Pi’yi kendisi bir cihaz yap, tanktaki bir kural level_pct 90’ın üzerine çıktığında ona komut göndersin ve Pi kendi cihaz token’ıyla GET /api/v1/rpc üzerinde beklesin. Daha fazla hareketli parça, polling yok. Bir buzzer için API key’i tercih ederim. Kurallar için REST API basics sayfasına bak.
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.

