Skip to content

feat(relay): per-channel TX throttle and live duty-cycle budget#74

Open
iceice400 wants to merge 1 commit into
KMX415:mainfrom
iceice400:feat/relay-duty-cycle
Open

feat(relay): per-channel TX throttle and live duty-cycle budget#74
iceice400 wants to merge 1 commit into
KMX415:mainfrom
iceice400:feat/relay-duty-cycle

Conversation

@iceice400
Copy link
Copy Markdown
Contributor

Summary

  • Add per-channel rolling 1 h relay ToA budget (ChannelBudget) with operator throttle sliders; relay TX only, not native messaging.
  • RelayManager.evaluate() rejects with channel_throttled when budget exhausted; records airtime after successful relay TX.
  • GET /api/stats/duty_cycle + Stats tab live meter; Configuration → Advanced throttle UI; PUT /api/config/relay hot-reload.

Why

Operators need a duty-cycle overlay and per-channel relay throttle to avoid starving busy channels while staying within regional hints (EU868 1% ceiling).

Soft dependencies

  • Reuses src/analytics/toa_estimate.py (PR 2 ToA math).
  • Throttle UI lives in Configuration → Advanced (standalone card here; merges into PR 4 relay filters card when that lands).

Risks (request maintainer review)

  • Touches RelayManager.evaluate() — misconfigured throttle can starve relay traffic on busy channels.
  • ToA estimates are not spectrum-analyser measurements.
  • Throttle is relay-only; transmit.enabled path unchanged.

Testing

  • python -m unittest tests.test_relay_duty_cycle -v (8 tests)
  • Channel 0 at 50% throttle blocks relay under synthetic load; omitted throttle = 100% behaviour.

Impact

  • Default channel_throttle_percent: {} = 100% all channels (no behaviour change on upgrade).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant