flexmeasures.data.models.automations

Automations: recurring forecasting or scheduling tasks defined per asset.

Functions

flexmeasures.data.models.automations.get_default_automation_timezone() str

Return the timezone to snapshot when an automation is created.

flexmeasures.data.models.automations.get_initial_cursor() datetime

Return a cursor which keeps the automation’s creation minute eligible.

Classes

class flexmeasures.data.models.automations.Automation(**kwargs)

A recurring task on an asset, such as computing forecasts.

The recurrence is defined by a cron string. Forecast automations use a data generator (e.g. a forecaster linked through a data source), while schedule automations use only their stored parameters.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

property input_sensors: list

The sensors that this automation reads data from on each run, as far as they can be worked out.

Reports no sensors if they cannot be, so do not use this to decide whether something is permitted; see resolve_automation_sensors for that.

property output_sensors: list

The sensors that this automation writes data to on each run. See input_sensors.

query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

validate_timezone(key: str, timezone: str) str

Require an exact timezone name from the IANA timezone database.