flexmeasures.data.schemas.automations
Classes
- class flexmeasures.data.schemas.automations.AutomationCreationSchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: Literal['exclude', 'include', 'raise'] | None = None)
Request schema for creating an automation (the asset comes from the URL path).
The parameters are validated separately, by the schema matching the automation type.
- class flexmeasures.data.schemas.automations.AutomationDependencySchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: Literal['exclude', 'include', 'raise'] | None = None)
One automation whose runs another automation’s runs wait for.
- class flexmeasures.data.schemas.automations.AutomationIdField(*args, **kwargs)
Field that deserializes to an Automation and serializes back to an integer.
- _deserialize(value, attr, obj, **kwargs) Automation
Turn an automation id into an Automation.
- _serialize(automation, attr, data, **kwargs)
Turn an Automation into an automation id.
- class flexmeasures.data.schemas.automations.AutomationSchema(*args, **kwargs)
Automation schema, with validations.
- class Meta
- model
alias of
Automation
- static _in_automation_timezone(automation: Automation, moment: datetime | None) str | None
Render a moment as a clock time in the automation’s own timezone.
A recurrence is written in that timezone, so reading the times it produces back in UTC asks whoever reads them to undo the conversion themselves.
- dump_cursor(automation: Automation) str | None
Render the cursor in the automation’s own timezone.
- dump_depends_on(automation: Automation) list[dict]
Render the automations this automation’s runs wait for.
- dump_next_run(automation: Automation) str | None
Render the next scheduled run in the automation’s own timezone.
- opts: LoadInstanceMixin.Opts = <flask_marshmallow.sqla.SQLAlchemySchemaOpts object>
- class flexmeasures.data.schemas.automations.AutomationUpdateSchema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: Literal['exclude', 'include', 'raise'] | None = None)
Request schema for updating an automation’s name, recurrence, timezone, activation status and/or dependencies.
The parameters cannot be updated, so the sensors an automation involves stay the ones its creator was checked against.
- class flexmeasures.data.schemas.automations.CronField(*args, **kwargs)
Field that validates a cron string (e.g.
"0 6 * * *").- _deserialize(value, attr, obj, **kwargs) str
Deserialize value. Concrete
Fieldclasses should implement this method.- Parameters:
value – The value to be deserialized.
attr – The attribute/key in data to be deserialized.
data – The raw input data passed to the Schema.load <marshmallow.Schema.load>.
kwargs – Field-specific keyword arguments.
- Raises:
ValidationError – In case of formatting or validation failure.
- Returns:
The deserialized value.
Changed in version 3.0.0: Added
**kwargsto signature.
- class flexmeasures.data.schemas.automations.ReadableAutomationIdField(*args, **kwargs)
Field that only finds an automation the current user may read.
One they may not read gets the answer of one that does not exist, so that trying IDs does not reveal which ones do. Nobody is logged in on the command line, where this makes no difference.
- _deserialize(value, attr, obj, **kwargs) Automation
Turn an automation id into an Automation.