flexmeasures.api.ui.sensors

Functions

flexmeasures.api.ui.sensors.get_sensor_or_abort(id: int) → Sensor

Util function to help the GET requests. Will be obsolete..

Classes

class flexmeasures.api.ui.sensors.AssetAPI

This view exposes asset attributes for charts to the FlexMeasures UI. These endpoints are not part of the official API, and not meant for external UIs.

get(id: int, asset: GenericAsset)

GET from /asset/<id>

class flexmeasures.api.ui.sensors.LegacyDevAssetAPI

The endpoint of AssetAPI, also served under its former /api/dev prefix, until FlexMeasures v2 (see flexmeasures.api.ui).

class flexmeasures.api.ui.sensors.LegacyDevSensorAPI

The endpoints of SensorAPI, also served under their former /api/dev prefix, until FlexMeasures v2 (see flexmeasures.api.ui).

class flexmeasures.api.ui.sensors.SensorAPI

This view exposes sensor charts and chart attributes to the FlexMeasures UI. These endpoints are not part of the official API, and not meant for external UIs.

get(id: int, sensor: Sensor)

GET from /sensor/<id>

get_chart(id: int, sensor: Sensor, **kwargs)

GET from /sensor/<id>/chart

Optional fields

  • “start” (legacy alias: “event_starts_after”; see the timely-beliefs documentation). May be given alone, or paired with “duration” to derive “end”.

  • “end” (legacy alias: “event_ends_before”; see the timely-beliefs documentation). May be given alone, or paired with “duration” to derive “start”.

  • “duration” (ISO 8601 duration format; provide together with “start” or “end” to derive the other bound)

  • “prior” (legacy alias: “beliefs_before”; see the timely-beliefs documentation)

  • “include-data” (legacy alias: “include_data”; if true, chart specs include the data; if false, use the GET /api/ui/sensor/(id)/chart_data endpoint to fetch data)

  • “chart-type” (legacy alias: “chart_type”; currently ‘bar_chart’ and ‘daily_heatmap’ are supported types)

  • “width” (an integer number of pixels; without it, the chart will be scaled to the full width of the container (hint: use <div style="width: 100%;"> to set a div width to 100%)

  • “height” (an integer number of pixels; without it, FlexMeasures sets a default, currently 300)

get_chart_annotations(id: int, sensor: Sensor, **kwargs)

GET from /sensor/<id>/chart_annotations

Annotations for use in charts (in case you have the chart specs already).

get_chart_data(id: int, sensor: Sensor, **kwargs)

GET from /sensor/<id>/chart_data

Data for use in charts (in case you have the chart specs already).

Optional fields

class flexmeasures.api.ui.sensors.SensorChartAnnotationsKwargsSchema(*, 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)
class flexmeasures.api.ui.sensors.SensorChartDataKwargsSchema(*, 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)
class flexmeasures.api.ui.sensors.SensorChartKwargsSchema(*, 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)