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.time_settings (
TimeSettingsModel) – Time 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 time_settings (TimeSettingsModel): Time 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" }, "time_settings": { "$ref": "#/$defs/TimeSettingsModel" } }, "$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, pd.Series, 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\n factor (float): Optional scaling factor for interface values (default 1.0). The raw interface value is multiplied by `factor` on input, and the internal value is multiplied by `factor` before publishing/sending. Applies to all communication connections (MQTT, FIWARE, FILE) in both directions (input and output) for numeric values and numeric timeseries columns (DataFrames / Series); the default 1.0 leaves values unchanged. Do not combine `factor` with other scaling mechanisms (FIWARE unit conversion or scaling expressions in MQTT templates) - values would be scaled twice. Rationale (why): devices behind Modbus-based gateways often transmit values in a fixed scaling (e.g. tenths of a degree), so the real physical value is ``interface value * factor``.", "properties": { "id": { "title": "Id", "type": "string" }, "id_interface": { "default": "", "title": "Id Interface", "type": "string" }, "type": { "$ref": "#/$defs/AttributeTypes", "default": "value" }, "value": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "integer" }, { "type": "boolean" }, { "additionalProperties": true, "type": "object" }, { "items": {}, "type": "array" }, { "type": "null" } ], "default": null, "title": "Value" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "datatype": { "$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" }, "factor": { "default": 1.0, "title": "Factor", "type": "number" } }, "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" }, { "additionalProperties": true, "type": "object" }, { "type": "boolean" }, { "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" }, "DataPointGeneral": { "description": "Model for datapoints with a general value.\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\n\nThe enum value is the standardized unit code (e.g., \"SEC\" for seconds).\nThe pint_unit attribute contains the corresponding pint unit string for conversion.\n\nTo add a new unit, add it to the DataUnits enum: UNIT_NAME = (\"CODE\", \"pint_string\")\nThe _UNIT_MAP will be generated automatically from the pint_unit attributes.\n\nUsage:\n - DataUnits.PERCENT.value -> \"P1\" (unit code, for serialization)\n - DataUnits.PERCENT.pint_unit -> \"percent\" (for pint conversion)\n - DataUnits(\"P1\") -> DataUnits.PERCENT (lookup by unit code)", "enum": [ "SEC", "MIN", "HUR", "DAY", "MON", "ANN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "KWT", "WHR", "KWH", "CMT", "MTR", "MTK", "DD", "MTS", "P1", "OHM", "VLT", "A97", "PAL", "B13" ], "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": { "additionalProperties": true, "title": "Topic", "type": "object" }, "payload": { "additionalProperties": true, "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": { "$ref": "#/$defs/TimeUnits", "default": "minute" }, "timestep": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Timestep" }, "timestep_unit": { "$ref": "#/$defs/TimeUnits", "default": "second" }, "sampling_time": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Sampling Time" }, "sampling_time_unit": { "$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": { "$ref": "#/$defs/TimeUnits", "default": "minute" }, "timestep": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Timestep" }, "timestep_unit": { "$ref": "#/$defs/TimeUnits", "default": "second" }, "sampling_time": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Sampling Time" }, "sampling_time_unit": { "$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", "properties": { "calculation": { "$ref": "#/$defs/TimeSettingsCalculationModel" }, "calibration": { "anyOf": [ { "$ref": "#/$defs/TimeSettingsCalibrationModel" }, { "type": "null" } ], "default": null } }, "required": [ "calculation" ], "title": "TimeSettingsModel", "type": "object" }, "TimeUnits": { "description": "Possible time units for the time series data\n\nUsed for the configuration of time series queries\nand calculations in the system controller.", "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", "time_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 time_settings: TimeSettingsModel [Required]
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": null, "description": "Time in seconds to hold the start of the service", "title": "Start Hold Time" } } }
- Config:
extra: str = ignore
env_file: str = .env
- field log_path: str | None = None
Path to the log file. If not provided, logs will be printed to the console. Example: ‘./logs/service.log’
- field log_retention: int | str | timedelta | None = 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: int | str | time | timedelta | None = 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).
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:
BaseModelConfiguration 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,pd.Series,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 neededfactor (
float) – Optional scaling factor for interface values (default 1.0). The raw interface value is multiplied by factor on input, and the internal value is multiplied by factor before publishing/sending. Applies to all communication connections (MQTT, FIWARE, FILE) in both directions (input and output) for numeric values and numeric timeseries columns (DataFrames / Series); the default 1.0 leaves values unchanged. Do not combine factor with other scaling mechanisms (FIWARE unit conversion or scaling expressions in MQTT templates) - values would be scaled twice. Rationale (why): devices behind Modbus-based gateways often transmit values in a fixed scaling (e.g. tenths of a degree), so the real physical value isinterface value * factor.
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, pd.Series, 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\n factor (float): Optional scaling factor for interface values (default 1.0). The raw interface value is multiplied by `factor` on input, and the internal value is multiplied by `factor` before publishing/sending. Applies to all communication connections (MQTT, FIWARE, FILE) in both directions (input and output) for numeric values and numeric timeseries columns (DataFrames / Series); the default 1.0 leaves values unchanged. Do not combine `factor` with other scaling mechanisms (FIWARE unit conversion or scaling expressions in MQTT templates) - values would be scaled twice. Rationale (why): devices behind Modbus-based gateways often transmit values in a fixed scaling (e.g. tenths of a degree), so the real physical value is ``interface value * factor``.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "id_interface": { "default": "", "title": "Id Interface", "type": "string" }, "type": { "$ref": "#/$defs/AttributeTypes", "default": "value" }, "value": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "integer" }, { "type": "boolean" }, { "additionalProperties": true, "type": "object" }, { "items": {}, "type": "array" }, { "type": "null" } ], "default": null, "title": "Value" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "datatype": { "$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" }, "factor": { "default": 1.0, "title": "Factor", "type": "number" } }, "$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\n\nThe enum value is the standardized unit code (e.g., \"SEC\" for seconds).\nThe pint_unit attribute contains the corresponding pint unit string for conversion.\n\nTo add a new unit, add it to the DataUnits enum: UNIT_NAME = (\"CODE\", \"pint_string\")\nThe _UNIT_MAP will be generated automatically from the pint_unit attributes.\n\nUsage:\n - DataUnits.PERCENT.value -> \"P1\" (unit code, for serialization)\n - DataUnits.PERCENT.pint_unit -> \"percent\" (for pint conversion)\n - DataUnits(\"P1\") -> DataUnits.PERCENT (lookup by unit code)", "enum": [ "SEC", "MIN", "HUR", "DAY", "MON", "ANN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "KWT", "WHR", "KWH", "CMT", "MTR", "MTK", "DD", "MTS", "P1", "OHM", "VLT", "A97", "PAL", "B13" ], "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": { "additionalProperties": true, "title": "Topic", "type": "object" }, "payload": { "additionalProperties": true, "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 type: AttributeTypes = AttributeTypes.VALUE
- field mqtt_format: MQTTFormatTypes | MQTTTemplateConfigDoc = MQTTFormatTypes.PLAIN
- pydantic model encodapy.config.models.CommandModel[source]
Bases:
BaseModelConfiguration class for the commands
- Variables:
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" }, { "additionalProperties": true, "type": "object" }, { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Value" } }, "required": [ "id" ] }
- class encodapy.config.models.FileStorageMethod(*values)[source]
Bases:
EnumEnum for the file storage method.
- APPEND = 'append'
- NEW_FILE = 'new_file'
- OVERWRITE = 'overwrite'
- pydantic model encodapy.config.models.InputModel[source]
Bases:
BaseModelModel for the configuration of inputs.
- Variables:
id (
str) – The id of the inputinterface (
Interfaces) – The interface of the inputid_interface (
str | None) – The id of the input on the interface, default is the idattributes (
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, pd.Series, 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\n factor (float): Optional scaling factor for interface values (default 1.0). The raw interface value is multiplied by `factor` on input, and the internal value is multiplied by `factor` before publishing/sending. Applies to all communication connections (MQTT, FIWARE, FILE) in both directions (input and output) for numeric values and numeric timeseries columns (DataFrames / Series); the default 1.0 leaves values unchanged. Do not combine `factor` with other scaling mechanisms (FIWARE unit conversion or scaling expressions in MQTT templates) - values would be scaled twice. Rationale (why): devices behind Modbus-based gateways often transmit values in a fixed scaling (e.g. tenths of a degree), so the real physical value is ``interface value * factor``.", "properties": { "id": { "title": "Id", "type": "string" }, "id_interface": { "default": "", "title": "Id Interface", "type": "string" }, "type": { "$ref": "#/$defs/AttributeTypes", "default": "value" }, "value": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "integer" }, { "type": "boolean" }, { "additionalProperties": true, "type": "object" }, { "items": {}, "type": "array" }, { "type": "null" } ], "default": null, "title": "Value" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "datatype": { "$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" }, "factor": { "default": 1.0, "title": "Factor", "type": "number" } }, "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\n\nThe enum value is the standardized unit code (e.g., \"SEC\" for seconds).\nThe pint_unit attribute contains the corresponding pint unit string for conversion.\n\nTo add a new unit, add it to the DataUnits enum: UNIT_NAME = (\"CODE\", \"pint_string\")\nThe _UNIT_MAP will be generated automatically from the pint_unit attributes.\n\nUsage:\n - DataUnits.PERCENT.value -> \"P1\" (unit code, for serialization)\n - DataUnits.PERCENT.pint_unit -> \"percent\" (for pint conversion)\n - DataUnits(\"P1\") -> DataUnits.PERCENT (lookup by unit code)", "enum": [ "SEC", "MIN", "HUR", "DAY", "MON", "ANN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "KWT", "WHR", "KWH", "CMT", "MTR", "MTK", "DD", "MTS", "P1", "OHM", "VLT", "A97", "PAL", "B13" ], "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": { "additionalProperties": true, "title": "Topic", "type": "object" }, "payload": { "additionalProperties": true, "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 interface: Interfaces [Required]
- field attributes: list[AttributeModel] [Required]
- pydantic model encodapy.config.models.InterfaceModel[source]
Bases:
BaseModelBase class for the interfaces
- Variables:
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" } } }
- pydantic model encodapy.config.models.OutputModel[source]
Bases:
BaseModelModel for the configuration of outputs.
- Variables:
id (
str) – The id of the outputinterface (
Interfaces) – The interface of the outputid_interface (
str) – The id of the output on the interface, default is the idattributes (
list[AttributeModel]) – 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, pd.Series, 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\n factor (float): Optional scaling factor for interface values (default 1.0). The raw interface value is multiplied by `factor` on input, and the internal value is multiplied by `factor` before publishing/sending. Applies to all communication connections (MQTT, FIWARE, FILE) in both directions (input and output) for numeric values and numeric timeseries columns (DataFrames / Series); the default 1.0 leaves values unchanged. Do not combine `factor` with other scaling mechanisms (FIWARE unit conversion or scaling expressions in MQTT templates) - values would be scaled twice. Rationale (why): devices behind Modbus-based gateways often transmit values in a fixed scaling (e.g. tenths of a degree), so the real physical value is ``interface value * factor``.", "properties": { "id": { "title": "Id", "type": "string" }, "id_interface": { "default": "", "title": "Id Interface", "type": "string" }, "type": { "$ref": "#/$defs/AttributeTypes", "default": "value" }, "value": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "integer" }, { "type": "boolean" }, { "additionalProperties": true, "type": "object" }, { "items": {}, "type": "array" }, { "type": "null" } ], "default": null, "title": "Value" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "datatype": { "$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" }, "factor": { "default": 1.0, "title": "Factor", "type": "number" } }, "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" }, { "additionalProperties": true, "type": "object" }, { "type": "boolean" }, { "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\n\nThe enum value is the standardized unit code (e.g., \"SEC\" for seconds).\nThe pint_unit attribute contains the corresponding pint unit string for conversion.\n\nTo add a new unit, add it to the DataUnits enum: UNIT_NAME = (\"CODE\", \"pint_string\")\nThe _UNIT_MAP will be generated automatically from the pint_unit attributes.\n\nUsage:\n - DataUnits.PERCENT.value -> \"P1\" (unit code, for serialization)\n - DataUnits.PERCENT.pint_unit -> \"percent\" (for pint conversion)\n - DataUnits(\"P1\") -> DataUnits.PERCENT (lookup by unit code)", "enum": [ "SEC", "MIN", "HUR", "DAY", "MON", "ANN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "KWT", "WHR", "KWH", "CMT", "MTR", "MTK", "DD", "MTS", "P1", "OHM", "VLT", "A97", "PAL", "B13" ], "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": { "additionalProperties": true, "title": "Topic", "type": "object" }, "payload": { "additionalProperties": true, "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 interface: Interfaces [Required]
- field attributes: list[AttributeModel] [Required]
- field commands: list[CommandModel] [Optional]
- pydantic model encodapy.config.models.StaticDataModel[source]
Bases:
InputModelModel for the configuration of inputs.
- Variables:
id (
str) – The id of the inputinterface (
Interfaces) – The interface of the inputid_interface (
str | None) – The id of the input on the interfaceattributes (
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, pd.Series, 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\n factor (float): Optional scaling factor for interface values (default 1.0). The raw interface value is multiplied by `factor` on input, and the internal value is multiplied by `factor` before publishing/sending. Applies to all communication connections (MQTT, FIWARE, FILE) in both directions (input and output) for numeric values and numeric timeseries columns (DataFrames / Series); the default 1.0 leaves values unchanged. Do not combine `factor` with other scaling mechanisms (FIWARE unit conversion or scaling expressions in MQTT templates) - values would be scaled twice. Rationale (why): devices behind Modbus-based gateways often transmit values in a fixed scaling (e.g. tenths of a degree), so the real physical value is ``interface value * factor``.", "properties": { "id": { "title": "Id", "type": "string" }, "id_interface": { "default": "", "title": "Id Interface", "type": "string" }, "type": { "$ref": "#/$defs/AttributeTypes", "default": "value" }, "value": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "integer" }, { "type": "boolean" }, { "additionalProperties": true, "type": "object" }, { "items": {}, "type": "array" }, { "type": "null" } ], "default": null, "title": "Value" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "datatype": { "$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" }, "factor": { "default": 1.0, "title": "Factor", "type": "number" } }, "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\n\nThe enum value is the standardized unit code (e.g., \"SEC\" for seconds).\nThe pint_unit attribute contains the corresponding pint unit string for conversion.\n\nTo add a new unit, add it to the DataUnits enum: UNIT_NAME = (\"CODE\", \"pint_string\")\nThe _UNIT_MAP will be generated automatically from the pint_unit attributes.\n\nUsage:\n - DataUnits.PERCENT.value -> \"P1\" (unit code, for serialization)\n - DataUnits.PERCENT.pint_unit -> \"percent\" (for pint conversion)\n - DataUnits(\"P1\") -> DataUnits.PERCENT (lookup by unit code)", "enum": [ "SEC", "MIN", "HUR", "DAY", "MON", "ANN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "KWT", "WHR", "KWH", "CMT", "MTR", "MTK", "DD", "MTS", "P1", "OHM", "VLT", "A97", "PAL", "B13" ], "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": { "additionalProperties": true, "title": "Topic", "type": "object" }, "payload": { "additionalProperties": true, "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:
BaseModelBase class for the calculation time settings of the controller / system.
- Variables:
timerange (
float|None) – The timerange for the calculation (if only one value is needed and primary value , otherwise use timerange_min and timerange_max)timerange_min (
float|None) – The minimum timerange for the calculation (only used if timerange is not set and timerange_max is set too)timerange_max (
float|None) – The maximum timerange for the calculation (only used if timerange is not set and timerange_min is set too)timerange_type (
TimerangeTypes|None) – 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 (
TimeUnits) – The unit of the timerange (if not set, the default unit is minute)timestep (
float|int) – The timestep for the calculation (if not set, the default value is 1), the related unit is defined in the timestep_unit attributetimestep_unit (
TimeUnits) – The unit of the timestep (if not set, the default unit is second)sampling_time (
float|int) – The sampling time for the calculation (if not set, the default value is 1), the related unit is defined in the sampling_time_unit attributesampling_time_unit (
TimeUnits) – 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": { "$ref": "#/$defs/TimeUnits", "default": "minute" }, "timestep": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Timestep" }, "timestep_unit": { "$ref": "#/$defs/TimeUnits", "default": "second" }, "sampling_time": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Sampling Time" }, "sampling_time_unit": { "$ref": "#/$defs/TimeUnits", "default": "minute" } }, "$defs": { "TimeUnits": { "description": "Possible time units for the time series data\n\nUsed for the configuration of time series queries\nand calculations in the system controller.", "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_type: TimerangeTypes | None = TimerangeTypes.ABSOLUTE
- pydantic model encodapy.config.models.TimeSettingsCalibrationModel[source]
Bases:
BaseModelBase class for the calibration time settings of the controller / system.
- Variables:
timerange (
float|None) – The timerange for the calibration (if not set, the default value is 1), the related unit is defined in the timerange_unit attributetimerange_unit (
TimeUnits) – The unit of the timerange (if not set, the default unit is minute)timestep (
float|int) – The timestep for the calibration (if not set, the default value is 1), the related unit is defined in the timestep_unit attributetimestep_unit (
TimeUnits) – The unit of the timestep (if not set, the default unit is second)sampling_time (
float|int) – The sampling time for the calibration (if not set, the default value is 1), the related unit is defined in the sampling_time_unit attributesampling_time_unit (
TimeUnits) – 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": { "$ref": "#/$defs/TimeUnits", "default": "minute" }, "timestep": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Timestep" }, "timestep_unit": { "$ref": "#/$defs/TimeUnits", "default": "second" }, "sampling_time": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Sampling Time" }, "sampling_time_unit": { "$ref": "#/$defs/TimeUnits", "default": "day" } }, "$defs": { "TimeUnits": { "description": "Possible time units for the time series data\n\nUsed for the configuration of time series queries\nand calculations in the system controller.", "enum": [ "second", "minute", "hour", "day", "month" ], "title": "TimeUnits", "type": "string" } } }
- pydantic model encodapy.config.models.TimeSettingsModel[source]
Bases:
BaseModelBase class for the time settings of the controller / system.
- Variables:
calculation (
TimeSettingsCalculationModel) – The timeranges and settings für the calculationcalibration (
TimeSettingsCalibrationModel|None) – The timeranges and settings for the 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", "type": "object", "properties": { "calculation": { "$ref": "#/$defs/TimeSettingsCalculationModel" }, "calibration": { "anyOf": [ { "$ref": "#/$defs/TimeSettingsCalibrationModel" }, { "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": { "$ref": "#/$defs/TimeUnits", "default": "minute" }, "timestep": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Timestep" }, "timestep_unit": { "$ref": "#/$defs/TimeUnits", "default": "second" }, "sampling_time": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Sampling Time" }, "sampling_time_unit": { "$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": { "$ref": "#/$defs/TimeUnits", "default": "minute" }, "timestep": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Timestep" }, "timestep_unit": { "$ref": "#/$defs/TimeUnits", "default": "second" }, "sampling_time": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "default": 1, "title": "Sampling Time" }, "sampling_time_unit": { "$ref": "#/$defs/TimeUnits", "default": "day" } }, "title": "TimeSettingsCalibrationModel", "type": "object" }, "TimeUnits": { "description": "Possible time units for the time series data\n\nUsed for the configuration of time series queries\nand calculations in the system controller.", "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: TimeSettingsCalibrationModel | None = None