Basic Configuration

BasicConfiguration Model

The ConfigModel is used for the general configuration of the basic service in EnCoDaPy.

pydantic model encodapy.config.models.ConfigModel[source]

Base model for the configuration of the system controller.

Variables:
  • interfaces (InterfaceModel) – Configuration of the system controller interfaces.

  • inputs (list[InputModel]) – List of input configurations for the system controller.

  • outputs (ist[OutputModel]) – Output configurations for the system controller.

  • staticdata (list[StaticDataModel]) – Static configuration data for devices managed by the system controller.

  • controller_components (list[ControllerComponentModel]) – Components used by the controller.

  • controller_settings (ControllerSettingModel) – Settings for the controller.

Show JSON schema
{
   "title": "ConfigModel",
   "description": "Base model for the configuration of the system controller.\n\nAttributes:\n    interfaces (InterfaceModel): Configuration of the system controller interfaces.\n    inputs (list[InputModel]): List of input configurations for the system controller.\n    outputs (ist[OutputModel]): Output configurations for the system controller.\n    staticdata (list[StaticDataModel]):             Static configuration data for devices managed by the system controller.\n    controller_components (list[ControllerComponentModel]): Components used by the controller.\n    controller_settings (ControllerSettingModel): Settings for the controller.",
   "type": "object",
   "properties": {
      "interfaces": {
         "$ref": "#/$defs/InterfaceModel"
      },
      "inputs": {
         "items": {
            "$ref": "#/$defs/InputModel"
         },
         "title": "Inputs",
         "type": "array"
      },
      "outputs": {
         "items": {
            "$ref": "#/$defs/OutputModel"
         },
         "title": "Outputs",
         "type": "array"
      },
      "staticdata": {
         "items": {
            "$ref": "#/$defs/StaticDataModel"
         },
         "title": "Staticdata",
         "type": "array"
      },
      "controller_components": {
         "items": {
            "$ref": "#/$defs/ControllerComponentModel"
         },
         "title": "Controller Components",
         "type": "array"
      },
      "controller_settings": {
         "$ref": "#/$defs/ControllerSettingModel"
      }
   },
   "$defs": {
      "AttributeModel": {
         "description": "Configuration class for representing attributes with metadata, value,         and optional interface-specific identifier.\n\nThis class models attributes with a unique ID, type, value, unit, and timestamp.\nIf `id_interface` is not set, it defaults to the value of `id`.\n\nAttributes:\n    id (str): The unique identifier of the attribute.\n    id_interface (str): The interface-specific identifier. Defaults to `None`.\n        If not set, it will be automatically set to the value of `id`.\n    type (AttributeTypes): The type of the attribute. Defaults to `AttributeTypes.VALUE`.\n    value (Union[str, float, int, bool, Dict, List, pd.DataFrame, None]):             The value of the attribute. Defaults to `None`.\n    unit (Optional[DataUnits]): The unit of measurement for the value. Defaults to `None`.\n    datatype (DataType): The data type of the attribute. Defaults to `DataType(\"Number\")`.\n    timestamp (Optional[datetime]): The timestamp of the attribute. Defaults to `None`.\n    mqtt_format (Union[MQTTFormatTypes, MQTTTemplateConfig]):             The format of the attribute for MQTT (if not set, the default format is used)                 - only for mqtt interface needed",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "type": {
               "allOf": [
                  {
                     "$ref": "#/$defs/AttributeTypes"
                  }
               ],
               "default": "value"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "object"
                  },
                  {
                     "items": {},
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            },
            "unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DataUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "datatype": {
               "allOf": [
                  {
                     "$ref": "#/$defs/DataType"
                  }
               ],
               "default": "Number"
            },
            "timestamp": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timestamp"
            },
            "mqtt_format": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MQTTFormatTypes"
                  },
                  {
                     "$ref": "#/$defs/MQTTTemplateConfigDoc"
                  }
               ],
               "default": "plain",
               "title": "Mqtt Format"
            }
         },
         "required": [
            "id"
         ],
         "title": "AttributeModel",
         "type": "object"
      },
      "AttributeTypes": {
         "description": "Enum class for the attribute types\n\nAttributes:\n    TIMESERIES (str): Timeseries data \"timeseries\"\n    VALUE (str): Single value data \"value\"",
         "enum": [
            "timeseries",
            "value"
         ],
         "title": "AttributeTypes",
         "type": "string"
      },
      "CommandModel": {
         "description": "Configuration class for the commands\n\nAttributes:\n    id (str): The id of the command\n    id_interface (str | None): The id of the command on the interface             (if not set, the id is used)\n    value (Union[str, int, float, List, Dict, None]): The value of the command",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "number"
                  },
                  {
                     "items": {},
                     "type": "array"
                  },
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            }
         },
         "required": [
            "id"
         ],
         "title": "CommandModel",
         "type": "object"
      },
      "ConfigDataPoints": {
         "additionalProperties": {
            "anyOf": [
               {
                  "$ref": "#/$defs/IOAllocationModel"
               },
               {
                  "$ref": "#/$defs/DataPointGeneral"
               }
            ]
         },
         "description": "Model for the configuration of config data points.\n\nSee also :class:`~encodapy.components.basic_component_config.IOAllocationModel` and\n:class:`~encodapy.utils.datapoints.DataPointGeneral`.",
         "title": "ConfigDataPoints",
         "type": "object"
      },
      "ControllerComponentModel": {
         "description": "Model for the configuration of the controller components.\n\nAttributes:\n    active (bool): Whether the component is active or not\n    id (str): The id of the component\n    type (str): The type of the component (e.g. thermal storage, heat pump, etc. /             needs to be defined for individual components)\n    inputs (IOModell): The inputs of the component as a dictionary with IOAllocationModel             for the individual inputs\n    outputs (IOModell): The outputs of the component as a dictionary with IOAllocationModel             for the individual outputs\n    config (ConfigDataPoints): The configuration of the component as a dictionary with             IOAllocationModel for the individual static data or DataPointModel with direct values",
         "properties": {
            "active": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": true,
               "title": "Active"
            },
            "id": {
               "title": "Id",
               "type": "string"
            },
            "type": {
               "title": "Type",
               "type": "string"
            },
            "inputs": {
               "$ref": "#/$defs/IOModell"
            },
            "outputs": {
               "$ref": "#/$defs/IOModell"
            },
            "config": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ConfigDataPoints"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "id",
            "type",
            "inputs",
            "outputs"
         ],
         "title": "ControllerComponentModel",
         "type": "object"
      },
      "ControllerSettingModel": {
         "description": "Model for the configuration of the controller settings.\n\nAttributes:\n    time_settings: The time settings for the controller\n    specific_settings: The specific settings for the controller - not defined as a model\n\nTODO: What is needed here?",
         "properties": {
            "time_settings": {
               "$ref": "#/$defs/TimeSettingsModel"
            },
            "specific_settings": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Specific Settings"
            }
         },
         "required": [
            "time_settings"
         ],
         "title": "ControllerSettingModel",
         "type": "object"
      },
      "DataPointGeneral": {
         "description": "Model for datapoints of the controller component.\n\nAttributes:\n    value (Any): The value of the datapoint, which can be of various types             (string, float, int, boolean, dictionary, list, DataFrame, or None).\n    unit (Optional[DataUnits]): Optional unit of the datapoint, if applicable.\n    time (Optional[datetime]): Optional timestamp of the datapoint, if applicable.",
         "properties": {
            "value": {
               "title": "Value"
            },
            "unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DataUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "time": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Time"
            }
         },
         "required": [
            "value"
         ],
         "title": "DataPointGeneral",
         "type": "object"
      },
      "DataType": {
         "description": "When possible reuse schema.org data types\n(Text, Number, DateTime, StructuredValue, etc.).\nRemember that null is not allowed in NGSI-LD and\ntherefore should be avoided as a value.\n\nhttps://schema.org/DataType",
         "enum": [
            "Boolean",
            "Date",
            "DateTime",
            "Number",
            "Integer",
            "Float",
            "Text",
            "Time",
            "Relationship",
            "StructuredValue",
            "Array",
            "Object",
            "command",
            "commandResult",
            "commandStatus",
            "geo:json"
         ],
         "title": "DataType",
         "type": "string"
      },
      "DataUnits": {
         "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n    - Is there a better way to handle the units?\n    - Add more units?",
         "enum": [
            "SEC",
            "HUR",
            "MIN",
            "CEL",
            "KEL",
            "LTR",
            "MTQ",
            "MQH",
            "MQS",
            "E32",
            "L2",
            "WTT",
            "WHR",
            "KWH",
            "CMT",
            "MTR",
            "MTK",
            "MTS",
            "P1",
            "OHM",
            "VLT"
         ],
         "title": "DataUnits",
         "type": "string"
      },
      "IOAllocationModel": {
         "description": "Model for the input or output allocation.\n\nAttributes:\n    entity (str): ID of the entity to which the input or output is allocated\n    attribute (str): ID of the attribute to which the input or output is allocated",
         "properties": {
            "entity": {
               "description": "ID of the entity to which the input or output is allocated",
               "title": "Entity",
               "type": "string"
            },
            "attribute": {
               "description": "ID of the attribute to which the input or output is allocated",
               "title": "Attribute",
               "type": "string"
            }
         },
         "required": [
            "entity",
            "attribute"
         ],
         "title": "IOAllocationModel",
         "type": "object"
      },
      "IOModell": {
         "additionalProperties": {
            "$ref": "#/$defs/IOAllocationModel"
         },
         "description": "Model for the input, staticdata and output of a component.\n\nIt contains a dictionary with the key as the ID of the input, output or static data\nand the value as the allocation model\n\nSee also :class:`~encodapy.components.basic_component_config.IOAllocationModel`.\n\nThere is no validation for this.\nIt is used to create the the ComponentIOModel for each component.",
         "title": "IOModell",
         "type": "object"
      },
      "InputModel": {
         "description": "Model for the configuration of inputs.\n\nAttributes:\n    id (str): The id of the input\n    interface (Interfaces): The interface of the input\n    id_interface (str | None): The id of the input on the interface, default is the id\n    attributes (list[AttributeModel]): A list of attributes for the input as AttributeModel",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "interface": {
               "$ref": "#/$defs/Interfaces"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "attributes": {
               "items": {
                  "$ref": "#/$defs/AttributeModel"
               },
               "title": "Attributes",
               "type": "array"
            }
         },
         "required": [
            "id",
            "interface",
            "attributes"
         ],
         "title": "InputModel",
         "type": "object"
      },
      "InterfaceModel": {
         "description": "Base class for the interfaces\n\nAttributes:\n    mqtt (bool): Whether the MQTT interface is active. Defaults to False.\n    fiware (bool): Whether the FIWARE interface is active. Defaults to False.\n    file (bool): Whether the FILE interface is active. Defaults to False.",
         "properties": {
            "mqtt": {
               "default": false,
               "title": "Mqtt",
               "type": "boolean"
            },
            "fiware": {
               "default": false,
               "title": "Fiware",
               "type": "boolean"
            },
            "file": {
               "default": false,
               "title": "File",
               "type": "boolean"
            }
         },
         "title": "InterfaceModel",
         "type": "object"
      },
      "Interfaces": {
         "description": "Enum class for the interfaces\n\nAttributes:\n    MQTT (str): MQTT interface \"mqtt\"\n    FIWARE (str): FIWARE interface \"fiware\"\n    FILE (str): File interface \"file\"",
         "enum": [
            "mqtt",
            "fiware",
            "file"
         ],
         "title": "Interfaces",
         "type": "string"
      },
      "MQTTFormatTypes": {
         "description": "Enum class for MQTT format types\nPossible values:\n- PLAIN (plain): Plain format\n- FIWARE_ATTR (fiware-attr): FIWARE attribute format\n- FIWARE_CMDEXE (fiware-cmdexe): FIWARE command execution format\n- TEMPLATE (template): Template-based format",
         "enum": [
            "plain",
            "fiware-attr",
            "fiware-cmdexe",
            "template"
         ],
         "title": "MQTTFormatTypes",
         "type": "string"
      },
      "MQTTTemplateConfigDoc": {
         "description": "Model for MQTT template configuration.\n\n**Mock class for documentation purposes.**\n\nNote:\n    In the actual implementation, `topic` and `payload` are `jinja2.Template` objects,\n    `time_format` is a `str` as time format for the timestamp in the payload.\n    This mock uses `dict` to avoid import issues during documentation generation.\n    \n    For more information,            see :class:`~encodapy.config.mqtt_messages_template.MQTTTemplateConfig`.",
         "properties": {
            "topic": {
               "title": "Topic",
               "type": "object"
            },
            "payload": {
               "title": "Payload",
               "type": "object"
            },
            "time_format": {
               "default": "%Y-%m-%dT%H:%M:%S%z",
               "title": "Time Format",
               "type": "string"
            }
         },
         "required": [
            "topic",
            "payload"
         ],
         "title": "MQTTTemplateConfigDoc",
         "type": "object"
      },
      "OutputModel": {
         "description": "Model for the configuration of outputs.\n\nAttributes:\n    id: The id of the output\n    interface: The interface of the output\n    id_interface: The id of the output on the interface, default is the id\n    attributes: The attributes of the output",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "interface": {
               "$ref": "#/$defs/Interfaces"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "attributes": {
               "items": {
                  "$ref": "#/$defs/AttributeModel"
               },
               "title": "Attributes",
               "type": "array"
            },
            "commands": {
               "items": {
                  "$ref": "#/$defs/CommandModel"
               },
               "title": "Commands",
               "type": "array"
            }
         },
         "required": [
            "id",
            "interface",
            "attributes"
         ],
         "title": "OutputModel",
         "type": "object"
      },
      "StaticDataModel": {
         "description": "Model for the configuration of inputs.\n\nAttributes:\n    id (str): The id of the input\n    interface (Interfaces): The interface of the input\n    id_interface (str | None): The id of the input on the interface\n    attributes (list[AttributeModel]): A list of attributes for the static data             as AttributeModel",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "interface": {
               "$ref": "#/$defs/Interfaces"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "attributes": {
               "items": {
                  "$ref": "#/$defs/AttributeModel"
               },
               "title": "Attributes",
               "type": "array"
            }
         },
         "required": [
            "id",
            "interface",
            "attributes"
         ],
         "title": "StaticDataModel",
         "type": "object"
      },
      "TimeSettingsCalculationModel": {
         "description": "Base class for the calculation time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calculation (if only one value is needed and primary value            , otherwise use timerange_min and timerange_max)\n    timerange_min: The minimum timerange for the calculation (only used if timerange is not set            and timerange_max is set too)\n    timerange_max: The maximum timerange for the calculation (only used if timerange is not set            and timerange_min is set too)\n    timerange_type: Type of time period, relative to the last result or absolute at the current            time (if not set, the default type is absolute)\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calculation (if not set, the default value is 1), the            related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calculation (if not set, the default value is 1),            the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is minute)",
         "properties": {
            "timerange": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange"
            },
            "timerange_min": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange Min"
            },
            "timerange_max": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange Max"
            },
            "timerange_type": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimerangeTypes"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "absolute"
            },
            "timerange_unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "minute"
            },
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            },
            "sampling_time": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Sampling Time"
            },
            "sampling_time_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "minute"
            }
         },
         "title": "TimeSettingsCalculationModel",
         "type": "object"
      },
      "TimeSettingsCalibrationModel": {
         "description": "Base class for the calibration time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calibration (if not set, the default value is 1),             the related unit is defined in the timerange_unit attribute\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calibration (if not set, the default value is 1),             the related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calibration (if not set, the default value is 1),             the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is day)",
         "properties": {
            "timerange": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange"
            },
            "timerange_unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "minute"
            },
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            },
            "sampling_time": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Sampling Time"
            },
            "sampling_time_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "day"
            }
         },
         "title": "TimeSettingsCalibrationModel",
         "type": "object"
      },
      "TimeSettingsModel": {
         "description": "Base class for the time settings of the controller / system.\n\nAttributes:\n    calculation: The timeranges and settings f\u00fcr the calculation\n    calibration: The timeranges and settings for the calibration\n    results: The timesettings for the results\n\nTODO: Add the needed fields - calibration?",
         "properties": {
            "calculation": {
               "$ref": "#/$defs/TimeSettingsCalculationModel"
            },
            "calibration": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeSettingsCalibrationModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "results": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeSettingsResultsModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "calculation"
         ],
         "title": "TimeSettingsModel",
         "type": "object"
      },
      "TimeSettingsResultsModel": {
         "description": "Settings for the timesteps of the results.",
         "properties": {
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            }
         },
         "title": "TimeSettingsResultsModel",
         "type": "object"
      },
      "TimeUnits": {
         "description": "Possible time units for the time series data\n\nTODO: Is it better to use standard time units? Like in the unit code?",
         "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "month"
         ],
         "title": "TimeUnits",
         "type": "string"
      },
      "TimerangeTypes": {
         "description": "Enum class for the timedelta types, used for the functions to get timeseries data\n\nAttributes:\n    ABSOLUTE (str): The timedelta is calculated from the actual time \"absolute\"\n    RELATIVE (str): The timedelta is calculated from the last timestamp \"relative\"",
         "enum": [
            "absolute",
            "relative"
         ],
         "title": "TimerangeTypes",
         "type": "string"
      }
   },
   "required": [
      "interfaces",
      "inputs",
      "outputs",
      "staticdata",
      "controller_components",
      "controller_settings"
   ]
}

