Skip to content

Schedules as automations#2293

Draft
Flix6x wants to merge 3 commits into
feat/2288-automations-for-forecastsfrom
feat/2288-schedule-automations
Draft

Schedules as automations#2293
Flix6x wants to merge 3 commits into
feat/2288-automations-for-forecastsfrom
feat/2288-schedule-automations

Conversation

@Flix6x

@Flix6x Flix6x commented Jul 11, 2026

Copy link
Copy Markdown
Member

Description

Milestone 2 of #2288 (stacked on #2290): automations can now compute schedules on a recurring basis, alongside forecasts.

  • flexmeasures add automation --type schedules validates the parameters as a schedule trigger message (AssetTriggerSchema, i.e. what [POST] /assets/(id)/schedules/trigger accepts, without the asset id). Omitting start makes each run schedule from the run time (floored to the message's resolution, if given); a fixed start draws a warning since every run would compute the same period.
  • The runner dispatches to the same job creators as the API trigger endpoint (sequential/simultaneous), so asset-level flex config is honored — a minimal trigger message (e.g. just duration) suffices when the flex config lives on the asset.
  • Job provenance for scheduling jobs: the scheduling job creators accept an optional trigger dict stored as job meta; the API trigger endpoint records API, flexmeasures add schedule --as-job records CLI, and automations record automation + id. The status page's Created Via column picks this up automatically.
  • Automation job stats now count scheduling jobs (asset-level wrap-up jobs and per-sensor device jobs) for schedules automations.
  • UI: the Schedules tab on the automations page is now enabled; automations are filtered by type per tab.

How to test

echo 'duration: "PT12H"' > trigger-message.yml
flexmeasures add automation --asset <id> --name "Hourly schedules" --cron "0 * * * *" --type schedules --parameters trigger-message.yml
flexmeasures jobs run-automations

Tests: pytest flexmeasures/cli/tests/test_automations.py flexmeasures/data/tests/test_automations.py flexmeasures/api/v3_0/tests/test_asset_schedules_fresh_db.py

Notes for review

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rbix8k1JfeUWNXEmHEZVpX

Flix6x and others added 3 commits July 11, 2026 18:29
The scheduling job creators accept an optional trigger dict (stored as job
meta data), like the forecasting pipeline already does. The API trigger
endpoint records origin API; the CLI and automations follow in the next
commit. The status page's 'Created Via' column picks this up automatically.

Part of #2288

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rbix8k1JfeUWNXEmHEZVpX
Automations now also support the 'schedules' type:

- `flexmeasures add automation --type schedules` validates the parameters as
  a schedule trigger message (per the AssetTriggerSchema, as accepted by the
  API trigger endpoint, without the asset id). The schedule 'start' may be
  omitted, in which case each run schedules from the run time (floored to the
  message's resolution, if given) — a fixed start draws a warning.
- The runner dispatches schedules automations to the same job creators as the
  API trigger endpoint (sequential or simultaneous), recording trigger meta
  data (origin automation) on the queued jobs; `flexmeasures add schedule
  --as-job` now records origin CLI.
- Job stats for schedules automations are counted from the scheduling job
  cache (asset-level wrap-up jobs and per-sensor device jobs).
- The UI automations page's Schedules tab is now enabled, with automations
  filtered by type per tab.

Part of #2288

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rbix8k1JfeUWNXEmHEZVpX
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rbix8k1JfeUWNXEmHEZVpX
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