flexmeasures.data.schemas.scheduling.groups

Schema for referencing a group of devices whose aggregate power is constrained.

Kept in its own module (rather than in storage.py) so that both the storage flex-model schemas and the flex-context’s inflexible-device schema can reference a group, without schemas/scheduling/__init__.py having to import storage.py (which would create an import cycle).

Functions

flexmeasures.data.schemas.scheduling.groups.validate_group_sensor_is_power_sensor(group: dict)

Check that the sensor referenced by the group field measures power.

Classes

class flexmeasures.data.schemas.scheduling.groups.GroupReferenceSchema(*, 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)

Reference to a group of devices whose aggregate power is constrained.

Accepts exactly one of (the asset form is the recommended one):
  • {"asset": <id>}: the group is identified by the flex-model entry on this asset (typically a sub-EMS/asset in the tree). Such a group entry defines no power sensor of its own; instead it may define consumption and/or production output sensors on which the group’s aggregate power gets saved, following the usual output-sensor conventions.

  • {"sensor": <id>}: the group’s aggregate power is stored on this power sensor (the sensor must itself carry a flex-model entry defining the group’s constraints).

Inherits from SharedSensorReferenceSchema (not SensorReferenceSchema) so it accepts only sensor/asset – a group is a device-group identifier, not a belief-query reference, so the source-* filter fields do not apply.

class Meta
fields: dict[str, Field]

Dictionary mapping field_names -> Field objects