field interfaces: InterfaceModel [Required]
field inputs: list[InputModel] [Required]
field outputs: list[OutputModel] [Required]
field staticdata: list[StaticDataModel] [Required]
field controller_components: list[ControllerComponentModel] [Required]
field controller_settings: ControllerSettingModel [Required]
classmethod from_json(file_path: str)[source]

Load the configuration from a JSON file.

Parameters:

file_path (str)

Also you need to configure some general settings via environment variables as described in “EnCoDaPy” – Energy Control and Data Preparation in Python. The following information is required for the basic service configuration:

pydantic settings encodapy.config.env_values.BasicEnvVariables[source]

Basic environment variables for the service. They are automatically loaded from the environment or a .env file.

Show JSON schema
{
   "title": "BasicEnvVariables",
   "description": "Basic environment variables for the service.\nThey are automatically loaded from the environment or a .env file.",
   "type": "object",
   "properties": {
      "config_path": {
         "default": "config.json",
         "description": "Path to the configuration file",
         "title": "Config Path",
         "type": "string"
      },
      "log_level": {
         "default": "WARNING",
         "description": "Logging level for the service",
         "title": "Log Level",
         "type": "string"
      },
      "log_path": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Path to the log file. If not provided, logs will be printed to the console. Example: './logs/service.log'",
         "title": "Log Path"
      },
      "log_retention": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "string"
            },
            {
               "format": "duration",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Retention policy for log files. Can be an integer (number of files to keep), a string (e.g., '7 days'), or a timedelta object. Example: '7 days' or 5 (to keep the last 5 log files).",
         "title": "Log Retention"
      },
      "log_rotation": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "string"
            },
            {
               "format": "time",
               "type": "string"
            },
            {
               "format": "duration",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Rotation policy for log files. Can be an integer (size in bytes), a string (e.g., '00:00' for daily rotation at midnight), a time object, or a timedelta object. Example: '00:00' for daily rotation at midnight or 10485760 (to rotate after 10 MB).",
         "title": "Log Rotation"
      },
      "reload_staticdata": {
         "default": false,
         "description": "If true, static data will be reloaded at each time step",
         "title": "Reload Staticdata",
         "type": "boolean"
      },
      "start_hold_time": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": 0.0,
         "description": "Time in seconds to hold the start of the service",
         "title": "Start Hold Time"
      }
   }
}

