flexmeasures.ui.crud.assets.utils

Functions

flexmeasures.ui.crud.assets.utils.get_allowed_inflexible_sensor_data(account_id: int | None) Dict[int, str]

Return a list of sensors which the user can add as inflexible device sensors. This list is built using sensors with energy or power units within the current account (or among public assets when account_id argument is not specified). For each sensor we get data as sensor_id: asset_name:sensor_name.

flexmeasures.ui.crud.assets.utils.get_allowed_price_sensor_data(account_id: int | None) Dict[int, str]

Return a list of sensors which the user can add as consumption_price_sensor_id or production_price_sensor_id. For each sensor we get data as sensor_id: asset_name:sensor_name.

flexmeasures.ui.crud.assets.utils.get_assets_by_account(account_id: int | str | None) list[GenericAsset]
flexmeasures.ui.crud.assets.utils.process_internal_api_response(asset_data: dict, asset_id: int | None = None, make_obj=False) GenericAsset | dict

Turn data from the internal API into something we can use to further populate the UI. Either as an asset object or a dict for form filling.

If we add other data by querying the database, we make sure the asset is not in the session afterwards.

flexmeasures.ui.crud.assets.utils.user_can_create_assets() bool
flexmeasures.ui.crud.assets.utils.user_can_delete(asset) bool