Bandwidth scheduling lets you flip rate limits on a clock, instead of remembering to toggle alt-speed manually. The schedule engine (backend/schedule_engine) re-evaluates on minute boundaries; on a transition it re-applies the appropriate LimitsDTO to the engine.

ScheduleRuleDTO

{
  id: number;
  days_mask: number;   // bit 0 = Sun, bit 1 = Mon, …, bit 6 = Sat
  start_min: number;   // minutes since midnight, 0..1439
  end_min: number;     // minutes since midnight; if < start_min, the window wraps midnight
  down_kbps: number;   // 0 = unlimited
  up_kbps: number;     // 0 = unlimited
  alt_only: boolean;   // when true: enable alt-speed instead of overriding the rate
  enabled: boolean;
}

All times are in the device’s local timezone.

Examples

Throttle during work hours, weekdays

{
  "days_mask": 62,        // Mon–Fri = 0b0111110 = 62
  "start_min": 540,       // 09:00
  "end_min":   1020,      // 17:00
  "down_kbps": 200,
  "up_kbps":   100,
  "alt_only":  false,
  "enabled":   true
}

Nightly burst, every day

{
  "days_mask": 127,       // every day
  "start_min": 1380,      // 23:00
  "end_min":   360,       // 06:00 (window wraps midnight)
  "down_kbps": 0,         // unlimited
  "up_kbps":   0,
  "alt_only":  false,
  "enabled":   true
}

Weekend alt-speed mode

{
  "days_mask": 65,        // Sun + Sat = 0b1000001 = 65
  "start_min": 0,
  "end_min":   1440,      // all day
  "down_kbps": 0,
  "up_kbps":   0,
  "alt_only":  true,      // just flip alt-speed on; the rule's kbps fields are ignored
  "enabled":   true
}

Resolution

When multiple enabled rules match the current minute, the first match in the iteration order wins. To make ordering predictable, keep at most one rule active per overlapping window — scheduling overlapping rules is generally a sign you should compose them differently.

When no rule matches, the global LimitsDTO (Settings → Limits) is in effect.

Operations

Action Endpoint
List GET /api/schedule_rules
Create POST /api/schedule_rules
Update PUT /api/schedule_rules
Delete DELETE /api/schedule_rules/{id}

Create ignores id (the row is auto-allocated and returned in the response body).

Caveats

  • Local time, not UTC. If your machine moves between timezones (laptop), the windows move with it.
  • Minute granularity. The engine ticks once a minute, not on second boundaries.
  • No exception list. There’s no built-in “but not on holidays” overlay. Disable rules you don’t want to run.