Config:
  • extra: str = ignore

  • env_file: str = .env

field config_path: str = 'config.json'

Path to the configuration file

field log_level: str = 'WARNING'

Logging level for the service

field log_path: Optional[str] = None

Path to the log file. If not provided, logs will be printed to the console. Example: ‘./logs/service.log’

field log_retention: Optional[Union[int, str, timedelta]] = None

Retention policy for log files. Can be an integer (number of files to keep), a string (e.g., ‘7 days’), or a timedelta object. Example: ‘7 days’ or 5 (to keep the last 5 log files).

field log_rotation: Optional[Union[int, str, time, timedelta]] = None

Rotation policy for log files. Can be an integer (size in bytes), a string (e.g., ‘00:00’ for daily rotation at midnight), a time object, or a timedelta object. Example: ‘00:00’ for daily rotation at midnight or 10485760 (to rotate after 10 MB).

field reload_staticdata: bool = False

If true, static data will be reloaded at each time step

field start_hold_time: Optional[float] = 0.0

Time in seconds to hold the start of the service

As described in Communication Interfaces, other environment variables are required for the configuration of specific interfaces.

Specific Sub Models for the Configuration

The following models are used as sub-models within the ConfigModel for specific configuration sections.

pydantic model encodapy.config.models.AttributeModel[source]

Bases: BaseModel

Configuration class for representing attributes with metadata, value, and optional interface-specific identifier.

This class models attributes with a unique ID, type, value, unit, and timestamp. If id_interface is not set, it defaults to the value of id.

Variables:
  • id (str) – The unique identifier of the attribute.

  • id_interface (str) – The interface-specific identifier. Defaults to None. If not set, it will be automatically set to the value of id.

  • type (AttributeTypes) – The type of the attribute. Defaults to AttributeTypes.VALUE.

  • value (Union[str, float, int, bool, Dict, List, pd.DataFrame, None]) – The value of the attribute. Defaults to None.

  • unit (Optional[DataUnits]) – The unit of measurement for the value. Defaults to None.

  • datatype (DataType) – The data type of the attribute. Defaults to DataType(“Number”).

  • timestamp (Optional[datetime]) – The timestamp of the attribute. Defaults to None.

  • mqtt_format (Union[MQTTFormatTypes, MQTTTemplateConfig]) – The format of the attribute for MQTT (if not set, the default format is used) - only for mqtt interface needed

