1"""Defines the SetValuePayload model for value payloads using Basyx and Pydantic."""
6from basyx.aas.model
import Key, KeyTypes, ModelReference
7from pydantic
import BaseModel, Field, PrivateAttr
9KEY_TYPE_MAPPING: dict[str, str] = {
10 "Submodel":
"SUBMODEL",
11 "SubmodelElementCollection":
"SUBMODEL_ELEMENT_COLLECTION",
12 "Property":
"PROPERTY",
17 """Defines the model class of the payload for the `set_value` (URL `/set-value`) endpoint
18 of this application using Pydantic.
20 The JSON payload must contain exactly the following fields:
24 Inside the `Reference`-field, a properly serialized AAS reference according to the AAS JSON serialization
26 Will be parsed as `basyx.aas.model.ModelReference`.
27 The reference shall point to a SME in an AID submodel known to this application (refer to `add_or_update_config`).
33 "type": "ModelReference",
37 "value": "https://fluid40.de/ids/sm/4757_4856_8464_1441"
40 "type": "SubmodelElementCollection",
41 "value": "Interface_MQTT"
44 "type": "SubmodelElementCollection",
45 "value": "InteractionMetadata"
48 "type": "SubmodelElementCollection",
52 "type": "SubmodelElementCollection",
53 "value": "my_endpoint"
62 aid_ref_dict: dict = Field(..., alias=
"Reference")
63 value: Any = Field(..., alias=
"Value")
64 _aid_ref: ModelReference = PrivateAttr(default=
None)
72 raise ValueError(
"AID Reference has not been initialized.")
74 ref: ModelReference = ModelReference(key=tuple(key_list), type_=ModelReference)
78 key_type = KEY_TYPE_MAPPING.get(key_str)
80 raise ValueError(f
"Unknown key type: {key_str}")
81 return KeyTypes[key_type]
Defines the model class of the payload for the set_value (URL /set-value) endpoint of this applicatio...
__init__(self, **Any data)
KeyTypes _get_key_type(self, str key_str)
ModelReference _build_model_reference(self)