Problem
The plugin tracks a single _token_remaining counter in NetroAPIClient that gets overwritten by every API response's meta.token_remaining. Since Netro confirmed that each device has its own independent 2000/day token limit, the last device polled determines the displayed count.
This causes the proactive pause threshold (100 tokens) to trigger based on one device's count, pausing ALL polling — including devices with plenty of tokens remaining.
Context from Netro support
The 2000 limit applies per API key as well as per device. The API key is generated based on the serial number, so the two limits are equivalent.
Each device — Spark, Whisper, and Pixie — is independent and has its own 2000 limit.
All devices perform a poll every 5 minutes, which should theoretically be sufficient: 60 × 24 / 5 = 288 times per day.
Expected token usage per device
- Sprinkler controller: ~4 calls/poll × 288 polls/day = 1,152/day (within 2000)
- Whisperer sensor: ~1 call/poll × 288 polls/day = 288/day (within 2000)
No single device should approach the 2000 limit at normal polling intervals.
Proposed solution
- Track
token_remaining and token_reset per device serial number in NetroAPIClient
- Apply pause/warning thresholds per device, not globally
- Update the
token_remaining device state per device
- Consider whether proactive pause is still needed given the maths above
Files involved
api_client.py — _update_token_budget(), should_pause_polling, _token_remaining
plugin.py — runConcurrentThread() pause check, device state updates
Problem
The plugin tracks a single
_token_remainingcounter inNetroAPIClientthat gets overwritten by every API response'smeta.token_remaining. Since Netro confirmed that each device has its own independent 2000/day token limit, the last device polled determines the displayed count.This causes the proactive pause threshold (100 tokens) to trigger based on one device's count, pausing ALL polling — including devices with plenty of tokens remaining.
Context from Netro support
Expected token usage per device
No single device should approach the 2000 limit at normal polling intervals.
Proposed solution
token_remainingandtoken_resetper device serial number inNetroAPIClienttoken_remainingdevice state per deviceFiles involved
api_client.py—_update_token_budget(),should_pause_polling,_token_remainingplugin.py—runConcurrentThread()pause check, device state updates