Show JSON schema
{
   "title": "AttributeModel",
   "description": "Configuration class for representing attributes with metadata, value,         and optional interface-specific identifier.\n\nThis class models attributes with a unique ID, type, value, unit, and timestamp.\nIf `id_interface` is not set, it defaults to the value of `id`.\n\nAttributes:\n    id (str): The unique identifier of the attribute.\n    id_interface (str): The interface-specific identifier. Defaults to `None`.\n        If not set, it will be automatically set to the value of `id`.\n    type (AttributeTypes): The type of the attribute. Defaults to `AttributeTypes.VALUE`.\n    value (Union[str, float, int, bool, Dict, List, pd.DataFrame, None]):             The value of the attribute. Defaults to `None`.\n    unit (Optional[DataUnits]): The unit of measurement for the value. Defaults to `None`.\n    datatype (DataType): The data type of the attribute. Defaults to `DataType(\"Number\")`.\n    timestamp (Optional[datetime]): The timestamp of the attribute. Defaults to `None`.\n    mqtt_format (Union[MQTTFormatTypes, MQTTTemplateConfig]):             The format of the attribute for MQTT (if not set, the default format is used)                 - only for mqtt interface needed",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "id_interface": {
         "default": "",
         "title": "Id Interface",
         "type": "string"
      },
      "type": {
         "allOf": [
            {
               "$ref": "#/$defs/AttributeTypes"
            }
         ],
         "default": "value"
      },
      "value": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "number"
            },
            {
               "type": "integer"
            },
            {
               "type": "boolean"
            },
            {
               "type": "object"
            },
            {
               "items": {},
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Value"
      },
      "unit": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataUnits"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "datatype": {
         "allOf": [
            {
               "$ref": "#/$defs/DataType"
            }
         ],
         "default": "Number"
      },
      "timestamp": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Timestamp"
      },
      "mqtt_format": {
         "anyOf": [
            {
               "$ref": "#/$defs/MQTTFormatTypes"
            },
            {
               "$ref": "#/$defs/MQTTTemplateConfigDoc"
            }
         ],
         "default": "plain",
         "title": "Mqtt Format"
      }
   },
   "$defs": {
      "AttributeTypes": {
         "description": "Enum class for the attribute types\n\nAttributes:\n    TIMESERIES (str): Timeseries data \"timeseries\"\n    VALUE (str): Single value data \"value\"",
         "enum": [
            "timeseries",
            "value"
         ],
         "title": "AttributeTypes",
         "type": "string"
      },
      "DataType": {
         "description": "When possible reuse schema.org data types\n(Text, Number, DateTime, StructuredValue, etc.).\nRemember that null is not allowed in NGSI-LD and\ntherefore should be avoided as a value.\n\nhttps://schema.org/DataType",
         "enum": [
            "Boolean",
            "Date",
            "DateTime",
            "Number",
            "Integer",
            "Float",
            "Text",
            "Time",
            "Relationship",
            "StructuredValue",
            "Array",
            "Object",
            "command",
            "commandResult",
            "commandStatus",
            "geo:json"
         ],
         "title": "DataType",
         "type": "string"
      },
      "DataUnits": {
         "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n    - Is there a better way to handle the units?\n    - Add more units?",
         "enum": [
            "SEC",
            "HUR",
            "MIN",
            "CEL",
            "KEL",
            "LTR",
            "MTQ",
            "MQH",
            "MQS",
            "E32",
            "L2",
            "WTT",
            "WHR",
            "KWH",
            "CMT",
            "MTR",
            "MTK",
            "MTS",
            "P1",
            "OHM",
            "VLT"
         ],
         "title": "DataUnits",
         "type": "string"
      },
      "MQTTFormatTypes": {
         "description": "Enum class for MQTT format types\nPossible values:\n- PLAIN (plain): Plain format\n- FIWARE_ATTR (fiware-attr): FIWARE attribute format\n- FIWARE_CMDEXE (fiware-cmdexe): FIWARE command execution format\n- TEMPLATE (template): Template-based format",
         "enum": [
            "plain",
            "fiware-attr",
            "fiware-cmdexe",
            "template"
         ],
         "title": "MQTTFormatTypes",
         "type": "string"
      },
      "MQTTTemplateConfigDoc": {
         "description": "Model for MQTT template configuration.\n\n**Mock class for documentation purposes.**\n\nNote:\n    In the actual implementation, `topic` and `payload` are `jinja2.Template` objects,\n    `time_format` is a `str` as time format for the timestamp in the payload.\n    This mock uses `dict` to avoid import issues during documentation generation.\n    \n    For more information,            see :class:`~encodapy.config.mqtt_messages_template.MQTTTemplateConfig`.",
         "properties": {
            "topic": {
               "title": "Topic",
               "type": "object"
            },
            "payload": {
               "title": "Payload",
               "type": "object"
            },
            "time_format": {
               "default": "%Y-%m-%dT%H:%M:%S%z",
               "title": "Time Format",
               "type": "string"
            }
         },
         "required": [
            "topic",
            "payload"
         ],
         "title": "MQTTTemplateConfigDoc",
         "type": "object"
      }
   },
   "required": [
      "id"
   ]
}

field id: str [Required]
field id_interface: str = ''
field type: AttributeTypes = AttributeTypes.VALUE
field value: Optional[Union[str, float, int, bool, Dict, List, DataFrame]] = None
field unit: Optional[DataUnits] = None
field datatype: DataType = <DataType.NUMBER: 'Number'>
field timestamp: Optional[datetime] = None
field mqtt_format: Union[MQTTFormatTypes, MQTTTemplateConfigDoc] = MQTTFormatTypes.PLAIN
pydantic model encodapy.config.models.CommandModel[source]

Bases: BaseModel

Configuration class for the commands

Variables:
  • id (str) – The id of the command

  • id_interface (str | None) – The id of the command on the interface (if not set, the id is used)

  • value (Union[str, int, float, List, Dict, None]) – The value of the command

Show JSON schema
{
   "title": "CommandModel",
   "description": "Configuration class for the commands\n\nAttributes:\n    id (str): The id of the command\n    id_interface (str | None): The id of the command on the interface             (if not set, the id is used)\n    value (Union[str, int, float, List, Dict, None]): The value of the command",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "id_interface": {
         "default": "",
         "title": "Id Interface",
         "type": "string"
      },
      "value": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "integer"
            },
            {
               "type": "number"
            },
            {
               "items": {},
               "type": "array"
            },
            {
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Value"
      }
   },
   "required": [
      "id"
   ]
}

field id: str [Required]
field id_interface: str = ''
field value: Optional[Union[str, int, float, List, Dict]] = None
pydantic model encodapy.config.models.ControllerSettingModel[source]

Bases: BaseModel

Model for the configuration of the controller settings.

Variables:
  • time_settings – The time settings for the controller

  • specific_settings – The specific settings for the controller - not defined as a model

TODO: What is needed here?

Show JSON schema
{
   "title": "ControllerSettingModel",
   "description": "Model for the configuration of the controller settings.\n\nAttributes:\n    time_settings: The time settings for the controller\n    specific_settings: The specific settings for the controller - not defined as a model\n\nTODO: What is needed here?",
   "type": "object",
   "properties": {
      "time_settings": {
         "$ref": "#/$defs/TimeSettingsModel"
      },
      "specific_settings": {
         "anyOf": [
            {
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": {},
         "title": "Specific Settings"
      }
   },
   "$defs": {
      "TimeSettingsCalculationModel": {
         "description": "Base class for the calculation time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calculation (if only one value is needed and primary value            , otherwise use timerange_min and timerange_max)\n    timerange_min: The minimum timerange for the calculation (only used if timerange is not set            and timerange_max is set too)\n    timerange_max: The maximum timerange for the calculation (only used if timerange is not set            and timerange_min is set too)\n    timerange_type: Type of time period, relative to the last result or absolute at the current            time (if not set, the default type is absolute)\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calculation (if not set, the default value is 1), the            related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calculation (if not set, the default value is 1),            the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is minute)",
         "properties": {
            "timerange": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange"
            },
            "timerange_min": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange Min"
            },
            "timerange_max": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange Max"
            },
            "timerange_type": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimerangeTypes"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "absolute"
            },
            "timerange_unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "minute"
            },
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            },
            "sampling_time": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Sampling Time"
            },
            "sampling_time_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "minute"
            }
         },
         "title": "TimeSettingsCalculationModel",
         "type": "object"
      },
      "TimeSettingsCalibrationModel": {
         "description": "Base class for the calibration time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calibration (if not set, the default value is 1),             the related unit is defined in the timerange_unit attribute\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calibration (if not set, the default value is 1),             the related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calibration (if not set, the default value is 1),             the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is day)",
         "properties": {
            "timerange": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange"
            },
            "timerange_unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "minute"
            },
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            },
            "sampling_time": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Sampling Time"
            },
            "sampling_time_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "day"
            }
         },
         "title": "TimeSettingsCalibrationModel",
         "type": "object"
      },
      "TimeSettingsModel": {
         "description": "Base class for the time settings of the controller / system.\n\nAttributes:\n    calculation: The timeranges and settings f\u00fcr the calculation\n    calibration: The timeranges and settings for the calibration\n    results: The timesettings for the results\n\nTODO: Add the needed fields - calibration?",
         "properties": {
            "calculation": {
               "$ref": "#/$defs/TimeSettingsCalculationModel"
            },
            "calibration": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeSettingsCalibrationModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "results": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeSettingsResultsModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "calculation"
         ],
         "title": "TimeSettingsModel",
         "type": "object"
      },
      "TimeSettingsResultsModel": {
         "description": "Settings for the timesteps of the results.",
         "properties": {
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            }
         },
         "title": "TimeSettingsResultsModel",
         "type": "object"
      },
      "TimeUnits": {
         "description": "Possible time units for the time series data\n\nTODO: Is it better to use standard time units? Like in the unit code?",
         "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "month"
         ],
         "title": "TimeUnits",
         "type": "string"
      },
      "TimerangeTypes": {
         "description": "Enum class for the timedelta types, used for the functions to get timeseries data\n\nAttributes:\n    ABSOLUTE (str): The timedelta is calculated from the actual time \"absolute\"\n    RELATIVE (str): The timedelta is calculated from the last timestamp \"relative\"",
         "enum": [
            "absolute",
            "relative"
         ],
         "title": "TimerangeTypes",
         "type": "string"
      }
   },
   "required": [
      "time_settings"
   ]
}

field time_settings: TimeSettingsModel [Required]
field specific_settings: Optional[dict] = {}
class encodapy.config.models.FileStorageMethod(*values)[source]

Bases: Enum

Enum for the file storage method.

APPEND = 'append'
NEW_FILE = 'new_file'
OVERWRITE = 'overwrite'
pydantic model encodapy.config.models.InputModel[source]

Bases: BaseModel

Model for the configuration of inputs.

Variables:
  • id (str) – The id of the input

  • interface (Interfaces) – The interface of the input

  • id_interface (str | None) – The id of the input on the interface, default is the id

  • attributes (list[AttributeModel]) – A list of attributes for the input as AttributeModel

Show JSON schema
{
   "title": "InputModel",
   "description": "Model for the configuration of inputs.\n\nAttributes:\n    id (str): The id of the input\n    interface (Interfaces): The interface of the input\n    id_interface (str | None): The id of the input on the interface, default is the id\n    attributes (list[AttributeModel]): A list of attributes for the input as AttributeModel",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "interface": {
         "$ref": "#/$defs/Interfaces"
      },
      "id_interface": {
         "default": "",
         "title": "Id Interface",
         "type": "string"
      },
      "attributes": {
         "items": {
            "$ref": "#/$defs/AttributeModel"
         },
         "title": "Attributes",
         "type": "array"
      }
   },
   "$defs": {
      "AttributeModel": {
         "description": "Configuration class for representing attributes with metadata, value,         and optional interface-specific identifier.\n\nThis class models attributes with a unique ID, type, value, unit, and timestamp.\nIf `id_interface` is not set, it defaults to the value of `id`.\n\nAttributes:\n    id (str): The unique identifier of the attribute.\n    id_interface (str): The interface-specific identifier. Defaults to `None`.\n        If not set, it will be automatically set to the value of `id`.\n    type (AttributeTypes): The type of the attribute. Defaults to `AttributeTypes.VALUE`.\n    value (Union[str, float, int, bool, Dict, List, pd.DataFrame, None]):             The value of the attribute. Defaults to `None`.\n    unit (Optional[DataUnits]): The unit of measurement for the value. Defaults to `None`.\n    datatype (DataType): The data type of the attribute. Defaults to `DataType(\"Number\")`.\n    timestamp (Optional[datetime]): The timestamp of the attribute. Defaults to `None`.\n    mqtt_format (Union[MQTTFormatTypes, MQTTTemplateConfig]):             The format of the attribute for MQTT (if not set, the default format is used)                 - only for mqtt interface needed",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "type": {
               "allOf": [
                  {
                     "$ref": "#/$defs/AttributeTypes"
                  }
               ],
               "default": "value"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "object"
                  },
                  {
                     "items": {},
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            },
            "unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DataUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "datatype": {
               "allOf": [
                  {
                     "$ref": "#/$defs/DataType"
                  }
               ],
               "default": "Number"
            },
            "timestamp": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timestamp"
            },
            "mqtt_format": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MQTTFormatTypes"
                  },
                  {
                     "$ref": "#/$defs/MQTTTemplateConfigDoc"
                  }
               ],
               "default": "plain",
               "title": "Mqtt Format"
            }
         },
         "required": [
            "id"
         ],
         "title": "AttributeModel",
         "type": "object"
      },
      "AttributeTypes": {
         "description": "Enum class for the attribute types\n\nAttributes:\n    TIMESERIES (str): Timeseries data \"timeseries\"\n    VALUE (str): Single value data \"value\"",
         "enum": [
            "timeseries",
            "value"
         ],
         "title": "AttributeTypes",
         "type": "string"
      },
      "DataType": {
         "description": "When possible reuse schema.org data types\n(Text, Number, DateTime, StructuredValue, etc.).\nRemember that null is not allowed in NGSI-LD and\ntherefore should be avoided as a value.\n\nhttps://schema.org/DataType",
         "enum": [
            "Boolean",
            "Date",
            "DateTime",
            "Number",
            "Integer",
            "Float",
            "Text",
            "Time",
            "Relationship",
            "StructuredValue",
            "Array",
            "Object",
            "command",
            "commandResult",
            "commandStatus",
            "geo:json"
         ],
         "title": "DataType",
         "type": "string"
      },
      "DataUnits": {
         "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n    - Is there a better way to handle the units?\n    - Add more units?",
         "enum": [
            "SEC",
            "HUR",
            "MIN",
            "CEL",
            "KEL",
            "LTR",
            "MTQ",
            "MQH",
            "MQS",
            "E32",
            "L2",
            "WTT",
            "WHR",
            "KWH",
            "CMT",
            "MTR",
            "MTK",
            "MTS",
            "P1",
            "OHM",
            "VLT"
         ],
         "title": "DataUnits",
         "type": "string"
      },
      "Interfaces": {
         "description": "Enum class for the interfaces\n\nAttributes:\n    MQTT (str): MQTT interface \"mqtt\"\n    FIWARE (str): FIWARE interface \"fiware\"\n    FILE (str): File interface \"file\"",
         "enum": [
            "mqtt",
            "fiware",
            "file"
         ],
         "title": "Interfaces",
         "type": "string"
      },
      "MQTTFormatTypes": {
         "description": "Enum class for MQTT format types\nPossible values:\n- PLAIN (plain): Plain format\n- FIWARE_ATTR (fiware-attr): FIWARE attribute format\n- FIWARE_CMDEXE (fiware-cmdexe): FIWARE command execution format\n- TEMPLATE (template): Template-based format",
         "enum": [
            "plain",
            "fiware-attr",
            "fiware-cmdexe",
            "template"
         ],
         "title": "MQTTFormatTypes",
         "type": "string"
      },
      "MQTTTemplateConfigDoc": {
         "description": "Model for MQTT template configuration.\n\n**Mock class for documentation purposes.**\n\nNote:\n    In the actual implementation, `topic` and `payload` are `jinja2.Template` objects,\n    `time_format` is a `str` as time format for the timestamp in the payload.\n    This mock uses `dict` to avoid import issues during documentation generation.\n    \n    For more information,            see :class:`~encodapy.config.mqtt_messages_template.MQTTTemplateConfig`.",
         "properties": {
            "topic": {
               "title": "Topic",
               "type": "object"
            },
            "payload": {
               "title": "Payload",
               "type": "object"
            },
            "time_format": {
               "default": "%Y-%m-%dT%H:%M:%S%z",
               "title": "Time Format",
               "type": "string"
            }
         },
         "required": [
            "topic",
            "payload"
         ],
         "title": "MQTTTemplateConfigDoc",
         "type": "object"
      }
   },
   "required": [
      "id",
      "interface",
      "attributes"
   ]
}

field id: str [Required]
field interface: Interfaces [Required]
field id_interface: str = ''
field attributes: list[AttributeModel] [Required]
pydantic model encodapy.config.models.InterfaceModel[source]

Bases: BaseModel

Base class for the interfaces

Variables:
  • mqtt (bool) – Whether the MQTT interface is active. Defaults to False.

  • fiware (bool) – Whether the FIWARE interface is active. Defaults to False.

  • file (bool) – Whether the FILE interface is active. Defaults to False.

Show JSON schema
{
   "title": "InterfaceModel",
   "description": "Base class for the interfaces\n\nAttributes:\n    mqtt (bool): Whether the MQTT interface is active. Defaults to False.\n    fiware (bool): Whether the FIWARE interface is active. Defaults to False.\n    file (bool): Whether the FILE interface is active. Defaults to False.",
   "type": "object",
   "properties": {
      "mqtt": {
         "default": false,
         "title": "Mqtt",
         "type": "boolean"
      },
      "fiware": {
         "default": false,
         "title": "Fiware",
         "type": "boolean"
      },
      "file": {
         "default": false,
         "title": "File",
         "type": "boolean"
      }
   }
}

field mqtt: bool = False
field fiware: bool = False
field file: bool = False
pydantic model encodapy.config.models.OutputModel[source]

Bases: BaseModel

Model for the configuration of outputs.

Variables:
  • id – The id of the output

  • interface – The interface of the output

  • id_interface – The id of the output on the interface, default is the id

  • attributes – The attributes of the output

Show JSON schema
{
   "title": "OutputModel",
   "description": "Model for the configuration of outputs.\n\nAttributes:\n    id: The id of the output\n    interface: The interface of the output\n    id_interface: The id of the output on the interface, default is the id\n    attributes: The attributes of the output",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "interface": {
         "$ref": "#/$defs/Interfaces"
      },
      "id_interface": {
         "default": "",
         "title": "Id Interface",
         "type": "string"
      },
      "attributes": {
         "items": {
            "$ref": "#/$defs/AttributeModel"
         },
         "title": "Attributes",
         "type": "array"
      },
      "commands": {
         "items": {
            "$ref": "#/$defs/CommandModel"
         },
         "title": "Commands",
         "type": "array"
      }
   },
   "$defs": {
      "AttributeModel": {
         "description": "Configuration class for representing attributes with metadata, value,         and optional interface-specific identifier.\n\nThis class models attributes with a unique ID, type, value, unit, and timestamp.\nIf `id_interface` is not set, it defaults to the value of `id`.\n\nAttributes:\n    id (str): The unique identifier of the attribute.\n    id_interface (str): The interface-specific identifier. Defaults to `None`.\n        If not set, it will be automatically set to the value of `id`.\n    type (AttributeTypes): The type of the attribute. Defaults to `AttributeTypes.VALUE`.\n    value (Union[str, float, int, bool, Dict, List, pd.DataFrame, None]):             The value of the attribute. Defaults to `None`.\n    unit (Optional[DataUnits]): The unit of measurement for the value. Defaults to `None`.\n    datatype (DataType): The data type of the attribute. Defaults to `DataType(\"Number\")`.\n    timestamp (Optional[datetime]): The timestamp of the attribute. Defaults to `None`.\n    mqtt_format (Union[MQTTFormatTypes, MQTTTemplateConfig]):             The format of the attribute for MQTT (if not set, the default format is used)                 - only for mqtt interface needed",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "type": {
               "allOf": [
                  {
                     "$ref": "#/$defs/AttributeTypes"
                  }
               ],
               "default": "value"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "object"
                  },
                  {
                     "items": {},
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            },
            "unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DataUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "datatype": {
               "allOf": [
                  {
                     "$ref": "#/$defs/DataType"
                  }
               ],
               "default": "Number"
            },
            "timestamp": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timestamp"
            },
            "mqtt_format": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MQTTFormatTypes"
                  },
                  {
                     "$ref": "#/$defs/MQTTTemplateConfigDoc"
                  }
               ],
               "default": "plain",
               "title": "Mqtt Format"
            }
         },
         "required": [
            "id"
         ],
         "title": "AttributeModel",
         "type": "object"
      },
      "AttributeTypes": {
         "description": "Enum class for the attribute types\n\nAttributes:\n    TIMESERIES (str): Timeseries data \"timeseries\"\n    VALUE (str): Single value data \"value\"",
         "enum": [
            "timeseries",
            "value"
         ],
         "title": "AttributeTypes",
         "type": "string"
      },
      "CommandModel": {
         "description": "Configuration class for the commands\n\nAttributes:\n    id (str): The id of the command\n    id_interface (str | None): The id of the command on the interface             (if not set, the id is used)\n    value (Union[str, int, float, List, Dict, None]): The value of the command",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "number"
                  },
                  {
                     "items": {},
                     "type": "array"
                  },
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            }
         },
         "required": [
            "id"
         ],
         "title": "CommandModel",
         "type": "object"
      },
      "DataType": {
         "description": "When possible reuse schema.org data types\n(Text, Number, DateTime, StructuredValue, etc.).\nRemember that null is not allowed in NGSI-LD and\ntherefore should be avoided as a value.\n\nhttps://schema.org/DataType",
         "enum": [
            "Boolean",
            "Date",
            "DateTime",
            "Number",
            "Integer",
            "Float",
            "Text",
            "Time",
            "Relationship",
            "StructuredValue",
            "Array",
            "Object",
            "command",
            "commandResult",
            "commandStatus",
            "geo:json"
         ],
         "title": "DataType",
         "type": "string"
      },
      "DataUnits": {
         "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n    - Is there a better way to handle the units?\n    - Add more units?",
         "enum": [
            "SEC",
            "HUR",
            "MIN",
            "CEL",
            "KEL",
            "LTR",
            "MTQ",
            "MQH",
            "MQS",
            "E32",
            "L2",
            "WTT",
            "WHR",
            "KWH",
            "CMT",
            "MTR",
            "MTK",
            "MTS",
            "P1",
            "OHM",
            "VLT"
         ],
         "title": "DataUnits",
         "type": "string"
      },
      "Interfaces": {
         "description": "Enum class for the interfaces\n\nAttributes:\n    MQTT (str): MQTT interface \"mqtt\"\n    FIWARE (str): FIWARE interface \"fiware\"\n    FILE (str): File interface \"file\"",
         "enum": [
            "mqtt",
            "fiware",
            "file"
         ],
         "title": "Interfaces",
         "type": "string"
      },
      "MQTTFormatTypes": {
         "description": "Enum class for MQTT format types\nPossible values:\n- PLAIN (plain): Plain format\n- FIWARE_ATTR (fiware-attr): FIWARE attribute format\n- FIWARE_CMDEXE (fiware-cmdexe): FIWARE command execution format\n- TEMPLATE (template): Template-based format",
         "enum": [
            "plain",
            "fiware-attr",
            "fiware-cmdexe",
            "template"
         ],
         "title": "MQTTFormatTypes",
         "type": "string"
      },
      "MQTTTemplateConfigDoc": {
         "description": "Model for MQTT template configuration.\n\n**Mock class for documentation purposes.**\n\nNote:\n    In the actual implementation, `topic` and `payload` are `jinja2.Template` objects,\n    `time_format` is a `str` as time format for the timestamp in the payload.\n    This mock uses `dict` to avoid import issues during documentation generation.\n    \n    For more information,            see :class:`~encodapy.config.mqtt_messages_template.MQTTTemplateConfig`.",
         "properties": {
            "topic": {
               "title": "Topic",
               "type": "object"
            },
            "payload": {
               "title": "Payload",
               "type": "object"
            },
            "time_format": {
               "default": "%Y-%m-%dT%H:%M:%S%z",
               "title": "Time Format",
               "type": "string"
            }
         },
         "required": [
            "topic",
            "payload"
         ],
         "title": "MQTTTemplateConfigDoc",
         "type": "object"
      }
   },
   "required": [
      "id",
      "interface",
      "attributes"
   ]
}

field id: str [Required]
field interface: Interfaces [Required]
field id_interface: str = ''
field attributes: list[AttributeModel] [Required]
field commands: list[CommandModel] [Optional]
pydantic model encodapy.config.models.StaticDataModel[source]

Bases: InputModel

Model for the configuration of inputs.

Variables:
  • id (str) – The id of the input

  • interface (Interfaces) – The interface of the input

  • id_interface (str | None) – The id of the input on the interface

  • attributes (list[AttributeModel]) – A list of attributes for the static data as AttributeModel

Show JSON schema
{
   "title": "StaticDataModel",
   "description": "Model for the configuration of inputs.\n\nAttributes:\n    id (str): The id of the input\n    interface (Interfaces): The interface of the input\n    id_interface (str | None): The id of the input on the interface\n    attributes (list[AttributeModel]): A list of attributes for the static data             as AttributeModel",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "interface": {
         "$ref": "#/$defs/Interfaces"
      },
      "id_interface": {
         "default": "",
         "title": "Id Interface",
         "type": "string"
      },
      "attributes": {
         "items": {
            "$ref": "#/$defs/AttributeModel"
         },
         "title": "Attributes",
         "type": "array"
      }
   },
   "$defs": {
      "AttributeModel": {
         "description": "Configuration class for representing attributes with metadata, value,         and optional interface-specific identifier.\n\nThis class models attributes with a unique ID, type, value, unit, and timestamp.\nIf `id_interface` is not set, it defaults to the value of `id`.\n\nAttributes:\n    id (str): The unique identifier of the attribute.\n    id_interface (str): The interface-specific identifier. Defaults to `None`.\n        If not set, it will be automatically set to the value of `id`.\n    type (AttributeTypes): The type of the attribute. Defaults to `AttributeTypes.VALUE`.\n    value (Union[str, float, int, bool, Dict, List, pd.DataFrame, None]):             The value of the attribute. Defaults to `None`.\n    unit (Optional[DataUnits]): The unit of measurement for the value. Defaults to `None`.\n    datatype (DataType): The data type of the attribute. Defaults to `DataType(\"Number\")`.\n    timestamp (Optional[datetime]): The timestamp of the attribute. Defaults to `None`.\n    mqtt_format (Union[MQTTFormatTypes, MQTTTemplateConfig]):             The format of the attribute for MQTT (if not set, the default format is used)                 - only for mqtt interface needed",
         "properties": {
            "id": {
               "title": "Id",
               "type": "string"
            },
            "id_interface": {
               "default": "",
               "title": "Id Interface",
               "type": "string"
            },
            "type": {
               "allOf": [
                  {
                     "$ref": "#/$defs/AttributeTypes"
                  }
               ],
               "default": "value"
            },
            "value": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "object"
                  },
                  {
                     "items": {},
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Value"
            },
            "unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DataUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "datatype": {
               "allOf": [
                  {
                     "$ref": "#/$defs/DataType"
                  }
               ],
               "default": "Number"
            },
            "timestamp": {
               "anyOf": [
                  {
                     "format": "date-time",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timestamp"
            },
            "mqtt_format": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MQTTFormatTypes"
                  },
                  {
                     "$ref": "#/$defs/MQTTTemplateConfigDoc"
                  }
               ],
               "default": "plain",
               "title": "Mqtt Format"
            }
         },
         "required": [
            "id"
         ],
         "title": "AttributeModel",
         "type": "object"
      },
      "AttributeTypes": {
         "description": "Enum class for the attribute types\n\nAttributes:\n    TIMESERIES (str): Timeseries data \"timeseries\"\n    VALUE (str): Single value data \"value\"",
         "enum": [
            "timeseries",
            "value"
         ],
         "title": "AttributeTypes",
         "type": "string"
      },
      "DataType": {
         "description": "When possible reuse schema.org data types\n(Text, Number, DateTime, StructuredValue, etc.).\nRemember that null is not allowed in NGSI-LD and\ntherefore should be avoided as a value.\n\nhttps://schema.org/DataType",
         "enum": [
            "Boolean",
            "Date",
            "DateTime",
            "Number",
            "Integer",
            "Float",
            "Text",
            "Time",
            "Relationship",
            "StructuredValue",
            "Array",
            "Object",
            "command",
            "commandResult",
            "commandStatus",
            "geo:json"
         ],
         "title": "DataType",
         "type": "string"
      },
      "DataUnits": {
         "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n    - Is there a better way to handle the units?\n    - Add more units?",
         "enum": [
            "SEC",
            "HUR",
            "MIN",
            "CEL",
            "KEL",
            "LTR",
            "MTQ",
            "MQH",
            "MQS",
            "E32",
            "L2",
            "WTT",
            "WHR",
            "KWH",
            "CMT",
            "MTR",
            "MTK",
            "MTS",
            "P1",
            "OHM",
            "VLT"
         ],
         "title": "DataUnits",
         "type": "string"
      },
      "Interfaces": {
         "description": "Enum class for the interfaces\n\nAttributes:\n    MQTT (str): MQTT interface \"mqtt\"\n    FIWARE (str): FIWARE interface \"fiware\"\n    FILE (str): File interface \"file\"",
         "enum": [
            "mqtt",
            "fiware",
            "file"
         ],
         "title": "Interfaces",
         "type": "string"
      },
      "MQTTFormatTypes": {
         "description": "Enum class for MQTT format types\nPossible values:\n- PLAIN (plain): Plain format\n- FIWARE_ATTR (fiware-attr): FIWARE attribute format\n- FIWARE_CMDEXE (fiware-cmdexe): FIWARE command execution format\n- TEMPLATE (template): Template-based format",
         "enum": [
            "plain",
            "fiware-attr",
            "fiware-cmdexe",
            "template"
         ],
         "title": "MQTTFormatTypes",
         "type": "string"
      },
      "MQTTTemplateConfigDoc": {
         "description": "Model for MQTT template configuration.\n\n**Mock class for documentation purposes.**\n\nNote:\n    In the actual implementation, `topic` and `payload` are `jinja2.Template` objects,\n    `time_format` is a `str` as time format for the timestamp in the payload.\n    This mock uses `dict` to avoid import issues during documentation generation.\n    \n    For more information,            see :class:`~encodapy.config.mqtt_messages_template.MQTTTemplateConfig`.",
         "properties": {
            "topic": {
               "title": "Topic",
               "type": "object"
            },
            "payload": {
               "title": "Payload",
               "type": "object"
            },
            "time_format": {
               "default": "%Y-%m-%dT%H:%M:%S%z",
               "title": "Time Format",
               "type": "string"
            }
         },
         "required": [
            "topic",
            "payload"
         ],
         "title": "MQTTTemplateConfigDoc",
         "type": "object"
      }
   },
   "required": [
      "id",
      "interface",
      "attributes"
   ]
}

pydantic model encodapy.config.models.TimeSettingsCalculationModel[source]

Bases: BaseModel

Base class for the calculation time settings of the controller / system.

Variables:
  • timerange – The timerange for the calculation (if only one value is needed and primary value , otherwise use timerange_min and timerange_max)

  • timerange_min – The minimum timerange for the calculation (only used if timerange is not set and timerange_max is set too)

  • timerange_max – The maximum timerange for the calculation (only used if timerange is not set and timerange_min is set too)

  • timerange_type – Type of time period, relative to the last result or absolute at the current time (if not set, the default type is absolute)

  • timerange_unit – The unit of the timerange (if not set, the default unit is minute)

  • timestep – The timestep for the calculation (if not set, the default value is 1), the related unit is defined in the timestep_unit attribute

  • timestep_unit – The unit of the timestep (if not set, the default unit is second)

  • sampling_time – The sampling time for the calculation (if not set, the default value is 1), the related unit is defined in the sampling_time_unit attribute

  • sampling_time_unit – The unit of the sampling time (if not set, the default unit is minute)

Show JSON schema
{
   "title": "TimeSettingsCalculationModel",
   "description": "Base class for the calculation time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calculation (if only one value is needed and primary value            , otherwise use timerange_min and timerange_max)\n    timerange_min: The minimum timerange for the calculation (only used if timerange is not set            and timerange_max is set too)\n    timerange_max: The maximum timerange for the calculation (only used if timerange is not set            and timerange_min is set too)\n    timerange_type: Type of time period, relative to the last result or absolute at the current            time (if not set, the default type is absolute)\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calculation (if not set, the default value is 1), the            related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calculation (if not set, the default value is 1),            the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is minute)",
   "type": "object",
   "properties": {
      "timerange": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Timerange"
      },
      "timerange_min": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Timerange Min"
      },
      "timerange_max": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Timerange Max"
      },
      "timerange_type": {
         "anyOf": [
            {
               "$ref": "#/$defs/TimerangeTypes"
            },
            {
               "type": "null"
            }
         ],
         "default": "absolute"
      },
      "timerange_unit": {
         "anyOf": [
            {
               "$ref": "#/$defs/TimeUnits"
            },
            {
               "type": "null"
            }
         ],
         "default": "minute"
      },
      "timestep": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            }
         ],
         "default": 1,
         "title": "Timestep"
      },
      "timestep_unit": {
         "allOf": [
            {
               "$ref": "#/$defs/TimeUnits"
            }
         ],
         "default": "second"
      },
      "sampling_time": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            }
         ],
         "default": 1,
         "title": "Sampling Time"
      },
      "sampling_time_unit": {
         "allOf": [
            {
               "$ref": "#/$defs/TimeUnits"
            }
         ],
         "default": "minute"
      }
   },
   "$defs": {
      "TimeUnits": {
         "description": "Possible time units for the time series data\n\nTODO: Is it better to use standard time units? Like in the unit code?",
         "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "month"
         ],
         "title": "TimeUnits",
         "type": "string"
      },
      "TimerangeTypes": {
         "description": "Enum class for the timedelta types, used for the functions to get timeseries data\n\nAttributes:\n    ABSOLUTE (str): The timedelta is calculated from the actual time \"absolute\"\n    RELATIVE (str): The timedelta is calculated from the last timestamp \"relative\"",
         "enum": [
            "absolute",
            "relative"
         ],
         "title": "TimerangeTypes",
         "type": "string"
      }
   }
}

field timerange: Optional[float] = None
field timerange_min: Optional[float] = None
field timerange_max: Optional[float] = None
field timerange_type: Optional[TimerangeTypes] = TimerangeTypes.ABSOLUTE
field timerange_unit: Optional[TimeUnits] = TimeUnits.MINUTE
field timestep: Union[float, int] = 1
field timestep_unit: TimeUnits = TimeUnits.SECOND
field sampling_time: Union[float, int] = 1
field sampling_time_unit: TimeUnits = TimeUnits.MINUTE
pydantic model encodapy.config.models.TimeSettingsCalibrationModel[source]

Bases: BaseModel

Base class for the calibration time settings of the controller / system.

Variables:
  • timerange – The timerange for the calibration (if not set, the default value is 1), the related unit is defined in the timerange_unit attribute

  • timerange_unit – The unit of the timerange (if not set, the default unit is minute)

  • timestep – The timestep for the calibration (if not set, the default value is 1), the related unit is defined in the timestep_unit attribute

  • timestep_unit – The unit of the timestep (if not set, the default unit is second)

  • sampling_time – The sampling time for the calibration (if not set, the default value is 1), the related unit is defined in the sampling_time_unit attribute

  • sampling_time_unit – The unit of the sampling time (if not set, the default unit is day)

Show JSON schema
{
   "title": "TimeSettingsCalibrationModel",
   "description": "Base class for the calibration time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calibration (if not set, the default value is 1),             the related unit is defined in the timerange_unit attribute\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calibration (if not set, the default value is 1),             the related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calibration (if not set, the default value is 1),             the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is day)",
   "type": "object",
   "properties": {
      "timerange": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Timerange"
      },
      "timerange_unit": {
         "anyOf": [
            {
               "$ref": "#/$defs/TimeUnits"
            },
            {
               "type": "null"
            }
         ],
         "default": "minute"
      },
      "timestep": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            }
         ],
         "default": 1,
         "title": "Timestep"
      },
      "timestep_unit": {
         "allOf": [
            {
               "$ref": "#/$defs/TimeUnits"
            }
         ],
         "default": "second"
      },
      "sampling_time": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            }
         ],
         "default": 1,
         "title": "Sampling Time"
      },
      "sampling_time_unit": {
         "allOf": [
            {
               "$ref": "#/$defs/TimeUnits"
            }
         ],
         "default": "day"
      }
   },
   "$defs": {
      "TimeUnits": {
         "description": "Possible time units for the time series data\n\nTODO: Is it better to use standard time units? Like in the unit code?",
         "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "month"
         ],
         "title": "TimeUnits",
         "type": "string"
      }
   }
}

field timerange: Optional[float] = None
field timerange_unit: Optional[TimeUnits] = TimeUnits.MINUTE
field timestep: Union[float, int] = 1
field timestep_unit: TimeUnits = TimeUnits.SECOND
field sampling_time: Union[float, int] = 1
field sampling_time_unit: TimeUnits = TimeUnits.DAY
pydantic model encodapy.config.models.TimeSettingsModel[source]

Bases: BaseModel

Base class for the time settings of the controller / system.

Variables:
  • calculation – The timeranges and settings für the calculation

  • calibration – The timeranges and settings for the calibration

  • results – The timesettings for the results

TODO: Add the needed fields - calibration?

Show JSON schema
{
   "title": "TimeSettingsModel",
   "description": "Base class for the time settings of the controller / system.\n\nAttributes:\n    calculation: The timeranges and settings f\u00fcr the calculation\n    calibration: The timeranges and settings for the calibration\n    results: The timesettings for the results\n\nTODO: Add the needed fields - calibration?",
   "type": "object",
   "properties": {
      "calculation": {
         "$ref": "#/$defs/TimeSettingsCalculationModel"
      },
      "calibration": {
         "anyOf": [
            {
               "$ref": "#/$defs/TimeSettingsCalibrationModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "results": {
         "anyOf": [
            {
               "$ref": "#/$defs/TimeSettingsResultsModel"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "TimeSettingsCalculationModel": {
         "description": "Base class for the calculation time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calculation (if only one value is needed and primary value            , otherwise use timerange_min and timerange_max)\n    timerange_min: The minimum timerange for the calculation (only used if timerange is not set            and timerange_max is set too)\n    timerange_max: The maximum timerange for the calculation (only used if timerange is not set            and timerange_min is set too)\n    timerange_type: Type of time period, relative to the last result or absolute at the current            time (if not set, the default type is absolute)\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calculation (if not set, the default value is 1), the            related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calculation (if not set, the default value is 1),            the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is minute)",
         "properties": {
            "timerange": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange"
            },
            "timerange_min": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange Min"
            },
            "timerange_max": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange Max"
            },
            "timerange_type": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimerangeTypes"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "absolute"
            },
            "timerange_unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "minute"
            },
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            },
            "sampling_time": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Sampling Time"
            },
            "sampling_time_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "minute"
            }
         },
         "title": "TimeSettingsCalculationModel",
         "type": "object"
      },
      "TimeSettingsCalibrationModel": {
         "description": "Base class for the calibration time settings of the controller / system.\n\nAttributes:\n    timerange: The timerange for the calibration (if not set, the default value is 1),             the related unit is defined in the timerange_unit attribute\n    timerange_unit: The unit of the timerange (if not set, the default unit is minute)\n    timestep: The timestep for the calibration (if not set, the default value is 1),             the related unit is defined in the timestep_unit attribute\n    timestep_unit: The unit of the timestep (if not set, the default unit is second)\n    sampling_time: The sampling time for the calibration (if not set, the default value is 1),             the related unit is defined in the sampling_time_unit attribute\n    sampling_time_unit: The unit of the sampling time (if not set, the default unit is day)",
         "properties": {
            "timerange": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Timerange"
            },
            "timerange_unit": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "minute"
            },
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            },
            "sampling_time": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Sampling Time"
            },
            "sampling_time_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "day"
            }
         },
         "title": "TimeSettingsCalibrationModel",
         "type": "object"
      },
      "TimeSettingsResultsModel": {
         "description": "Settings for the timesteps of the results.",
         "properties": {
            "timestep": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "integer"
                  }
               ],
               "default": 1,
               "title": "Timestep"
            },
            "timestep_unit": {
               "allOf": [
                  {
                     "$ref": "#/$defs/TimeUnits"
                  }
               ],
               "default": "second"
            }
         },
         "title": "TimeSettingsResultsModel",
         "type": "object"
      },
      "TimeUnits": {
         "description": "Possible time units for the time series data\n\nTODO: Is it better to use standard time units? Like in the unit code?",
         "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "month"
         ],
         "title": "TimeUnits",
         "type": "string"
      },
      "TimerangeTypes": {
         "description": "Enum class for the timedelta types, used for the functions to get timeseries data\n\nAttributes:\n    ABSOLUTE (str): The timedelta is calculated from the actual time \"absolute\"\n    RELATIVE (str): The timedelta is calculated from the last timestamp \"relative\"",
         "enum": [
            "absolute",
            "relative"
         ],
         "title": "TimerangeTypes",
         "type": "string"
      }
   },
   "required": [
      "calculation"
   ]
}

field calculation: TimeSettingsCalculationModel [Required]
field calibration: Optional[TimeSettingsCalibrationModel] = None
field results: Optional[TimeSettingsResultsModel] = None
pydantic model encodapy.config.models.TimeSettingsResultsModel[source]

Bases: BaseModel

Settings for the timesteps of the results.

Show JSON schema
{
   "title": "TimeSettingsResultsModel",
   "description": "Settings for the timesteps of the results.",
   "type": "object",
   "properties": {
      "timestep": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "integer"
            }
         ],
         "default": 1,
         "title": "Timestep"
      },
      "timestep_unit": {
         "allOf": [
            {
               "$ref": "#/$defs/TimeUnits"
            }
         ],
         "default": "second"
      }
   },
   "$defs": {
      "TimeUnits": {
         "description": "Possible time units for the time series data\n\nTODO: Is it better to use standard time units? Like in the unit code?",
         "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "month"
         ],
         "title": "TimeUnits",
         "type": "string"
      }
   }
}

field timestep: Union[float, int] = 1
field timestep_unit: TimeUnits = TimeUnits.SECOND